Hi Mattia,

> diffoscope: walks through packages twice when comparing two .changes

Could you try the attached patch?

  commit 55240ad42188c963dde092ba1b090f95bb8cf83c
  Author: Chris Lamb <la...@debian.org>
  Date:   Wed Dec 21 23:00:56 2016 +0000
  
      Avoid walking through packages twice when comparing two .changes (Closes: 
#843531)
      
      Signed-off-by: Chris Lamb <la...@debian.org>
  
   diffoscope/comparators/debian.py | 7 +++++++
   1 file changed, 7 insertions(+)


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
>From 55240ad42188c963dde092ba1b090f95bb8cf83c Mon Sep 17 00:00:00 2001
From: Chris Lamb <la...@debian.org>
Date: Wed, 21 Dec 2016 23:00:56 +0000
Subject: [PATCH] Avoid walking through packages twice when comparing two
 .changes (Closes: #843531)

Signed-off-by: Chris Lamb <la...@debian.org>
---
 diffoscope/comparators/debian.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/diffoscope/comparators/debian.py b/diffoscope/comparators/debian.py
index fa02064..337a3dd 100644
--- a/diffoscope/comparators/debian.py
+++ b/diffoscope/comparators/debian.py
@@ -181,8 +181,15 @@ class DotDscFile(DebControlFile):
             file._deb822 = dsc
         return True
 
+class DotBuildinfoContainer(DebControlContainer):
+    def get_member_names(self):
+        field = self.source.deb822.get('Files') or self.source.deb822.get('Checksums-Sha256')
+        # If path exists in parent, don't recurse
+        parent_fields = self.source.container.get_member_names()
+        return [d['name'] for d in field if d['name'] not in parent_fields]
 
 class DotBuildinfoFile(DebControlFile):
+    CONTAINER_CLASS = DotBuildinfoContainer
     RE_FILE_EXTENSION = re.compile(r'\.buildinfo$')
 
     @staticmethod
-- 
2.11.0

Reply via email to