[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <3789097A-B108-4247-9CFE-886B1A068503@dilger.ca>
Date: Wed, 11 Jan 2023 17:23:02 -0700
From: Andreas Dilger <adilger@...ger.ca>
To: Theodore Ts'o <tytso@....edu>
Cc: linux-ext4@...r.kernel.org
Subject: Re: [PATCH] build: split version and release in configure
On Jan 9, 2023, at 9:10 PM, Andreas Dilger <adilger@...ger.ca> wrote:
>
> Update configure.ac to separate Version from Release if there is
> a '-' in version.h::E2FSPROGS_VERSION (e.g. "1.46.6-rc1").
>
> Simplify the generation of E2FSPROGS_VERESION, E2FSPROGS_DATE and
> E2FSPROGS_DAY to avoid multiple grep/awk/sed/tr stages.
>
> Signed-off-by: Andreas Dilger <adilger@...ger.ca>
Ted,
indirectly related to this patch, I also noticed that configure.ac
is not setting the version or URL fields in AC_INIT, as is typical.
I'm not sure if that was intentional, or if AC_INIT usage predates
this functionality in autoconf?
That leaves the PACKAGE_NAME, PACKAGE_TARNAME, PACKAGE_BUGREPORT,
PACKAGE_URL, and PACKAGE_STRING macros undefined in the configure file,
and these are used in some messages, and can generate a warning in
some autoconf versions.
We could initialize some of these values from version.h if you prefer
to use that as the canonical version source, or do the reverse and
declare the release version via AC_INIT and #define PACKAGE_VERSION
and/or E2FSPROGS_VERSION defined in config.h instead of version.h?
I was looking at adding the following at the top of configure.ac:
AC_INIT([e2fsprogs],
m4_esyscmd_s({awk -F\" '/E2FSPROGS_VER/ { print $2 }' version.h]),
[https://tracker.debian.org/pkg/e2fsprogs/],
[e2fsprogs],
[https://e2fsprogs.sourceforge.net/])
dnl closing quote to make syntax highlighting happy"
so that it extracts the canonical version from version.h so your workflow
is not changed, but this does mean that "configure" would be modified for
each new release. This generates the following defines in configure.ac:
PACKAGE_NAME='e2fsprogs'
PACKAGE_TARNAME='e2fsprogs'
PACKAGE_VERSION=1.46.6-rc1
PACKAGE_STRING='e2fsprogs 1.46.6-rc1'
PACKAGE_BUGREPORT='https://tracker.debian.org/pkg/e2fsprogs/'
PACKAGE_URL='https://e2fsprogs.sourceforge.net/'
I was originally going to use sourceforge.net for the PACKAGE_BUGREPORT URL,
since that is the URL reported in most of the header files, but I had a
look at the issues there and they are all 10 years old. It looks like
debian.org is the only place where issues are tracked.
Cheers, Andreas
> ---
> configure | 17 +++++++++--------
> configure.ac | 18 ++++++++++--------
> util/gen-tarball.in | 7 ++++---
> 3 files changed, 23 insertions(+), 19 deletions(-)
>
> diff --git a/configure b/configure
> index caf6661df318..ea364e551eca 100755
> --- a/configure
> +++ b/configure
> @@ -824,6 +824,7 @@ build_cpu
> build
> E2FSPROGS_DATE
> E2FSPROGS_PKGVER
> +E2FSPROGS_PKGREL
> E2FSPROGS_VERSION
> E2FSPROGS_DAY
> E2FSPROGS_MONTH
> @@ -4581,11 +4582,9 @@ fi
> MCONFIG=./MCONFIG
>
> BINARY_TYPE=bin
> -E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \
> - | awk '{print $3}' | tr \" " " | awk '{print $1}'`
> -E2FSPROGS_DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
> - | tr \" " " | awk '{print $1}'`
> -E2FSPROGS_DAY=$(echo $E2FSPROGS_DATE | awk -F- '{print $1}' | sed -e '/^[1-9]$/s/^/0/')
> +E2FSPROGS_VERSION=`awk -F\" '/E2FSPROGS_VERS/ { print $2 }' ${srcdir}/version.h`
> +E2FSPROGS_DATE=`awk -F\" '/E2FSPROGS_DATE/ { print $2 }' ${srcdir}/version.h`
> +E2FSPROGS_DAY=$(echo $E2FSPROGS_DATE | awk -F- '{ printf "%02d", $1 }')
> MONTH=`echo $E2FSPROGS_DATE | awk -F- '{print $2}'`
> YEAR=`echo $E2FSPROGS_DATE | awk -F- '{print $3}'`
>
> @@ -4614,17 +4613,19 @@ Dec) MONTH_NUM=12; E2FSPROGS_MONTH="December" ;;
> printf "%s\n" "$as_me: WARNING: Unknown month $MONTH??" >&2;} ;;
> esac
>
> -base_ver=`echo $E2FSPROGS_VERSION | \
> - sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
> +base_ver=`echo $E2FSPROGS_VERSION | sed -e 's/pre-//' -e 's/-.*//'`
> +base_rel=`echo $E2FSPROGS_VERSION | awk -F- '{ print $2 }'`
>
> date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
>
> case $E2FSPROGS_VERSION in
> *-WIP|pre-*)
> - E2FSPROGS_PKGVER="$base_ver~WIP.$date_spec"
> + E2FSPROGS_PKGVER="$base_ver"
> + E2FSPROGS_PKGREL="WIP.$date_spec"
> ;;
> *)
> E2FSPROGS_PKGVER="$base_ver"
> + E2FSPROGS_PKGREL="$base_rel"
> ;;
> esac
>
> diff --git a/configure.ac b/configure.ac
> index 4ece83e9ba22..0dc28d2316cc 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -11,11 +11,9 @@ BINARY_TYPE=bin
> dnl
> dnl This is to figure out the version number and the date....
> dnl
> -E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \
> - | awk '{print $3}' | tr \" " " | awk '{print $1}'`
> -E2FSPROGS_DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
> - | tr \" " " | awk '{print $1}'`
> -E2FSPROGS_DAY=$(echo $E2FSPROGS_DATE | awk -F- '{print $1}' | sed -e '/^[[1-9]]$/s/^/0/')
> +E2FSPROGS_VERSION=`awk -F\" '/E2FSPROGS_VERS/ { print $2 }' ${srcdir}/version.h`
> +E2FSPROGS_DATE=`awk -F\" '/E2FSPROGS_DATE/ { print $2 }' ${srcdir}/version.h`
> +E2FSPROGS_DAY=$(echo $E2FSPROGS_DATE | awk -F- '{ printf "%02d", $1 }')
> MONTH=`echo $E2FSPROGS_DATE | awk -F- '{print $2}'`
> YEAR=`echo $E2FSPROGS_DATE | awk -F- '{print $3}'`
>
> @@ -43,27 +41,31 @@ Dec) MONTH_NUM=12; E2FSPROGS_MONTH="December" ;;
> *) AC_MSG_WARN([Unknown month $MONTH??]) ;;
> esac
>
> -base_ver=`echo $E2FSPROGS_VERSION | \
> - sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
> +base_ver=`echo $E2FSPROGS_VERSION | sed -e 's/pre-//' -e 's/-.*//'`
> +base_rel=`echo $E2FSPROGS_VERSION | awk -F- '{ print $2 }'`
>
> date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
>
> case $E2FSPROGS_VERSION in
> *-WIP|pre-*)
> - E2FSPROGS_PKGVER="$base_ver~WIP.$date_spec"
> + E2FSPROGS_PKGVER="$base_ver"
> + E2FSPROGS_PKGREL="WIP.$date_spec"
> ;;
> *)
> E2FSPROGS_PKGVER="$base_ver"
> + E2FSPROGS_PKGREL="$base_rel"
> ;;
> esac
>
> unset DATE MONTH YEAR base_ver pre_vers date_spec
> AC_MSG_RESULT([Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION])
> +AC_MSG_RESULT([Package version ${E2FSPROGS_PKGVER} release ${E2FSPROGS_PKGREL}])
> AC_MSG_RESULT([Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}])
> AC_SUBST(E2FSPROGS_YEAR)
> AC_SUBST(E2FSPROGS_MONTH)
> AC_SUBST(E2FSPROGS_DAY)
> AC_SUBST(E2FSPROGS_VERSION)
> +AC_SUBST(E2FSPROGS_PKGREL)
> AC_SUBST(E2FSPROGS_PKGVER)
> AC_SUBST(E2FSPROGS_DATE)
> dnl
> diff --git a/util/gen-tarball.in b/util/gen-tarball.in
> index 997bd935f730..650d3b5930ae 100644
> --- a/util/gen-tarball.in
> +++ b/util/gen-tarball.in
> @@ -5,7 +5,8 @@
> srcdir=@...dir@
> top_srcdir=@..._srcdir@
> top_dir=`cd $top_srcdir; pwd`
> -base_ver=`echo @E2FSPROGS_VERSION@ | sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
> +base_ver=`echo @E2FSPROGS_PKGVER@`
> +base_rel=`echo @E2FSPROGS_PKGREL@`
> base_e2fsprogs=`basename $top_dir`
> exclude=/tmp/exclude$$
> GZIP=gzip
> @@ -16,12 +17,12 @@ GZIP=gzip
> # using a non-standard directory name for WIP releases. dpkg-source
> # complains, but life goes on.
> #
> -deb_pkgver=`echo @E2FSPROGS_PKGVER@ | sed -e 's/~/-/g'`
> +deb_pkgver="$base_ver${base_rel:+-$base_rel}"
>
> case $1 in
> debian|ubuntu)
> SRCROOT="e2fsprogs-$deb_pkgver"
> - tarout="e2fsprogs_@...SPROGS_PKGVER@...ig.tar.gz"
> + tarout="e2fsprogs_$deb_pkgver.orig.tar.gz"
> ;;
> all|*)
> SRCROOT="e2fsprogs-$base_ver"
> --
> 1.8.3.1
>
Cheers, Andreas
Download attachment "signature.asc" of type "application/pgp-signature" (874 bytes)
Powered by blists - more mailing lists