[diffoscope] 01/01: Avoid unpacking packages twice when comparing .changes. (Closes: #843531)
Chris Lamb
chris at chris-lamb.co.uk
Fri Dec 23 12:32:15 CET 2016
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository diffoscope.
commit f47459f77698079a3f013864e49f256f365a3fa2
Author: Chris Lamb <lamby at debian.org>
Date: Wed Dec 21 23:06:48 2016 +0000
Avoid unpacking packages twice when comparing .changes. (Closes: #843531)
If the parent container of this .buildinfo is a changes file, we should ignore
members that are referenced in both. This avoids recursing into files twice
where a .buildinfo references a file that is also listed in that member's
parent .changes file:
foo.changes → foo.deb
foo.changes → foo.buildinfo → foo.deb
Signed-off-by: Chris Lamb <lamby at debian.org>
---
diffoscope/comparators/debian.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/diffoscope/comparators/debian.py b/diffoscope/comparators/debian.py
index fa02064..188882d 100644
--- a/diffoscope/comparators/debian.py
+++ b/diffoscope/comparators/debian.py
@@ -181,8 +181,26 @@ class DotDscFile(DebControlFile):
file._deb822 = dsc
return True
+class DotBuildinfoContainer(DebControlContainer):
+ def get_member_names(self):
+ result = super(DotBuildinfoContainer, self).get_member_names()
+
+ # As a special-case, if the parent container of this .buildinfo is a
+ # .changes file, ignore members here that are referenced in both. This
+ # avoids recursing into files twice where a .buildinfo references a
+ # file that is also listed in that member's parent .changes file:
+ #
+ # foo.changes → foo.deb
+ # foo.changes → foo.buildinfo → foo.deb
+ #
+ ignore = set()
+ if isinstance(self.source.container, DebControlContainer):
+ ignore.update(self.source.container.get_member_names())
+
+ return [x for x in result if x not in ignore]
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