summaryrefslogtreecommitdiff
path: root/bin/common-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-11-22 11:26:18 +0100
committerErich Eckner <git@eckner.net>2017-11-22 11:26:18 +0100
commitcc40c54f84558cf16e26af461c06bf86f00df474 (patch)
tree45641c116ec48ab6338dbece7d27bbd833159ebe /bin/common-functions
parentfa596d42e2ecc173afb318d2cd2b6662241f5a98 (diff)
downloadbuilder-cc40c54f84558cf16e26af461c06bf86f00df474.tar.xz
bin/common-functions: expand_version/shrink_version: handle epoch
Diffstat (limited to 'bin/common-functions')
-rwxr-xr-xbin/common-functions8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/common-functions b/bin/common-functions
index 7cb1f90..060f49b 100755
--- a/bin/common-functions
+++ b/bin/common-functions
@@ -907,7 +907,8 @@ download_sources_by_hash() {
}
# expand_version $column_num
-# add "+0" to version in $colum_num-th column if no "+" is there
+# add "0:" to version in $colum_num-th column if no ":" is there (epoch)
+# add "+0" to version in $colum_num-th column if no "+" is there (git count/hash)
expand_version() {
local column_num
@@ -915,11 +916,13 @@ expand_version() {
sed '
/^\(\S\+\s\+\)\{'"$((column_num-1))"'\}\S*+/! s/^\(\(\S\+\s\+\)\{'"$((column_num-1))"'\}\S*\)-/\1+0-/
+ /^\(\S\+\s\+\)\{'"$((column_num-1))"'\}\S*:/! s/^\(\(\S\+\s\+\)\{'"$((column_num-1))"'\}\)/\10:/
'
}
# shrink_version $column_num
-# remove "+0" from version in $colum_num-th column
+# remove "0:" from version in $colum_num-th column (epoch)
+# remove "+0" from version in $colum_num-th column (git count/hash)
shrink_version() {
local column_num
@@ -927,6 +930,7 @@ shrink_version() {
sed '
s/^\(\(\S\+\s\+\)\{'"$((column_num-1))"'\}\S*\)+0-/\1-/
+ s/^\(\(\S\+\s\+\)\{'"$((column_num-1))"'\}\)0:/\1/
'
}