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:
parent
a92e6a89d0
commit
a5a64158e9
|
@ -76,7 +76,7 @@ defaults = {
|
||||||
"keymap": "",
|
"keymap": "",
|
||||||
"log": "$WORK/log.txt",
|
"log": "$WORK/log.txt",
|
||||||
"mirror_alpine": "http://dl-cdn.alpinelinux.org/alpine/",
|
"mirror_alpine": "http://dl-cdn.alpinelinux.org/alpine/",
|
||||||
"mirror_postmarketos": "http://postmarketos.brixit.nl",
|
"mirrors_postmarketos": ["http://postmarketos.brixit.nl"],
|
||||||
"nonfree_firmware": True,
|
"nonfree_firmware": True,
|
||||||
"nonfree_userland": False,
|
"nonfree_userland": False,
|
||||||
"port_distccd": "33632",
|
"port_distccd": "33632",
|
||||||
|
|
|
@ -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):
|
def check_pmaports_path(args):
|
||||||
""" Make sure that args.aports exists when it was overridden by --aports.
|
""" Make sure that args.aports exists when it was overridden by --aports.
|
||||||
Without this check, 'pmbootstrap init' would start cloning the
|
Without this check, 'pmbootstrap init' would start cloning the
|
||||||
|
@ -134,6 +154,7 @@ def add_deviceinfo(args):
|
||||||
|
|
||||||
def init(args):
|
def init(args):
|
||||||
# Basic initialization
|
# Basic initialization
|
||||||
|
fix_mirrors_postmarketos(args)
|
||||||
pmb.config.merge_with_args(args)
|
pmb.config.merge_with_args(args)
|
||||||
replace_variables(args)
|
replace_variables(args)
|
||||||
add_shortcuts(args)
|
add_shortcuts(args)
|
||||||
|
|
|
@ -76,9 +76,9 @@ def auto_apkindex_files(args):
|
||||||
if os.path.exists(local):
|
if os.path.exists(local):
|
||||||
ret[arch].append(local)
|
ret[arch].append(local)
|
||||||
|
|
||||||
if args.mirror_postmarketos:
|
for mirror in args.mirrors_postmarketos:
|
||||||
path = (args.work + "/cache_apk_" + arch + "/APKINDEX." +
|
path = (args.work + "/cache_apk_" + arch + "/APKINDEX." +
|
||||||
pmb.helpers.repo.hash(args.mirror_postmarketos) + ".tar.gz")
|
pmb.helpers.repo.hash(mirror) + ".tar.gz")
|
||||||
ret[arch].append(path)
|
ret[arch].append(path)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,9 @@ def urls(args, user_repository=True, postmarketos_mirror=True):
|
||||||
ret.append("/mnt/pmbootstrap-packages")
|
ret.append("/mnt/pmbootstrap-packages")
|
||||||
|
|
||||||
# Upstream postmarketOS binary repository
|
# Upstream postmarketOS binary repository
|
||||||
if postmarketos_mirror and args.mirror_postmarketos:
|
if postmarketos_mirror:
|
||||||
ret.append(args.mirror_postmarketos)
|
for mirror in args.mirrors_postmarketos:
|
||||||
|
ret.append(mirror)
|
||||||
|
|
||||||
# Upstream Alpine Linux repositories
|
# Upstream Alpine Linux repositories
|
||||||
directories = ["main", "community"]
|
directories = ["main", "community"]
|
||||||
|
@ -93,9 +94,9 @@ def apkindex_files(args, arch=None):
|
||||||
|
|
||||||
# Upstream postmarketOS binary repository
|
# Upstream postmarketOS binary repository
|
||||||
urls_todo = []
|
urls_todo = []
|
||||||
mirror = args.mirror_postmarketos
|
for mirror in args.mirrors_postmarketos:
|
||||||
if mirror:
|
if mirror:
|
||||||
urls_todo.append(mirror)
|
urls_todo.append(mirror)
|
||||||
|
|
||||||
# Resolve the APKINDEX.$HASH.tar.gz files
|
# Resolve the APKINDEX.$HASH.tar.gz files
|
||||||
urls_todo += urls(args, False, False)
|
urls_todo += urls(args, False, False)
|
||||||
|
|
|
@ -260,6 +260,7 @@ def arguments():
|
||||||
parser = argparse.ArgumentParser(prog="pmbootstrap")
|
parser = argparse.ArgumentParser(prog="pmbootstrap")
|
||||||
arch_native = pmb.parse.arch.alpine_native()
|
arch_native = pmb.parse.arch.alpine_native()
|
||||||
arch_choices = set(pmb.config.build_device_architectures + [arch_native])
|
arch_choices = set(pmb.config.build_device_architectures + [arch_native])
|
||||||
|
mirrors_pmos_default = pmb.config.defaults["mirrors_postmarketos"]
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
parser.add_argument("-V", "--version", action="version",
|
parser.add_argument("-V", "--version", action="version",
|
||||||
|
@ -269,11 +270,11 @@ def arguments():
|
||||||
parser.add_argument("-c", "--config", dest="config",
|
parser.add_argument("-c", "--config", dest="config",
|
||||||
default=pmb.config.defaults["config"])
|
default=pmb.config.defaults["config"])
|
||||||
parser.add_argument("-d", "--port-distccd", dest="port_distccd")
|
parser.add_argument("-d", "--port-distccd", dest="port_distccd")
|
||||||
parser.add_argument("-mp", "--mirror-pmOS", dest="mirror_postmarketos",
|
parser.add_argument("-mp", "--mirror-pmOS", dest="mirrors_postmarketos",
|
||||||
help="postmarketOS mirror, disable with: -mp='',"
|
help="postmarketOS mirror, disable with: -mp='',"
|
||||||
" default: " +
|
" specify multiple with: -mp='one' -mp='two',"
|
||||||
pmb.config.defaults["mirror_postmarketos"],
|
" default: " + ", ".join(mirrors_pmos_default),
|
||||||
metavar="URL")
|
metavar="URL", action="append", default=[])
|
||||||
parser.add_argument("-m", "--mirror-alpine", dest="mirror_alpine",
|
parser.add_argument("-m", "--mirror-alpine", dest="mirror_alpine",
|
||||||
help="Alpine Linux mirror, default: " +
|
help="Alpine Linux mirror, default: " +
|
||||||
pmb.config.defaults["mirror_alpine"],
|
pmb.config.defaults["mirror_alpine"],
|
||||||
|
|
Loading…
Reference in New Issue