]> git.decadent.org.uk Git - dak.git/commitdiff
Add debug binary diverting for archive install
authorPaul Tagliamonte <tag@pault.ag>
Sat, 15 Aug 2015 16:43:46 +0000 (18:43 +0200)
committerPaul Tagliamonte <tag@pault.ag>
Sat, 15 Aug 2015 18:42:36 +0000 (20:42 +0200)
For any debug packages, redirect binary packages to the binary debug
suite if set, otherwise install as normal.

daklib/archive.py
daklib/checks.py
daklib/upload.py

index b77bfa0bc076c1a2bfe80f566763736040783217..fa67f10e2f2ff64f69cf48e0e7257a8af6a8b019 100644 (file)
@@ -1025,14 +1025,33 @@ class ArchiveUpload(object):
         source = self.changes.source
         if source is not None:
             component = source_component_func(source)
-            db_source = self.transaction.install_source(self.directory, source, suite, component, changed_by, fingerprint=self.fingerprint)
+            db_source = self.transaction.install_source(
+                self.directory,
+                source,
+                suite,
+                component,
+                changed_by,
+                fingerprint=self.fingerprint
+            )
         else:
             db_source = None
 
         db_binaries = []
         for binary in self.changes.binaries:
+            copy_to_suite = suite
+            if binary.is_debug() and suite.debug_suite is not None:
+                copy_to_suite = suite.debug_suite
+
             component = binary_component_func(binary)
-            db_binary = self.transaction.install_binary(self.directory, binary, suite, component, fingerprint=self.fingerprint, source_suites=source_suites, extra_source_archives=extra_source_archives)
+            db_binary = self.transaction.install_binary(
+                self.directory,
+                binary,
+                copy_to_suite,
+                component,
+                fingerprint=self.fingerprint,
+                source_suites=source_suites,
+                extra_source_archives=extra_source_archives
+            )
             db_binaries.append(db_binary)
 
         if suite.copychanges:
index 48251adb3eab3a5075f96c8d5f652933f8ae38e2..86040268ac7d3bc0d5ac458cd84952621ffda40a 100644 (file)
@@ -297,7 +297,7 @@ class BinaryCheck(Check):
                         for binary in upload.changes.binaries}
 
         for name, binary in binaries.items():
-            if binary.control['Section'] == debug_deb_section:
+            if binary.section == debug_deb_section:
                 # If we have a Binary package in the Debug section, we
                 # can allow it to not be present in the Binary field
                 # in the .changes file, so long as its name (without
index b78d100fe55c5e59d48f03338a9ec11a9a0edff9..8b2aabf038212bc6019287e00c8d9c7a6c99783e 100644 (file)
@@ -462,6 +462,9 @@ class Binary(object):
         @type: dict-like
         """
 
+    def is_debug(self):
+        return self.section == "debug"
+
     @classmethod
     def from_file(cls, directory, filename):
         hashed_file = HashedFile.from_file(directory, filename)
@@ -497,6 +500,13 @@ class Binary(object):
             raise InvalidBinaryException('{0}: Does not match re_file_binary'.format(self.hashed_file.filename))
         return match.group('type')
 
+    @property
+    def section(self):
+        """section name
+        @type: str
+        """
+        return self.control['Section'].split('/', 1)[-1]
+
     @property
     def component(self):
         """component name