From 64d9673cf98a8adb330f5de673c471d55999457c Mon Sep 17 00:00:00 2001 From: Paul Tagliamonte Date: Sat, 15 Aug 2015 18:43:46 +0200 Subject: [PATCH] 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 b77bfa0b..fa67f10e 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 48251adb..86040268 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 b78d100f..8b2aabf0 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) @@ -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 -- 2.39.2