From: Wayne Davison Date: Sun, 28 Jun 2020 20:46:48 +0000 (-0700) Subject: Move the version string out of configure.ac. X-Git-Tag: v3.2.2pre2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3b4f5fb891e57ecda3fe09c3b93fc458c8cc81a7;p=thirdparty%2Frsync.git Move the version string out of configure.ac. --- diff --git a/Makefile.in b/Makefile.in index 24156d4b..6b2d5cec 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,4 @@ -# Makefile for rsync. This is processed by configure to produce the final -# Makefile +# The input file that configure uses to create the Makefile for rsync. prefix=@prefix@ datarootdir=@datarootdir@ @@ -27,8 +26,6 @@ MKDIR_P=@MKDIR_P@ VPATH=$(srcdir) SHELL=/bin/sh -VERSION=@RSYNC_VERSION@ - .SUFFIXES: .SUFFIXES: .c .o @@ -38,7 +35,7 @@ ASM_x86_64=lib/md5-asm-x86_64.o GENFILES=configure.sh aclocal.m4 config.h.in proto.h proto.h-tstamp rsync.1 rsync.1.html \ rsync-ssl.1 rsync-ssl.1.html rsyncd.conf.5 rsyncd.conf.5.html HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \ - lib/pool_alloc.h lib/mdigest.h lib/md-defines.h + lib/pool_alloc.h lib/mdigest.h lib/md-defines.h version.h LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \ lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o @LIBOBJS@ zlib_OBJS=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \ @@ -236,13 +233,13 @@ proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h .PHONY: man man: rsync.1 rsync-ssl.1 rsyncd.conf.5 -rsync.1: rsync.1.md md2man NEWS.md Makefile +rsync.1: rsync.1.md md2man version.h Makefile @$(srcdir)/maybe-make-man $(srcdir) rsync.1.md -rsync-ssl.1: rsync-ssl.1.md md2man NEWS.md Makefile +rsync-ssl.1: rsync-ssl.1.md md2man version.h Makefile @$(srcdir)/maybe-make-man $(srcdir) rsync-ssl.1.md -rsyncd.conf.5: rsyncd.conf.5.md md2man NEWS.md Makefile +rsyncd.conf.5: rsyncd.conf.5.md md2man version.h Makefile @$(srcdir)/maybe-make-man $(srcdir) rsyncd.conf.5.md .PHONY: clean diff --git a/configure.ac b/configure.ac index 9275ce75..3676a716 100644 --- a/configure.ac +++ b/configure.ac @@ -1,16 +1,15 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([rsync],[3.2.2pre1],[https://rsync.samba.org/bugtracking.html]) +AC_INIT([rsync],[],[https://rsync.samba.org/bugtracking.html]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([byteorder.h]) AC_CONFIG_HEADER(config.h) AC_PREREQ([2.69]) -AC_SUBST(RSYNC_VERSION, $PACKAGE_VERSION) -AC_MSG_NOTICE([Configuring rsync $PACKAGE_VERSION]) +PACKAGE_VERSION=`sed 's/.*"\(.*\)".*/\1/' <$srcdir/version.h` -AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$PACKAGE_VERSION"], [rsync release version]) +AC_MSG_NOTICE([Configuring rsync $PACKAGE_VERSION]) LDFLAGS=${LDFLAGS-""} @@ -1338,5 +1337,5 @@ AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig]) AC_OUTPUT AC_MSG_RESULT() -AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful]) +AC_MSG_RESULT([ rsync $PACKAGE_VERSION configuration successful]) AC_MSG_RESULT() diff --git a/md2man b/md2man index ef4e58d6..992d7320 100755 --- a/md2man +++ b/md2man @@ -93,7 +93,7 @@ def main(): env_subs['VERSION'] = '1.0.0' env_subs['libdir'] = '/usr' else: - for fn in (fi.srcdir + 'NEWS.md', 'Makefile'): + for fn in (fi.srcdir + 'version.h', 'Makefile'): try: st = os.lstat(fn) except: @@ -101,6 +101,11 @@ def main(): if not fi.mtime: fi.mtime = st.st_mtime + with open(fi.srcdir + 'version.h', 'r', encoding='utf-8') as fh: + txt = fh.read() + m = re.search(r'"(.+?)"', txt) + env_subs['VERSION'] = m.group(1) + with open('Makefile', 'r', encoding='utf-8') as fh: for line in fh: m = re.match(r'^(\w+)=(.+)', line) @@ -112,7 +117,7 @@ def main(): while re.search(r'\$\{', val): val = re.sub(r'\$\{(\w+)\}', lambda m: env_subs[m.group(1)], val) env_subs[var] = val - if var == 'VERSION': + if var == 'srcdir': break with open(fi.fn, 'r', encoding='utf-8') as fh: diff --git a/packaging/release-rsync b/packaging/release-rsync index 629ee25d..541678f0 100755 --- a/packaging/release-rsync +++ b/packaging/release-rsync @@ -153,7 +153,7 @@ release is "{release}" About to: - tweak SUBPROTOCOL_VERSION in rsync.h, if needed - - tweak the version in configure.ac and the spec files + - tweak the version in version.h and the spec files - tweak NEWS.md to ensure header values are correct - generate configure.sh, config.h.in, and proto.h - page through the differences @@ -168,16 +168,15 @@ About to: '%define srcdir': srcdir, } - tweak_files = 'configure.ac rsync.h NEWS.md'.split() + tweak_files = 'version.h rsync.h NEWS.md'.split() tweak_files += glob.glob('packaging/*.spec') tweak_files += glob.glob('packaging/*/*.spec') for fn in tweak_files: with open(fn, 'r', encoding='utf-8') as fh: old_txt = txt = fh.read() - if 'configure' in fn: - x_re = re.compile(r'^(AC_INIT\(\[rsync\],\s*\[)\d.+?(\])', re.M) - txt = replace_or_die(x_re, r'\g<1>%s\2' % version, txt, f"Unable to update AC_INIT with version in {fn}") + if fn == 'version.h': + txt = f"#define RSYNC_VERSION {version}\n" elif '.spec' in fn: for var, val in specvars.items(): x_re = re.compile(r'^%s .*' % re.escape(var), re.M) @@ -237,7 +236,7 @@ About to: if s.returncode: die('Aborting') - cmd_chk('make reconfigure ; make gen') + cmd_chk('make gen') cmd_chk(['rsync', '-a', *gen_files, 'SaVeDiR/']) print(f'Creating any missing patch branches.') diff --git a/rsync.h b/rsync.h index 45de2314..d54eb399 100644 --- a/rsync.h +++ b/rsync.h @@ -297,6 +297,7 @@ enum delret { #include "errcode.h" #include "config.h" +#include "version.h" /* The default RSYNC_RSH is always set in config.h. */ diff --git a/version.h b/version.h new file mode 100644 index 00000000..cb1d1f72 --- /dev/null +++ b/version.h @@ -0,0 +1 @@ +#define RSYNC_VERSION "3.2.2pre1"