]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Improvements for release process; a gensend hook.
authorWayne Davison <wayne@opencoder.net>
Wed, 10 Jun 2020 16:21:21 +0000 (09:21 -0700)
committerWayne Davison <wayne@opencoder.net>
Wed, 10 Jun 2020 16:31:01 +0000 (09:31 -0700)
Makefile.in
md2man
packaging/nightly-rsync
packaging/pkglib.py
packaging/pre-push [new file with mode: 0755]
packaging/release-rsync

index e7f2f6448b2894acd2e96858eecbddf4b6cfa2c4..33f7853862beb9a5da3586c30ba6743b032aa367 100644 (file)
@@ -150,7 +150,7 @@ t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
 gen: conf proto.h man
 
 gensend: gen
-       rsync -aivzc $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
+       rsync -aic $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
 
 conf:
        cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
@@ -217,13 +217,13 @@ proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
 
 man: rsync.1 rsync-ssl.1 rsyncd.conf.5
 
-rsync.1: rsync.1.md md2man latest-year.h Makefile
+rsync.1: rsync.1.md md2man NEWS.md Makefile
        @$(srcdir)/maybe-make-man $(srcdir) rsync.1.md
 
-rsync-ssl.1: rsync-ssl.1.md md2man latest-year.h Makefile
+rsync-ssl.1: rsync-ssl.1.md md2man NEWS.md Makefile
        @$(srcdir)/maybe-make-man $(srcdir) rsync-ssl.1.md
 
-rsyncd.conf.5: rsyncd.conf.5.md md2man latest-year.h Makefile
+rsyncd.conf.5: rsyncd.conf.5.md md2man NEWS.md Makefile
        @$(srcdir)/maybe-make-man $(srcdir) rsyncd.conf.5.md
 
 clean: cleantests
diff --git a/md2man b/md2man
index a84154fcf4ee6ed30edd702eb82a2914863c9f3a..c623efb96cc97e19eb0f0dd159c4be5af62e2d12 100755 (executable)
--- a/md2man
+++ b/md2man
@@ -15,7 +15,7 @@
 #
 # This program is freely redistributable.
 
-import sys, os, re, argparse, time
+import sys, os, re, argparse, subprocess, time
 from html.parser import HTMLParser
 
 CONSUMES_TXT = set('h1 h2 p li pre'.split())
@@ -78,16 +78,21 @@ def main():
         fi.srcdir = './'
 
     fi.title = fi.prog + '(' + fi.sect + ') man page'
-    fi.date = None
+    fi.mtime = None
 
-    chk_files = 'latest-year.h Makefile'.split()
+    if os.path.lexists(fi.srcdir + '.git'):
+        fi.mtime = int(subprocess.check_output('git log -1 --format=%at'.split()))
+
+    chk_files = 'NEWS.md Makefile'.split()
     for fn in chk_files:
         try:
             st = os.lstat(fi.srcdir + fn)
         except:
             die('Failed to find', fi.srcdir + fn)
-        if not fi.date:
-            fi.date = time.strftime('%d %b %Y', time.localtime(st.st_mtime))
+        if not fi.mtime:
+            fi.mtime = st.st_mtime
+
+    fi.date = time.strftime('%d %b %Y', time.localtime(fi.mtime))
 
     env_subs = { }
 
index 021a2c589d0a121944146262c10977224fb644b7..4b4695c136cc6689237316906b98112a83d31b52 100755 (executable)
@@ -37,9 +37,11 @@ def main():
     if not os.path.exists('rsyncd.conf.5.md'):
         die("There is no rsync checkout in the current directory.")
 
+    mandate_gensend_hook()
+
     if args.make_tar:
         check_git_state('master')
-        cmd_chk(['touch', 'latest-year.h'])
+        cmd_chk(['touch', 'NEWS.md'])
         cmd_chk(['make', gen_target])
         cmd_chk(['rsync', '-a', *glob.glob('*.[1-9].html'), dest])
 
