]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/utils.py
There should only be one place to check for a debug package
[dak.git] / daklib / utils.py
index efae7756527161b35cd377670fa6d4c3a4c8461f..d33ec308366415e874cf2dc1383a63666f5cfeb2 100644 (file)
@@ -1301,3 +1301,41 @@ def check_reverse_depends(removals, suite, arches=None, session=None, cruft=Fals
             print
 
     return dep_problem
+
+################################################################################
+
+def parse_built_using(control):
+    """source packages referenced via Built-Using
+
+    @type  control: dict-like
+    @param control: control file to take Built-Using field from
+
+    @rtype:  list of (str, str)
+    @return: list of (source_name, source_version) pairs
+    """
+    built_using = control.get('Built-Using', None)
+    if built_using is None:
+        return []
+
+    bu = []
+    for dep in apt_pkg.parse_depends(built_using):
+        assert len(dep) == 1, 'Alternatives are not allowed in Built-Using field'
+        source_name, source_version, comp = dep[0]
+        assert comp == '=', 'Built-Using must contain strict dependencies'
+        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"