]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/queue.py
Merge remote-tracking branch 'ansgar/package-set' into merge
[dak.git] / daklib / queue.py
index 74070c2fd1ca2887ee7ef8af3ffe65893b17b0bf..26bacf57fbdd9ef0121f9eda6339cc44928f4a53 100755 (executable)
@@ -102,7 +102,7 @@ def get_type(f, session):
 
 # Determine what parts in a .changes are NEW
 
-def determine_new(filename, changes, files, warn=1, session = None, dsc = None):
+def determine_new(filename, changes, files, warn=1, session = None, dsc = None, new = None):
     """
     Determine what parts in a C{changes} file are NEW.
 
@@ -121,14 +121,18 @@ def determine_new(filename, changes, files, warn=1, session = None, dsc = None):
     @type dsc: Upload.Pkg.dsc dict
     @param dsc: (optional); Dsc dictionary
 
+    @type new: dict
+    @param new: new packages as returned by a previous call to this function, but override information may have changed
+
     @rtype: dict
     @return: dictionary of NEW components.
 
     """
     # TODO: This should all use the database instead of parsing the changes
     # file again
-    new = {}
     byhand = {}
+    if new is None:
+        new = {}
 
     dbchg = get_dbchange(filename, session)
     if dbchg is None:
@@ -136,7 +140,9 @@ def determine_new(filename, changes, files, warn=1, session = None, dsc = None):
 
     # Try to get the Package-Set field from an included .dsc file (if possible).
     if dsc:
-        new = build_package_set(dsc, session)
+        for package, entry in build_package_set(dsc, session).items():
+            if not new.has_key(package):
+                new[package] = entry
 
     # Build up a list of potentially new things
     for name, f in files.items():
@@ -2068,6 +2074,7 @@ distribution."""
         print "Installing."
         self.logger.log(["installing changes", self.pkg.changes_file])
 
+        binaries = []
         poolfiles = []
 
         # Add the .dsc file to the DB first
@@ -2080,7 +2087,9 @@ distribution."""
         # Add .deb / .udeb files to the DB (type is always deb, dbtype is udeb/deb)
         for newfile, entry in self.pkg.files.items():
             if entry["type"] == "deb":
-                poolfiles.append(add_deb_to_db(self, newfile, session))
+                b, pf = add_deb_to_db(self, newfile, session)
+                binaries.append(b)
+                poolfiles.append(pf)
 
         # If this is a sourceful diff only upload that is moving
         # cross-component we need to copy the .orig files into the new
@@ -2165,6 +2174,18 @@ distribution."""
         # Our SQL session will automatically start a new transaction after
         # the last commit
 
+        # Now ensure that the metadata has been added
+        # This has to be done after we copy the files into the pool
+        # For source if we have it:
+        if self.pkg.changes["architecture"].has_key("source"):
+            import_metadata_into_db(source, session)
+
+        # Now for any of our binaries
+        for b in binaries:
+            import_metadata_into_db(b, session)
+
+        session.commit()
+
         # Move the .changes into the 'done' directory
         utils.move(self.pkg.changes_file,
                    os.path.join(cnf["Dir::Queue::Done"], os.path.basename(self.pkg.changes_file)))