Permalink
Browse files

Don't fail if a suite has no base suite

  • Loading branch information...
1 parent bcece06 commit 224f6e1afaa463b61033a3e31bb32dae0231f566 @ximion committed Feb 11, 2017
Showing with 11 additions and 11 deletions.
  1. +11 −11 src/asgen/engine.d
View
@@ -183,17 +183,17 @@ public:
// get contents information for packages and add them to the database
auto interestingFound = false;
- // First get the contents (only) of all packages in the base suite.
- logInfo ("Scanning new packages for base suite %s/%s [%s]", suite.baseSuite, section, arch);
- auto baseSuitePkgs = pkgIndex.packagesFor (suite.baseSuite, section, arch);
- foreach (ref pkg; parallel (baseSuitePkgs, 8)) {
- immutable pkid = pkg.id;
-
- string[] contents;
- if (!cstore.packageExists (pkid)) {
- contents = pkg.contents;
- cstore.addContents (pkid, contents);
- logInfo ("Scanned %s for base suite.", pkid);
+ // First get the contents (only) of all packages in the base suite
+ if (!suite.baseSuite.empty) {
+ logInfo ("Scanning new packages for base suite %s/%s [%s]", suite.baseSuite, section, arch);
+ auto baseSuitePkgs = pkgIndex.packagesFor (suite.baseSuite, section, arch);
+ foreach (ref pkg; parallel (baseSuitePkgs, 8)) {
+ immutable pkid = pkg.id;
+
+ if (!cstore.packageExists (pkid)) {
+ cstore.addContents (pkid, pkg.contents);
+ logInfo ("Scanned %s for base suite.", pkid);
+ }
}
}

4 comments on commit 224f6e1

Collaborator

iainlane replied Feb 13, 2017

Ah wtf, look at this commit I have locally on the branch:

commit 1921afa139aa8459d70d51966e010f1093329701
Author: Iain Lane <iain.lane@canonical.com>
Date:   Wed Feb 1 17:54:07 2017 +0000

    engine: Process base suite packages for contents only
    
    We don't need to do any further processing of base suite packages -
    they're only needed to find icons, and we get that from their contents
    alone.
    
    This should stop base suite packages being scanned every time.
    
    If a base suite is later a real suite then everything should continue to
    work.
    
    Fixes #33.

diff --git a/src/asgen/engine.d b/src/asgen/engine.d
index c5ccf93..16abca7 100644
--- a/src/asgen/engine.d
+++ b/src/asgen/engine.d
@@ -182,9 +182,26 @@ public:
 
         // get contents information for packages and add them to the database
         auto interestingFound = false;
+
+        if (!suite.baseSuite.empty) {
+            // First get the contents (only) of all packages in the base suite.
+            logInfo ("Scanning new packages for base suite %s/%s [%s]", suite.baseSuite, section, arch);
+            auto baseSuitePkgs = pkgIndex.packagesFor (suite.baseSuite, section, arch);
+            foreach (ref pkg; parallel (baseSuitePkgs, 8)) {
+                immutable pkid = pkg.id;
+
+                string[] contents;
+                if (!cstore.packageExists (pkid)) {
+                    contents = pkg.contents;
+                    cstore.addContents (pkid, contents);
+                    logInfo ("Scanned %s for base suite.", pkid);
+                }
+            }
+        }
+
+        // And then scan the suite itself - here packages can be 'interesting'
+        // in that they might end up in the output.
         auto pkgs = pkgIndex.packagesFor (suite.name, section, arch);
-        if (!suite.baseSuite.empty)
-            pkgs ~= pkgIndex.packagesFor (suite.baseSuite, section, arch);
         foreach (ref pkg; parallel (pkgs, 8)) {
             immutable pkid = pkg.id;

I guess that I forgot to push this before merging the branch :(

Thanks for fixing! Actually it doesn't affect Ubuntu as I generated the config so that all suites have base suites.

Owner

ximion replied Feb 14, 2017

Ah, that explains it! I was doubting myself because I would have sworn that the line was there when I reviewed the patch :D

Thanks for fixing! Actually it doesn't affect Ubuntu as I generated the config so that all suites have base suites.

How does that work? Which base suite does the zesty suite have?

Collaborator

iainlane replied Feb 14, 2017

Owner

ximion replied Feb 14, 2017

Jup, that is indeed fine - weird, but fine ^^

I wonder if processing in one go is faster... But given the general slowness of the extraction process, I assume the cost of creating and trashing a few threads is negligible (the rest of the data should have been cached and be reused)

Please sign in to comment.