]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
More patch-update improvements; configure.ac tweak; Makefile tweaks.
authorWayne Davison <wayne@opencoder.net>
Tue, 30 Jun 2020 02:46:45 +0000 (19:46 -0700)
committerWayne Davison <wayne@opencoder.net>
Tue, 30 Jun 2020 02:53:05 +0000 (19:53 -0700)
Makefile.in
configure.ac
packaging/auto-Makefile
packaging/patch-update

index 725ee4205715f0c40b1ef3833be81a5e9bef43e7..f5c788db9ae840c69d6adae3ee5fbf8f7e6a69a2 100644 (file)
@@ -1,4 +1,4 @@
-# The input file that configure uses to create the Makefile for rsync.
+# The Makefile for rsync (configure creates it from Makefile.in).
 
 prefix=@prefix@
 datarootdir=@datarootdir@
index 3676a716ffb3f34cfc8ef06c48189c8b4efbce8d..112367cb6cfe6c32c157d8a2d6606e1e33b64fff 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT([rsync],[],[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])
index 8c61e2408a0c51cbbd21269b1b4db26875525c44..097a5d8730f3560a7bd77749b88e0caefeceaca9 100644 (file)
@@ -1,8 +1,11 @@
 TARGETS := all install install-ssl-daemon install-all install-strip conf gen gensend reconfigure restatus \
        proto man clean cleantests distclean test check check29 check30 installcheck splint doxygen doxygen-upload
 
-.PHONY: $(TARGETS)
+.PHONY: $(TARGETS) auto-prep
 
-$(TARGETS):
+auto-prep:
        @if test x`packaging/prep-auto-dir` = x; then echo "auto-build-save is not setup"; exit 1; fi
+       @echo 'Build branch: '`readlink build/.branch | tr % /`
+
+$(TARGETS): auto-prep
        make -C build $@
index 34530fcd0f9717a6ad81f3eb7f049c03d6d1f36c..a387ad72107a258b7bf8297a57e3cc73df82130d 100755 (executable)
@@ -127,25 +127,20 @@ def update_patch(patch):
 
     s = cmd_run(['git', 'merge', based_on])
     ok = s.returncode == 0
-    if not ok or args.shell:
+    if not ok or args.cmd or args.shell:
         cmd_chk(['packaging/prep-auto-dir'], discard='output')
-        m = re.search(r'([^/]+)$', parent)
-        parent_dir = m[1]
-        if not ok:
-            print(f'"git merge {based_on}" incomplete -- please fix.')
-        os.environ['PS1'] = f"[{parent_dir}] {patch}: "
-        while True:
-            s = cmd_run([os.environ.get('SHELL', '/bin/sh')])
-            if s.returncode != 0:
-                ans = input("Abort? [n/y] ")
-                if re.match(r'^y', ans, flags=re.I):
-                    return 0
-                continue
-            cur_branch, is_clean, status_txt = check_git_status(0)
-            if is_clean:
-                break
-            print(status_txt, end='')
-        cmd_run('rm -f build/*.o build/*/*.o')
+    if not ok:
+        print(f'"git merge {based_on}" incomplete -- please fix.')
+        if not run_a_shell(parent, patch):
+            return 0
+    if args.cmd:
+        if cmd_run(args.cmd).returncode != 0:
+            if not run_a_shell(parent, patch):
+                return 0
+            ok = False
+    if ok and args.shell:
+        if not run_a_shell(parent, patch):
+            return 0
 
     with open(f"{args.patches_dir}/{patch}.diff", 'w', encoding='utf-8') as fh:
         fh.write(description[patch])
@@ -193,17 +188,38 @@ def update_patch(patch):
                 line =  plus_re.sub(r'+++ b/\1', line)
                 fh.write(line)
             proc.communicate()
-            for fn in gen_files:
-                os.unlink(fn)
 
     return 1
 
 
+def run_a_shell(parent, patch):
+    m = re.search(r'([^/]+)$', parent)
+    parent_dir = m[1]
+    os.environ['PS1'] = f"[{parent_dir}] {patch}: "
+
+    while True:
+        s = cmd_run([os.environ.get('SHELL', '/bin/sh')])
+        if s.returncode != 0:
+            ans = input("Abort? [n/y] ")
+            if re.match(r'^y', ans, flags=re.I):
+                return False
+            continue
+        cur_branch, is_clean, status_txt = check_git_status(0)
+        if is_clean:
+            break
+        print(status_txt, end='')
+
+    cmd_run('rm -f build/*.o build/*/*.o')
+
+    return True
+
+
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description="Turn a git branch back into a diff files in the patches dir.", add_help=False)
     parser.add_argument('--branch', '-b', dest='base_branch', metavar='BASE_BRANCH', default='master', help="The branch the patch is based on. Default: master.")
     parser.add_argument('--skip-check', action='store_true', help="Skip the check that ensures starting with a clean branch.")
     parser.add_argument('--shell', '-s', action='store_true', help="Launch a shell for every patch/BASE/* branch updated, not just when a conflict occurs.")
+    parser.add_argument('--cmd', '-c', help="Run a command in every patch branch.")
     parser.add_argument('--gen', metavar='DIR', nargs='?', const='', help='Include generated files. Optional DIR value overrides the default of using the "patches" dir.')
     parser.add_argument('--patches-dir', '-p', metavar='DIR', default='patches', help="Override the location of the rsync-patches dir. Default: patches.")
     parser.add_argument('patch_files', metavar='patches/DIFF_FILE', nargs='*', help="Specify what patch diff files to process. Default: all of them.")