]> git.decadent.org.uk Git - dak.git/commitdiff
There should only be one place to check for a debug package
authorAnsgar Burchardt <ansgar@debian.org>
Sun, 16 Aug 2015 18:33:13 +0000 (20:33 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Sun, 16 Aug 2015 18:44:30 +0000 (20:44 +0200)
dak/process_policy.py
daklib/archive.py
daklib/upload.py
daklib/utils.py

index 4b3d97dc12fc681c0021c5ccc3926bcefba97d81..7b6b9645ece4521cacd2373356ff750d81b271d0 100755 (executable)
@@ -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))
index fa67f10e2f2ff64f69cf48e0e7257a8af6a8b019..e3bf91267e14f0d9ff64b2067abf9d41ae4c2a4f 100644 (file)
@@ -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)
index 8b2aabf038212bc6019287e00c8d9c7a6c99783e..b78d100fe55c5e59d48f03338a9ec11a9a0edff9 100644 (file)
@@ -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
index 401712381674a2fb83c9ec71e6b3a7e3336972fe..d33ec308366415e874cf2dc1383a63666f5cfeb2 100644 (file)
@@ -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"