[dak/master] 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 4b3d97d..7b6b964 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 fa67f10..e3bf912 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 8b2aabf..b78d100 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)
@@ -501,13 +498,6 @@ 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
diff --git a/daklib/utils.py b/daklib/utils.py
index 4017123..d33ec30 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.1.4
Reply to: