[diffoscope] 01/01: Avoid walking through packages twice when comparing two .changes (Closes: #843531)

Chris Lamb chris at chris-lamb.co.uk
Fri Dec 23 11:03:25 CET 2016


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

lamby pushed a commit to branch lamby/843531-avoid-walking-through-packages-twice
in repository diffoscope.

commit d2f6b4dab794dbd3e966608eaffa77f3fe43ab9b
Author: Chris Lamb <lamby at debian.org>
Date:   Wed Dec 21 23:06:48 2016 +0000

    Avoid walking through packages twice when comparing two .changes (Closes: #843531)
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/debian.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/diffoscope/comparators/debian.py b/diffoscope/comparators/debian.py
index fa02064..11dcb40 100644
--- a/diffoscope/comparators/debian.py
+++ b/diffoscope/comparators/debian.py
@@ -181,8 +181,21 @@ class DotDscFile(DebControlFile):
             file._deb822 = dsc
         return True
 
+class DotBuildinfoContainer(DebControlContainer):
+    def get_member_names(self):
+        member_names = super(DotBuildinfoContainer, self).get_member_names()
+
+        # Avoid recursing twice when a .buildinfo references a member that is
+        # duplicated in a that member's parent .changes file (eg. .changes →
+        # foo.deb and .changes → .buildinfo → foo.deb).
+        skip = set()
+        if isinstance(self.source.container, DebControlContainer):
+            skip.update(self.source.container.get_member_names())
+
+        return [x for x in member_names if x not in skip]
 
 class DotBuildinfoFile(DebControlFile):
+    CONTAINER_CLASS = DotBuildinfoContainer
     RE_FILE_EXTENSION = re.compile(r'\.buildinfo$')
 
     @staticmethod

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


More information about the diffoscope mailing list