launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31481
Re: [Merge] ~pelpsi/launchpad-buildd:deb822-support into launchpad-buildd:master
Diff comments:
> diff --git a/lpbuildd/target/apt.py b/lpbuildd/target/apt.py
> index 3f9ddca..d99e041 100644
> --- a/lpbuildd/target/apt.py
> +++ b/lpbuildd/target/apt.py
> @@ -13,6 +14,66 @@ from lpbuildd.target.operation import Operation
> logger = logging.getLogger(__name__)
>
>
> +def split_options(raw):
> + table = str.maketrans({
> + "[": None,
> + "]": None
> + })
> + options = raw.translate(table).split(' ')
> +
> + return options
> +
> +
> +def prepare_source(line):
> + pattern = re.compile(
I haven't checked, but does the python apt bindings library provide a way to parse sources.list/deb822 sources content? If it does, we could reuse that functionality instead of implementing it on our own here.
> + r'^(?: *(?P<type>deb|deb-src)) +'
> + r'(?P<options>\[.+\] ?)*'
> + r'(?P<uri>\w+:\/\/\S+) +'
> + r'(?P<suite>\S+)'
> + r'(?: +(?P<components>.*))?$'
> + )
> + matches = re.match(pattern, line)
> + if matches is not None:
> + options = {}
> + if matches.group('options'):
> + for option in split_options(matches['options']):
> + if "=" in option:
> + key, value = option.split("=")
> + options[key] = value
> + source = {
> + "Types": {matches['type']},
> + "URIs": matches['uri'],
> + "Enabled": "yes",
> + }
> + if matches.group('suite'):
> + source["Suites"] = set(matches['suite'].split(' '))
> + if matches.group('components'):
> + source["Components"] = set(
> + matches['components'].split(' ')
> + )
> + if "arch" in options:
> + if "Architectures" in source:
> + source["Architectures"].append(options["arch"])
> + else:
> + source["Architectures"] = {options["arch"]}
> + if "signed-by" in options:
> + if "Signed-by" in source:
> + source["Signed-by"].append(options["signed-by"])
> + else:
> + source["Signed-by"] = {options["signed-by"]}
> + if "lang" in options:
> + if "Languages" in source:
> + source["Languages"].append(options["lang"])
> + else:
> + source["Languages"] = {options["lang"]}
> + if "target" in options:
> + if "Targets" in source:
> + source["Targets"].append(options["target"])
> + else:
> + source["Targets"] = {options["target"]}
> + return source
> +
> +
> class OverrideSourcesList(Operation):
> description = "Override sources.list in the target environment."
>
--
https://code.launchpad.net/~pelpsi/launchpad-buildd/+git/launchpad-buildd/+merge/473136
Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/launchpad-buildd:deb822-support into launchpad-buildd:master.
References