On 5/27/25 22:20, Werner Koch wrote:
On Tue, 27 May 2025 10:43, Yi Zhao said:

Thanks for your response. May I know why gnupg adds this suffix? As
far as I know, it is not uncommon to re-run autoreconf on the tarball.
To know which version this is.  This helps us in supporting the
software.  The mechanism to add such a suffix is integratred into the
Beta version number construction code found in ./autogen.sh:

--8<---------------cut here---------------start------------->8---
# This is a helper for the configure.ac M4 magic
# Called
#   ./autogen.sh --find-version PACKAGE MAJOR MINOR [MICRO]
# returns a complete version string with automatic beta numbering.
if [ "$myhost" = "find-version" ]; then
     package="$1"
     major="$2"
     minor="$3"
     micro="$4"

     if [ -z "$package" -o -z "$major" -o -z "$minor" ]; then
       echo "usage: ./autogen.sh --find-version PACKAGE MAJOR MINOR [MICRO]" >&2
       exit 1
     fi

     if [ -z "$micro" ]; then
       matchstr1="$package-$major.[0-9]*"
       matchstr2="$package-$major-base"
       matchstr3=""
       vers="$major.$minor"
     else
       matchstr1="$package-$major.$minor.[0-9]*"
       matchstr2="$package-$major.[0-9]*-base"
       matchstr3="$package-$major-base"
       vers="$major.$minor.$micro"
     fi
     matchexcl="--exclude $package-*beta*"

     beta=no
     if [ -e .git ]; then
       ingit=yes
       tmp=$(git describe --match "${matchstr1}" $matchexcl --long 2>/dev/null)
       if [ -n "$tmp" ]; then
           tmp=$(echo "$tmp" | sed s/^"$package"// \
                     | awk -F- '$3!=0 && $3 !~ /^beta/ {print"-beta"$3}')
       else
           # (due tof "-base" in the tag we need to take the 4th field)
           tmp=$(git describe --match "${matchstr2}" $matchexcl --long 
2>/dev/null)
           if [ -n "$tmp" ]; then
               tmp=$(echo "$tmp" | sed s/^"$package"// \
                         | awk -F- '$4!=0 && $4 !~ /^beta/ {print"-beta"$4}')
           elif [ -n "${matchstr3}" ]; then
               tmp=$(git describe --match "${matchstr3}" $matchexcl --long 
2>/dev/null)
               if [ -n "$tmp" ]; then
                   tmp=$(echo "$tmp" | sed s/^"$package"// \
                           | awk -F- '$4!=0 && $4 !~ /^beta/ {print"-beta"$4}')
               fi
           fi
       fi
       [ -n "$tmp" ] && beta=yes
       cid=$(git rev-parse --verify HEAD | tr -d '\n\r')
       rev=$(git rev-parse --short HEAD | tr -d '\n\r')
       rvd=$((0x$(echo ${rev} | dd bs=1 count=4 2>/dev/null)))
     else
       ingit=no
       beta=yes
       tmp="-unknown"
       cid="0000000"
       rev="0000000"
       rvd="0"
     fi

     echo "$package-$vers$tmp:$beta:$ingit:$vers$tmp:$vers:$tmp:$rev:$rvd:$cid:"
     exit 0
fi
--8<---------------cut here---------------end--------------->8---

Thus if you run it from git, git will be used to construct a beta
version number using the describe mechanism along with some tags.  If no
git is there we can't do this but in this case you should also not
reconstruct configure - if you do "-unknown" is appended.

When processing configure.ac with autoconf M4 macros are executed and
they will run helper tool (e.g. "./autogen.sh --find-version").  The
result of of the autoconf run and the output of the helper tools is then
baked into the constructed configure.

Running autoreconf can be done, but this may result in different built
source code than what has been distributed.  Don't do it unless you are
prepared to handle the problems ;-)


Thank you for the explanation, much appreciated.


//Yi




Salam-Shalom,

    Werner



_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gnupg-devel

Reply via email to