Move the version string out of configure.ac.
authorWayne Davison <wayne@opencoder.net>
Sun, 28 Jun 2020 20:46:48 +0000 (13:46 -0700)
committerWayne Davison <wayne@opencoder.net>
Sun, 28 Jun 2020 22:02:19 +0000 (15:02 -0700)
Makefile.in
configure.ac
md2man
packaging/release-rsync
rsync.h
version.h [new file with mode: 0644]

index 24156d4b7d1a0a2850c32f351d9508e270ea9419..6b2d5cec65675009487e16d8faf54d23b9f888e5 100644 (file)
@@ -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
index 9275ce757900fd7cb98d2f721125a1f58abf998c..3676a716ffb3f34cfc8ef06c48189c8b4efbce8d 100644 (file)
@@ -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 ef4e58d64f36f39dc8bce67e5e9ab8a072b622c7..992d7320f997b34332afe364b78f3934f0dba8c8 100755 (executable)
--- 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:
index 629ee25d2227929c85ddb4c726e41228faecd990..541678f074c467ec09b1c4324a93318d30d721d3 100755 (executable)
@@ -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 45de2314b452fc308b5f38be95a859c3f7170278..d54eb39946a1003ab6e18584ddb634e09da0f75c 100644 (file)
--- 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 (file)
index 0000000..cb1d1f7
--- /dev/null
+++ b/version.h
@@ -0,0 +1 @@
+#define RSYNC_VERSION "3.2.2pre1"