diff options
author | Werner Koch <[email protected]> | 2014-06-06 14:29:41 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-06-06 15:16:37 +0000 |
commit | b67e4e523e6d19d384e23c5bb03010caebd150e7 (patch) | |
tree | 503b12ee073908e80f7aaeb2ecfd95c74f8ab831 | |
parent | Post beta release update. (diff) | |
download | gnupg-b67e4e523e6d19d384e23c5bb03010caebd150e7.tar.gz gnupg-b67e4e523e6d19d384e23c5bb03010caebd150e7.zip |
Improve the beta number generation.
* autogen.sh: Add option --find-version
* configure.ac: Rework the setting of the mym4_ variables.
--
The old system was not too well defined if no release for a series has
yet been done. We now introduce a "PACKAGE-N.M-base" tag to solve
this problem. To keep the M4 code readable the GIT parsing has been
moved to ./autogen.sh.
Diffstat (limited to '')
-rw-r--r-- | autogen.rc | 2 | ||||
-rwxr-xr-x | autogen.sh | 61 | ||||
-rw-r--r-- | configure.ac | 34 |
3 files changed, 81 insertions, 16 deletions
diff --git a/autogen.rc b/autogen.rc index 0f3d9d879..4860c38b3 100644 --- a/autogen.rc +++ b/autogen.rc @@ -1,5 +1,7 @@ # autogen.sh configuration for GnuPG -*- sh -*- +#version_parts=3 + case "$myhost:$myhostsub" in w32:ce) extraoptions="--enable-dirmngr-auto-start --disable-scdaemon " diff --git a/autogen.sh b/autogen.sh index 471193c2a..2b0a5dc51 100755 --- a/autogen.sh +++ b/autogen.sh @@ -15,7 +15,7 @@ # configure it for the respective package. It is maintained as part of # GnuPG and source copied by other packages. # -# Version: 2014-01-10 +# Version: 2014-06-06 configure_ac="configure.ac" @@ -41,7 +41,7 @@ fatal () { info () { if [ -z "${SILENT}" ]; then - echo "autogen.sh:" "$*" + echo "autogen.sh:" "$*" >&2 fi } @@ -72,6 +72,7 @@ FORCE= SILENT= tmp=$(dirname "$0") tsdir=$(cd "${tmp}"; pwd) +version_parts=3 if [ -n "${AUTOGEN_SH_SILENT}" ]; then SILENT=" --silent" @@ -133,6 +134,11 @@ amd64_toolprefixes= myhost="" myhostsub="" case "$1" in + --find-version) + myhost="find-version" + SILENT=" --silent" + shift + ;; --build-w32) myhost="w32" shift @@ -172,6 +178,57 @@ if [ -f "$HOME/.gnupg-autogen.rc" ]; then . "$HOME/.gnupg-autogen.rc" fi + +# **** FIND VERSION **** +# 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" + + case "$version_parts" in + 2) + matchstr1="$package-$major.*[0-9]" + matchstr2="$package-$major-base" + vers="$major.$minor" + ;; + *) + matchstr1="$package-$major.$minor.*[0-9]" + matchstr2="$package-$major.$minor-base" + vers="$major.$minor.$micro" + ;; + esac + + 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 "${matchstr2}" --long 2>/dev/null \ + | awk -F- '$4!=0{print"-beta"$4}') + fi + [ -n "$tmp" ] && beta=yes + rev=$(git rev-parse --short HEAD | tr -d '\n\r') + rvd=$((0x$(echo ${rev} | head -c 4))) + else + ingit=no + beta=yes + tmp="-unknown" + rev="0000000" + rvd="0" + fi + + echo "$package-$vers$tmp:$beta:$ingit:$vers$tmp:$vers:$tmp:$rev:$rvd:" + exit 0 +fi +# **** end FIND VERSION **** + + # ****************** # W32 build script # ****************** diff --git a/configure.ac b/configure.ac index 2c613a7f0..309b2bcf2 100644 --- a/configure.ac +++ b/configure.ac @@ -26,23 +26,29 @@ min_automake_version="1.10" # (git tag -s gnupg-2.n.m) and run "./autogen.sh --force". Please # bump the version number immediately *after* the release and do # another commit and push so that the git magic is able to work. -m4_define([mym4_version], [2.1.0]) +m4_define([mym4_package],[gnupg]) +m4_define([mym4_major], [2]) +m4_define([mym4_minor], [1]) +m4_define([mym4_micro], [0]) + +# To start a new development series, i.e a new major or minor number +# you need to mark an arbitrary commit before the first beta release +# with an annotated tag. For example the 2.1 branch starts off with +# the tag "gnupg-2.1-base". This is used as the base for counting +# beta numbers before the first release of a series. # Below is m4 magic to extract and compute the git revision number, # the decimalized short revision number, a beta version string and a -# flag indicating a development version (mym4_isgit). Note that the +# flag indicating a development version (mym4_isbeta). Note that the # m4 processing is done by autoconf and not during the configure run. -m4_define([mym4_revision], - m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r'])) -m4_define([mym4_revision_dec], - m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))])) -m4_define([mym4_betastring], - m4_esyscmd_s([git describe --match 'gnupg-2.[0-9].*[0-9]' --long|\ - awk -F- '$3!=0{print"-beta"$3}'])) -m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes])) -m4_define([mym4_full_version],[mym4_version[]mym4_betastring]) - -AC_INIT([gnupg],[mym4_full_version], [http://bugs.gnupg.org]) +m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \ + mym4_package mym4_major mym4_minor mym4_micro),[:])) +m4_define([mym4_isbeta], m4_argn(2, mym4_verslist)) +m4_define([mym4_version], m4_argn(4, mym4_verslist)) +m4_define([mym4_revision], m4_argn(7, mym4_verslist)) +m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist)) + +AC_INIT([mym4_package],[mym4_version], [http://bugs.gnupg.org]) NEED_GPG_ERROR_VERSION=1.13 @@ -61,7 +67,7 @@ NEED_NPTH_VERSION=0.91 NEED_GNUTLS_VERSION=3.0 -development_version=mym4_isgit +development_version=mym4_isbeta PACKAGE=$PACKAGE_NAME PACKAGE_GT=${PACKAGE_NAME}2 VERSION=$PACKAGE_VERSION |