index 69fdfd47eec685b3ec4d463d2977f3ee1e1f8d3b..838aac9f563a66c9f0ec69107d7cc838ac5d7ae0 100644 (file)
@@ -169,6 +169,17 @@ def get_patch_branches(base_branch):
     return branches
 
 
+def mandate_gensend_hook():
+    hook = '.git/hooks/pre-push'
+    if not os.path.exists(hook):
+        print('Creating hook file:', hook)
+        cmd_chk(['./rsync', '-a', 'packaging/pre-push', hook])
+    else:
+        out, rc = cmd_txt_status(['fgrep', 'make gensend', hook], discard='output')
+        if rc:
+            die('Please add a "make gensend" into your', hook, 'script.')
+
+
 # Snag the GENFILES values out of the Makefile.in file and return them as a list.
 def get_extra_files():
     cont_re = re.compile(r'\\\n')
diff --git a/packaging/pre-push b/packaging/pre-push
new file mode 100755 (executable)
index 0000000..04b0d20
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+cat >/dev/null # Just discard stdin data
+make gensend
index 611d77a32fbb9ae248a0311647742cab03878dac..e84a2830687669e2e7de26e7200e0e027a14e43f 100755 (executable)
@@ -15,11 +15,6 @@ from pkglib import *
 
 dest = os.environ['HOME'] + '/samba-rsync-ftp'
 ORIGINAL_PATH = os.environ['PATH']
-MAKE_GEN_CMDS = [
-        'make -f prepare-source.mak conf'.split(),
-        './config.status'.split(),
-        'make gen'.split(),
-        ]
 
 def main():
     now = datetime.now()
@@ -28,6 +23,8 @@ def main():
     ztoday = now.strftime('%d %b %Y')
     today = ztoday.lstrip('0')
 
+    mandate_gensend_hook()
+
     curdir = os.getcwd()
 
     signal.signal(signal.SIGINT, signal_handler)
@@ -157,7 +154,6 @@ About to:
     - tweak the version in configure.ac and the spec files
     - tweak NEWS.md and OLDNEWS.md to ensure header values are correct
     - generate configure.sh, config.h.in, and proto.h
-    - touch the latest-year.h file and generate the manpages
     - page through the differences
 """)
     ans = input("<Press Enter to continue> ")
@@ -213,9 +209,6 @@ About to:
                 fh.write(txt)
 
     cmd_chk(['packaging/year-tweak'])
-    cmd_chk([touch, 'latest-year.h']) # This file's date is put in the generated manpages.
-    cmd_chk(['make', 'reconfigure'])
-    cmd_chk(['make', 'man'])
 
     print(dash_line)
     cmd_run("git diff --color | less -p '^diff .*'")
@@ -233,7 +226,8 @@ About to:
 {dash_line}
 
 About to:
-    - commit all version changes
+    - git commit all changes
+    - generate the manpages
     - merge the {args.master_branch} branch into the patch/{args.master_branch}/* branches
     - update the files in the "patches" dir and OPTIONALLY
       (if you type 'y') to launch a shell for each patch
@@ -244,6 +238,9 @@ About to:
     if s.returncode:
         die('Aborting')
 
+    cmd_chk(['make', 'reconfigure'])
+    cmd_chk(['make', 'gen'])
+
     print(f'Creating any missing patch branches.')
     s = cmd_run(f'packaging/branch-from-patch --branch={args.master_branch} --add-missing')
     if s.returncode:
@@ -301,8 +298,6 @@ About to:
     os.rename(rsync_lastver, 'a')
 
     print(f"Creating {diff_file} ...")
-    for cmd in MAKE_GEN_CMDS:
-        cmd_chk(cmd)
     cmd_chk(['rsync', '-a', *extra_files, 'b/'])
 
     sed_script = r's:^((---|\+\+\+) [ab]/[^\t]+)\t.*:\1:' # CAUTION: must not contain any single quotes!