]> arthur.barton.de Git - netdata.git/blobdiff - packaging/packaging.functions
Merge pull request #1998 from ktsaou/master
[netdata.git] / packaging / packaging.functions
index 397157fcdbee2772c27227302ac1d34a9c56b987..c18c8fe1842c72ba7bdfef9ad230305e00c48c37 100644 (file)
@@ -102,8 +102,10 @@ get_changelog_version() {
 get_configure_ac_version() {
   get_staged_file configure.ac
   local v=`sed -n \
-         -e '/define(\[VERSION_\(MINOR\|FIX\)/s/.*\[\([^[]*\)\].*/.\1/p' \
-         -e '/define(\[VERSION_\(MAJOR\|SUFFIX\)/s/.*\[\([^[]*\)\].*/\1/p' \
+         -e '/define(\[VERSION_MAJOR/s/.*\[\([^[]*\)\].*/\1/p' \
+         -e '/define(\[VERSION_MINOR/s/.*\[\([^[]*\)\].*/.\1/p' \
+         -e '/define(\[VERSION_FIX/s/.*\[\([^[]*\)\].*/.\1/p' \
+         -e '/define(\[VERSION_SUFFIX/s/.*\[\([^[]*\)\].*/\1/p' \
          $MYTMP/files/configure.ac | tr -d '\n'`
   if [ ! "$v" ]; then v="No version in configure.ac!"; fi
   echo "$v"
@@ -124,9 +126,9 @@ get_configure_ac_rpmrel() {
 }
 
 get_spec_version() {
-  get_staged_file "$1".spec.in
+  get_staged_file -o "$1".spec.in
   test -f $MYTMP/files/"$1".spec.in || return 0 # Spec file is optional
-  sed -n -e '1,/^%changelog/d' -e '/^*/{s/.*- \([0-9].*\)/\1/p;q}' "$1".spec.in
+  sed -n -e '1,/^%changelog/d' -e '/^*/{' -e 's/.*- \([0-9].*\)/\1/p' -e q -e '}' "$1".spec.in
 }
 
 splitver() {
@@ -254,10 +256,6 @@ check_versions() {
     then
       echo "Version in configure.ac ($confver) differs from ChangeLog ($clogver)"
       status=1
-    elif [ "$(git tag -l v$confver)" ]
-    then
-      echo "Tag v$confver already exists"
-      status=1
     fi
 
     if [ "$specver" ]
@@ -270,24 +268,33 @@ check_versions() {
       fi
     fi
 
-    if [ "$(git config user.signingkey)" = "" ]
+    if [ ! "$TRAVIS_TAG" ]
     then
-      echo "You need to set up a PGP signing key e.g.:"
-      echo "   gpg --list-keys"
-      echo "and"
-      echo "   git config user.signingkey SHORTID"
-      echo "or"
-      echo "   git config --global user.signingkey SHORTID"
-      status=1
-    fi
+      if [ "$(git tag -l v$confver)" ]
+      then
+        echo "Tag v$confver already exists"
+        status=1
+      fi
 
-    git status -s | grep "^?" > $MYTMP/needclean
-    if [ -s $MYTMP/needclean ]
-    then
-      echo "The following files must be dealt with before commit:"
-      cat $MYTMP/needclean
-      echo "e.g. add them to .gitignore or remove with 'git clean -fdx'"
-      status=1
+      if [ "$(git config user.signingkey)" = "" ]
+      then
+        echo "You need to set up a PGP signing key e.g.:"
+        echo "   gpg --list-keys"
+        echo "and"
+        echo "   git config user.signingkey SHORTID"
+        echo "or"
+        echo "   git config --global user.signingkey SHORTID"
+        status=1
+      fi
+
+      git status -s | grep "^?" > $MYTMP/needclean
+      if [ -s $MYTMP/needclean ]
+      then
+        echo "The following files must be dealt with before commit:"
+        cat $MYTMP/needclean
+        echo "e.g. add them to .gitignore or remove with 'git clean -fdx'"
+        status=1
+      fi
     fi
   fi