X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Futils.py;h=401712381674a2fb83c9ec71e6b3a7e3336972fe;hb=1a2f4f83246eb79711bb8f31d20712f120bac249;hp=12798ab260c3a7d330a76c982d19db011fd61d29;hpb=f51754fde4dbff16b7a6f708b7dbcd5fd120f0cc;p=dak.git diff --git a/daklib/utils.py b/daklib/utils.py index 12798ab2..40171238 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -49,7 +49,7 @@ import daklib.config as config import daklib.daksubprocess from dbconn import DBConn, get_architecture, get_component, get_suite, \ get_override_type, Keyring, session_wrapper, \ - get_active_keyring_paths, get_primary_keyring_path, \ + get_active_keyring_paths, \ get_suite_architectures, get_or_set_metadatakey, DBSource, \ Component, Override, OverrideType from sqlalchemy import desc @@ -1301,3 +1301,27 @@ 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