gpg: Minor change for better readability.
[gnupg.git] / autogen.sh
index a6b5909..31cfeeb 100755 (executable)
@@ -202,12 +202,12 @@ if [ "$myhost" = "find-version" ]; then
 
     case "$version_parts" in
       2)
-        matchstr1="$package-$major.*[0-9]"
+        matchstr1="$package-$major.[0-9][0-9]*"
         matchstr2="$package-$major-base"
         vers="$major.$minor"
         ;;
       *)
-        matchstr1="$package-$major.$minor.*[0-9]"
+        matchstr1="$package-$major.$minor.[0-9][0-9]*"
         matchstr2="$package-$major.$minor-base"
         vers="$major.$minor.$micro"
         ;;
@@ -216,9 +216,10 @@ if [ "$myhost" = "find-version" ]; then
     beta=no
     if [ -d .git ]; then
       ingit=yes
-      tmp=$(git describe --match "${matchstr1}" --long 2>/dev/null \
-            | awk -F- '$3!=0 && $3 !~ /^beta/ {print"-beta"$3}' )
-      if [ -z "$tmp" ]; then
+      tmp=$(git describe --match "${matchstr1}" --long 2>/dev/null)
+      if [ -n "$tmp" ]; then
+          tmp=$(echo "$tmp"|awk -F- '$3!=0 && $3 !~ /^beta/ {print"-beta"$3}')
+      else
           tmp=$(git describe --match "${matchstr2}" --long 2>/dev/null \
                 | awk -F- '$4!=0{print"-beta"$4}')
       fi