allow specifying multiple postmarketOS mirrors (!1718)

Multiple -mp arguments can be used to list multiple mirrors:
$ pmbootstrap -mp=first -mp=second chroot -- cat /etc/apk/repositories

This is needed for the new build infrastructure, so we can have a WIP
repository to which we push packages until all of them are up to date,
and then publish all of them at once. Software like KDE/Plasma Mobile,
which expect a lot of packages to be updated from one version to
another will not end up with a half-way through upgrade that way.
This commit is contained in:
Oliver Smith 2018-11-19 08:36:49 +01:00
parent a92e6a89d0
commit a5a64158e9
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 35 additions and 12 deletions

View file

@ -82,6 +82,26 @@ import pmb.config
"""
def fix_mirrors_postmarketos(args):
""" Fix args.mirrors_postmarketos when it is supposed to be empty or the
default value.
In pmb/parse/arguments.py, we set the -mp/--mirror-pmOS argument to
action="append" and start off with an empty list. That way, users can
specify multiple custom mirrors by specifying -mp multiple times on the
command line. Here we fix the default and no mirrors case.
NOTE: we don't use nargs="+", because it does not play nicely with
subparsers: <https://bugs.python.org/issue9338> """
# -mp not specified: use default mirrors
if not args.mirrors_postmarketos:
args.mirrors_postmarketos = pmb.config.defaults["mirrors_postmarketos"]
# -mp="": use no postmarketOS mirrors (build everything locally)
if args.mirrors_postmarketos == [""]:
args.mirrors_postmarketos = []
def check_pmaports_path(args):
""" Make sure that args.aports exists when it was overridden by --aports.
Without this check, 'pmbootstrap init' would start cloning the
@ -134,6 +154,7 @@ def add_deviceinfo(args):
def init(args):
# Basic initialization
fix_mirrors_postmarketos(args)
pmb.config.merge_with_args(args)
replace_variables(args)
add_shortcuts(args)