[packages/rpm-build-tools] Generate diffstat for each patch, so it's easier to compare if rediff is not broken.

arekm arekm at pld-linux.org
Wed Feb 24 13:22:30 CET 2021


commit 0f726ca6ea1344f9c7b00bd3b9f1de5f0df83356
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Feb 24 13:13:34 2021 +0100

    Generate diffstat for each patch, so it's easier to compare if rediff is not broken.

 rediff-patches.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/rediff-patches.py b/rediff-patches.py
index ca7a0a8..caac7d1 100755
--- a/rediff-patches.py
+++ b/rediff-patches.py
@@ -58,6 +58,17 @@ def diff(diffdir_org, diffdir, builddir, output):
                 raise
     logging.info("rediff generated as %s" % output)
 
+def diffstat(patch):
+    cmd = [ 'diffstat', patch ]
+    logging.info("running diffstat for: %s" % patch)
+    try:
+        subprocess.check_call(cmd, stdout=sys.stdout, stderr=sys.stderr,
+                              env={'LC_ALL': 'C.UTF-8'}, timeout=60)
+    except subprocess.CalledProcessError as err:
+        logging.error("running diffstat failed: %s" % err)
+    except FileNotFoundError as err:
+        logging.error("running diffstat failed: %s, install diffstat package?" % err)
+
 def main():
     parser = parser = argparse.ArgumentParser(description='rediff patches to avoid fuzzy hunks')
     parser.add_argument('spec', type=str, help='spec file name')
@@ -121,6 +132,9 @@ def main():
 
         diff(appbuilddir + ".org", appbuilddir, builddir, os.path.join(topdir, os.path.join(appsourcedir, patch_name + ".rediff")))
 
+        diffstat(os.path.join(topdir, os.path.join(appsourcedir, patch_name)))
+        diffstat(os.path.join(topdir, os.path.join(appsourcedir, patch_name + ".rediff")))
+
         shutil.rmtree(builddir)
     tempdir.cleanup()
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/cf8affe1576cb9dc3e8ac0561a51c4e88c7b0b85



More information about the pld-cvs-commit mailing list