X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Futils.py;h=00699ec410f6963360166f032c3e41a3f4e5d5a3;hb=b7fd3112758e847ac708d7c10ef025eaad19687a;hp=efae7756527161b35cd377670fa6d4c3a4c8461f;hpb=4403a512a0ee03cac1f1fd0c2ce6c0f4ff161533;p=dak.git diff --git a/daklib/utils.py b/daklib/utils.py index efae7756..00699ec4 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -59,7 +59,7 @@ from textutils import fix_maintainer from regexes import re_html_escaping, html_escaping, re_single_line_field, \ re_multi_line_field, re_srchasver, re_taint_free, \ re_re_mark, re_whitespace_comment, re_issource, \ - re_is_orig_source, re_build_dep_arch, re_parse_maintainer + re_build_dep_arch, re_parse_maintainer from formats import parse_format, validate_changes_format from srcformats import get_format_from_string @@ -276,7 +276,7 @@ def parse_changes(filename, signing_rules=0, dsc_file=0, keyrings=None): missingfields.append(keyword) if len(missingfields): - raise ParseChangesError("Missing mandantory field(s) in changes file (policy 5.5): %s" % (missingfields)) + raise ParseChangesError("Missing mandatory field(s) in changes file (policy 5.5): %s" % (missingfields)) return changes @@ -1301,3 +1301,42 @@ 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] + auto_built_package = control.get("Auto-Built-Package") + return section == "debug" and auto_built_package == "debug-symbols"