diff --git a/docs/mirrors.md b/docs/mirrors.md index 47d86563..c22a16d3 100644 --- a/docs/mirrors.md +++ b/docs/mirrors.md @@ -10,15 +10,22 @@ Find the currently selected mirrors in the output of `pmbootstrap status`, as we ## Advanced -Some advanced use cases are supported by configuring the mirrors directly, either by editing -`pmbootstrap_v3.cfg` or running `pmbootstrap config`. Find the lists of mirrors at -[mirrors.alpinelinux.org](https://mirrors.alpinelinux.org) and +Some advanced use cases are supported by configuring the mirrors directly, either by running the +non-interactive `pmbootstrap config` command or by editing `pmbootstrap_v3.cfg`. Find the lists of +mirrors at [mirrors.alpinelinux.org](https://mirrors.alpinelinux.org) and [mirrors.postmarketos.org](https://mirrors.postmarketos.org). -### Change the Alpine Linux mirror +### Change the mirrors non-interactively ``` $ pmbootstrap config mirrors.alpine http://uk.alpinelinux.org/alpine/ +$ pmbootstrap config mirrors.pmaports http://postmarketos.craftyguy.net/ +``` + +Reset to default works as with all config options: +``` +$ pmbootstrap config -r mirrors.alpine +$ pmbootstrap config -r mirrors.pmaports ``` ### Disable the postmarketOS mirror diff --git a/pmb/helpers/args.py b/pmb/helpers/args.py index 9dbae07b..de065d47 100644 --- a/pmb/helpers/args.py +++ b/pmb/helpers/args.py @@ -75,14 +75,6 @@ def init(args: PmbArgs) -> PmbArgs: if hasattr(args, key): delattr(args, key) - # Handle --mirror-alpine and --mirror-pmos - value = getattr(args, "mirror_alpine", None) - if value: - config.mirrors["alpine"] = value - value = getattr(args, "mirror_postmarketos", None) - if value: - config.mirrors["pmaports"] = value - # Configure runtime context context = Context(config) context.command_timeout = args.timeout diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index 36ea2fa8..bc4e4bbe 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -8,6 +8,7 @@ import sys from pmb.core.arch import Arch from pmb.core import Config from pmb.types import PmbArgs +from pmb.helpers.exceptions import NonBugError try: import argcomplete # type:ignore[import-untyped] @@ -806,9 +807,6 @@ def get_parser(): parser = argparse.ArgumentParser(prog="pmbootstrap") arch_native = Arch.native() arch_choices = Arch.supported() - # FIXME: we should load the real config instead here - default_config = Config() - mirrors_pmos_default = default_config.mirrors["pmaports"] # Other parser.add_argument("-V", "--version", action="version", version=pmb.__version__) @@ -823,20 +821,15 @@ def get_parser(): parser.add_argument( "-mp", "--mirror-pmOS", - dest="mirror_postmarketos", - help="postmarketOS mirror, disable with: -mp=''," - " specify multiple with: -mp='one' -mp='two'," - f" default: {mirrors_pmos_default}", - metavar="URL", + dest="deprecated_mp", + help=argparse.SUPPRESS, action="append", - default=[], ) parser.add_argument( "-m", "--mirror-alpine", - dest="mirror_alpine", - help="Alpine Linux mirror, default: " f"{default_config.mirrors['alpine']}", - metavar="URL", + dest="deprecated_m", + help=argparse.SUPPRESS, ) parser.add_argument("-j", "--jobs", help="parallel jobs when compiling") parser.add_argument( @@ -1287,6 +1280,12 @@ def arguments(): pmb.helpers.args.init(args) + if getattr(args, "deprecated_mp", None) or getattr(args, "deprecated_m", None): + raise NonBugError( + "Arguments --mirror-pmOS and --mirror-alpine have been removed. See docs/mirrors.md" + " regarding how to set mirrors now." + ) + if getattr(args, "go_mod_cache", None) is None: gomodcache = True if getattr(args, "src", None) else False setattr(args, "go_mod_cache", gomodcache)