[Reproducible-commits] [debbindiff] 01/01: Don't check signatures of rpm files and use temp dir for rpmdb

Reiner Herrmann deki-guest at moszumanska.debian.org
Fri Feb 6 19:38:03 UTC 2015


This is an automated email from the git hooks/post-receive script.

deki-guest pushed a commit to branch master
in repository debbindiff.

commit db448885cb1181d02a94886691c4662f5de36a1c
Author: Reiner Herrmann <reiner at reiner-h.de>
Date:   Fri Feb 6 20:33:16 2015 +0100

    Don't check signatures of rpm files and use temp dir for rpmdb
---
 debbindiff/comparators/cpio.py |  2 +-
 debbindiff/comparators/rpm.py  | 23 +++++++++++++++--------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/debbindiff/comparators/cpio.py b/debbindiff/comparators/cpio.py
index 731015d..b84c8b6 100644
--- a/debbindiff/comparators/cpio.py
+++ b/debbindiff/comparators/cpio.py
@@ -33,7 +33,7 @@ def get_cpio_content(path, verbose=False):
 
 
 def extract_cpio_archive(path, destdir):
-    cmd = ['cpio', '--no-absolute-filenames', '--quiet', '-iF',
+    cmd = ['cpio', '--no-absolute-filenames', '--quiet', '-idF',
             os.path.abspath(path)]
     logger.debug("extracting %s into %s", path, destdir)
     p = subprocess.Popen(cmd, shell=False, cwd=destdir)
diff --git a/debbindiff/comparators/rpm.py b/debbindiff/comparators/rpm.py
index 3a22b50..cec044e 100644
--- a/debbindiff/comparators/rpm.py
+++ b/debbindiff/comparators/rpm.py
@@ -30,7 +30,11 @@ from debbindiff.difference import Difference, get_source
 def get_rpm_header(path, ts):
     header = ''
     with open(path, 'r') as f:
-        hdr = ts.hdrFromFdno(f)
+        try:
+            hdr = ts.hdrFromFdno(f)
+        except rpm.error, e:
+            logger.error("reading rpm header failed: %s", str(e))
+            return str(e)
         for rpmtag in sorted(rpm.tagnames):
             if rpmtag not in hdr:
                 continue
@@ -64,13 +68,16 @@ def compare_rpm_files(path1, path2, source=None):
     differences = []
 
     # compare headers
-    ts = rpm.TransactionSet()
-    header1 = get_rpm_header(path1, ts)
-    header2 = get_rpm_header(path2, ts)
-    if header1 != header2:
-        differences.append(Difference(
-            header1.splitlines(1), header2.splitlines(2),
-            path1, path2, source="header"))
+    with make_temp_directory() as rpmdb_dir:
+        rpm.addMacro("_dbpath", rpmdb_dir)
+        ts = rpm.TransactionSet()
+        ts.setVSFlags(-1)
+        header1 = get_rpm_header(path1, ts)
+        header2 = get_rpm_header(path2, ts)
+        if header1 != header2:
+            differences.append(Difference(
+                header1.splitlines(1), header2.splitlines(2),
+                path1, path2, source="header"))
 
     # extract cpio archive
     with extract_rpm_payload(path1) as archive1:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debbindiff.git



More information about the Reproducible-commits mailing list