From 283a1be8a19c9f89987dd96ec6247217973ac5a7 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Sun, 16 Aug 2015 20:33:13 +0200 Subject: [PATCH] There should only be one place to check for a debug package --- dak/process_policy.py | 3 ++- daklib/archive.py | 2 +- daklib/upload.py | 10 ---------- daklib/utils.py | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/dak/process_policy.py b/dak/process_policy.py index 4b3d97dc..7b6b9645 100755 --- a/dak/process_policy.py +++ b/dak/process_policy.py @@ -49,6 +49,7 @@ from daklib.urgencylog import UrgencyLog from daklib.packagelist import PackageList import daklib.announce +import daklib.utils # Globals Options = None @@ -142,7 +143,7 @@ def comment_accept(upload, srcqueue, comments, transaction): return get_mapped_component(component_name, session=session) def is_debug_binary(db_binary): - return db_binary.proxy['Section'] == "debug" + return daklib.utils.is_in_debug_section(db_binary.proxy) def has_debug_binaries(upload): return any((is_debug_binary(x) for x in upload.binaries)) diff --git a/daklib/archive.py b/daklib/archive.py index fa67f10e..e3bf9126 100644 --- a/daklib/archive.py +++ b/daklib/archive.py @@ -1039,7 +1039,7 @@ class ArchiveUpload(object): db_binaries = [] for binary in self.changes.binaries: copy_to_suite = suite - if binary.is_debug() and suite.debug_suite is not None: + if utils.is_in_debug_section(binary.control) and suite.debug_suite is not None: copy_to_suite = suite.debug_suite component = binary_component_func(binary) diff --git a/daklib/upload.py b/daklib/upload.py index 8b2aabf0..b78d100f 100644 --- a/daklib/upload.py +++ b/daklib/upload.py @@ -462,9 +462,6 @@ 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) @@ -500,13 +497,6 @@ 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 diff --git a/daklib/utils.py b/daklib/utils.py index 40171238..d33ec308 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -1325,3 +1325,17 @@ def parse_built_using(control): bu.append((source_name, source_version)) return bu + +################################################################################ + +def is_in_debug_section(control): + """binary package is a debug package + + @type control: dict-like + @param control: control file of binary package + + @rtype Boolean + @return: True if the binary package is a debug package + """ + section = control['Section'].split('/', 1)[-1] + return section == "debug" -- 2.39.2