[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] Add debug binary diverting for archive install



For any debug packages, redirect binary packages to the binary debug
suite if set, otherwise install as normal.
---
 daklib/archive.py | 23 +++++++++++++++++++++--
 daklib/checks.py  |  2 +-
 daklib/upload.py  | 10 ++++++++++
 3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/daklib/archive.py b/daklib/archive.py
index b77bfa0..fa67f10 100644
--- a/daklib/archive.py
+++ b/daklib/archive.py
@@ -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:
diff --git a/daklib/checks.py b/daklib/checks.py
index 48251ad..8604026 100644
--- a/daklib/checks.py
+++ b/daklib/checks.py
@@ -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
diff --git a/daklib/upload.py b/daklib/upload.py
index b78d100..8b2aabf 100644
--- a/daklib/upload.py
+++ b/daklib/upload.py
@@ -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)
@@ -498,6 +501,13 @@ class Binary(object):
         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
         @type: str
-- 
2.1.4



Reply to: