Comment 3 for bug 1537705

Revision history for this message
Alexander Sack (asac) wrote :

seems we dont close the apt cache and autotools accumulates quite some packagers in new list...

made patch that closes cache and that also makes sure we dont process duplicates (which speeds building the testcase up quitea lot)...

diff --git a/snapcraft/repo.py b/snapcraft/repo.py
index ea1e443..1af7903 100644
--- a/snapcraft/repo.py
+++ b/snapcraft/repo.py
@@ -58,11 +58,16 @@ _GEOIP_SERVER = "http://geoip.ubuntu.com/lookup"

 def install_build_packages(packages):
+ seen = set()
+ seen_add = seen.add
+ unique_packages = [ x for x in packages if not (x in seen or seen_add(x))]
     new_packages = []
- for pkg in packages:
+ for pkg in unique_packages:
         try:
- if not apt.Cache()[pkg].installed:
+ aptc = apt.Cache()
+ if not aptc[pkg].installed:
                 new_packages.append(pkg)
+ aptc.close()
         except KeyError:
             logger.error('Could not find all the "build-packages" required '
                          'in snapcraft.yaml')