[diffoscope] 01/01: Show line ordering variation in deb md5sums

Reiner Herrmann reiner at reiner-h.de
Tue Feb 23 00:24:37 CET 2016

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

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

commit 48059dbec0f8f775c00eaf8583a4879c07969e77
Author: Reiner Herrmann <reiner at reiner-h.de>
Date:   Tue Feb 23 00:08:55 2016 +0100

    Show line ordering variation in deb md5sums
    When a md5sum file differs, diffoscope was only showing the comment
    that files inside the package differ.
    But it can also be that all remaining files are reproducible, and
    only the line ordering inside the md5sums file varies.
    If the line order varies, it will now also be shown.
 diffoscope/comparators/deb.py | 13 ++++++++++---
 tests/comparators/test_deb.py |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/diffoscope/comparators/deb.py b/diffoscope/comparators/deb.py
index 1045474..923c94e 100644
--- a/diffoscope/comparators/deb.py
+++ b/diffoscope/comparators/deb.py
@@ -117,9 +117,16 @@ class Md5sumsFile(File):
             logger.debug('Malformed md5sums, ignoring.')
             return {}
-    def compare(self, other, source=None):
-        return Difference(None, self.path, other.path, source='md5sums',
-                          comment="Files in package differs")
+    def strip_checksum(self, path):
+        with open(path) as f:
+            for line in f:
+                yield " ".join(line.split(" ")[2:])
+    def compare_details(self, other, source=None):
+        return [Difference(None, self.path, other.path, source="md5sums", comment="Files in package differ"),
+                Difference.from_text_readers(self.strip_checksum(self.path), self.strip_checksum(other.path),
+                                             self.path, other.path, source="line order")]
 class DebTarContainer(TarContainer):
diff --git a/tests/comparators/test_deb.py b/tests/comparators/test_deb.py
index f2c5c5d..fc57b69 100644
--- a/tests/comparators/test_deb.py
+++ b/tests/comparators/test_deb.py
@@ -76,7 +76,7 @@ def test_identification_of_md5sums_in_deb(deb1, deb2, monkeypatch):
     assert test_identification_of_md5sums_in_deb.found
 def test_md5sums(differences):
-    assert differences[1].details[0].details[1].comment == 'Files in package differs'
+    assert differences[1].details[0].details[1].details[0].comment == 'Files in package differ'
 def test_identical_files_in_md5sums(deb1, deb2):
     for name in ['./usr/share/doc/test/README.Debian', './usr/share/doc/test/copyright']:

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

More information about the diffoscope mailing list