forked from Mirror/pmbootstrap
pmbootstrap build, install: require repo_bootstrap (MR 2273)
Make sure that if systemd is selected, the repo_bootstrap is done before the "pmbootstrap build" and "pmbootstrap install" commands can be used.
This commit is contained in:
parent
fafd4e7304
commit
266bfc31cd
2 changed files with 40 additions and 0 deletions
|
@ -111,6 +111,12 @@ def build(args):
|
||||||
if src and not os.path.exists(src):
|
if src and not os.path.exists(src):
|
||||||
raise RuntimeError("Invalid path specified for --src: " + src)
|
raise RuntimeError("Invalid path specified for --src: " + src)
|
||||||
|
|
||||||
|
# Ensure repo_bootstrap is done for all arches we intend to build for
|
||||||
|
for package in args.packages:
|
||||||
|
arch_package = args.arch or pmb.build.autodetect.arch(args, package)
|
||||||
|
pmb.helpers.repo_bootstrap.require_bootstrap(args, arch_package,
|
||||||
|
f"build {package} for {arch_package}")
|
||||||
|
|
||||||
# Build all packages
|
# Build all packages
|
||||||
for package in args.packages:
|
for package in args.packages:
|
||||||
arch_package = args.arch or pmb.build.autodetect.arch(args, package)
|
arch_package = args.arch or pmb.build.autodetect.arch(args, package)
|
||||||
|
@ -251,6 +257,10 @@ def install(args):
|
||||||
raise ValueError("Installation using rsync"
|
raise ValueError("Installation using rsync"
|
||||||
" is not currently supported on btrfs filesystem.")
|
" is not currently supported on btrfs filesystem.")
|
||||||
|
|
||||||
|
pmb.helpers.repo_bootstrap.require_bootstrap(args, args.deviceinfo["arch"],
|
||||||
|
f"do 'pmbootstrap install' for {args.deviceinfo['arch']}"
|
||||||
|
" (deviceinfo_arch)")
|
||||||
|
|
||||||
# On-device installer checks
|
# On-device installer checks
|
||||||
# Note that this can't be in the mutually exclusive group that has most of
|
# Note that this can't be in the mutually exclusive group that has most of
|
||||||
# the conflicting options, because then it would not work with --disk.
|
# the conflicting options, because then it would not work with --disk.
|
||||||
|
|
|
@ -155,3 +155,33 @@ def main(args):
|
||||||
|
|
||||||
set_progress_total(args, steps, arch)
|
set_progress_total(args, steps, arch)
|
||||||
run_steps(args, steps, arch, suffix)
|
run_steps(args, steps, arch, suffix)
|
||||||
|
|
||||||
|
|
||||||
|
def require_bootstrap_error(repo, arch, trigger_str):
|
||||||
|
"""
|
||||||
|
Tell the user that they need to do repo_bootstrap, with some context.
|
||||||
|
|
||||||
|
:param repo: which repository
|
||||||
|
:param arch: for which architecture
|
||||||
|
:param trigger_str: message for the user to understand what caused this
|
||||||
|
"""
|
||||||
|
logging.info(f"ERROR: Trying to {trigger_str} with {repo} enabled, but the"
|
||||||
|
f" {repo} repo needs to be bootstrapped first.")
|
||||||
|
raise RuntimeError(f"Run 'pmbootstrap repo_bootstrap {repo} --arch={arch}'"
|
||||||
|
" and then try again.")
|
||||||
|
|
||||||
|
|
||||||
|
def require_bootstrap(args, arch, trigger_str):
|
||||||
|
"""
|
||||||
|
Check if repo_bootstrap was done, if any is needed.
|
||||||
|
|
||||||
|
:param arch: for which architecture
|
||||||
|
:param trigger_str: message for the user to understand what caused this
|
||||||
|
"""
|
||||||
|
cfg = pmb.config.pmaports.read_config_repos(args)
|
||||||
|
|
||||||
|
if "systemd" in cfg and pmb.config.other.is_systemd_selected(args):
|
||||||
|
pkg = pmb.parse.apkindex.package(args, "postmarketos-base-systemd",
|
||||||
|
arch, False)
|
||||||
|
if not pkg:
|
||||||
|
require_bootstrap_error("systemd", arch, trigger_str)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue