]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/archive.py
daklib/archive.py: add warning explaining why a package is NEW
[dak.git] / daklib / archive.py
index c2cc8392777ce9750e501b6a6e01bb308f301f4a..dd4a22ca3c376a6a890ad344e87823e13ea108ac 100644 (file)
@@ -699,7 +699,7 @@ class ArchiveUpload(object):
                 if src == suite_name:
                     suite_name = dst
                     if rtype != "silent-map":
-                        self.warnings.append('Mapping {0} to {0}.'.format(src, dst))
+                        self.warnings.append('Mapping {0} to {1}.'.format(src, dst))
             elif rtype == "ignore":
                 ignored = fields[1]
                 if suite_name == ignored:
@@ -740,17 +740,20 @@ class ArchiveUpload(object):
         @return: C{True} if the upload is NEW, C{False} otherwise
         """
         session = self.session
+        new = False
 
         # Check for missing overrides
         for b in self.changes.binaries:
             override = self._binary_override(suite, b)
             if override is None:
-                return True
+                self.warnings.append('binary:{0} is NEW.'.format(b.control['Package']))
+                new = True
 
         if self.changes.source is not None:
             override = self._source_override(suite, self.changes.source)
             if override is None:
-                return True
+                self.warnings.append('source:{0} is NEW.'.format(self.changes.source.control['Source']))
+                new = True
 
         # Check if we reference a file only in a tainted archive
         files = self.changes.files.values()
@@ -764,7 +767,10 @@ class ArchiveUpload(object):
             in_untainted_archive = (query_untainted.first() is not None)
 
             if in_archive and not in_untainted_archive:
-                return True
+                self.warnings.append('{0} is only available in NEW.'.format(f.filename))
+                new = True
+
+        return new
 
     def _final_suites(self):
         session = self.session
@@ -1054,7 +1060,7 @@ class ArchiveUpload(object):
                 remaining.append(f)
                 continue
 
-            if rule['Source'] != control['Source'] or rule['Section'] != f.section or rule['Extension'] != ext:
+            if rule['Source'] != self.changes.source_name or rule['Section'] != f.section or rule['Extension'] != ext:
                 remaining.append(f)
                 continue
 
@@ -1151,7 +1157,14 @@ class ArchiveUpload(object):
             if policy_queue is not None:
                 redirected_suite = policy_queue.suite
 
-            source_suites = self.session.query(Suite).filter(Suite.suite_id.in_([suite.suite_id, redirected_suite.suite_id])).subquery()
+            # source can be in the suite we install to or any suite we enhance
+            source_suite_ids = set([suite.suite_id, redirected_suite.suite_id])
+            for enhanced_suite_id, in self.session.query(VersionCheck.reference_id) \
+                    .filter(VersionCheck.suite_id.in_(source_suite_ids)) \
+                    .filter(VersionCheck.check == 'Enhances'):
+                source_suite_ids.add(enhanced_suite_id)
+
+            source_suites = self.session.query(Suite).filter(Suite.suite_id.in_(source_suite_ids)).subquery()
 
             source_component_func = lambda source: self._source_override(overridesuite, source).component
             binary_component_func = lambda binary: self._binary_component(overridesuite, binary)