From 07f04ae12a5787b5a7e708d0c6b95a1e5a3de5e1 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sun, 1 Dec 2024 19:26:08 +0100 Subject: [PATCH] pmb.helpers.repo.update: support PMB_APK_FORCE_MISSING_REPOSITORIES (MR 2505) Do not abort if one or more APKINDEX files cannot be downloaded, if PMB_APK_FORCE_MISSING_REPOSITORIES is set. This is needed when bootstrapping new stable branches. The same environment variable is already used in pmbootstrap code to pass --force-missing-repositories to apk in pmb.chroot.apk.install_run_apk(). --- pmb/helpers/repo.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pmb/helpers/repo.py b/pmb/helpers/repo.py index 12c02623..f6047408 100644 --- a/pmb/helpers/repo.py +++ b/pmb/helpers/repo.py @@ -215,18 +215,28 @@ def update(arch: Arch | None = None, force: bool = False, existing_only: bool = ) # Download and move to right location + missing_ignored = False for i, (url, target) in enumerate(outdated.items()): pmb.helpers.cli.progress_print(i / len(outdated)) temp = pmb.helpers.http.download(url, "APKINDEX", False, logging.DEBUG, True, True) if not temp: - logging.info("NOTE: check the [mirrors] section in 'pmbootstrap config'") - raise NonBugError("getting APKINDEX from binary package mirror failed!") + if os.environ.get("PMB_APK_FORCE_MISSING_REPOSITORIES") == "1": + missing_ignored = True + continue + else: + logging.info("NOTE: check the [mirrors] section in 'pmbootstrap config'") + raise NonBugError("getting APKINDEX from binary package mirror failed!") target_folder = os.path.dirname(target) if not os.path.exists(target_folder): pmb.helpers.run.root(["mkdir", "-p", target_folder]) pmb.helpers.run.root(["cp", temp, target]) pmb.helpers.cli.progress_flush() + if missing_ignored: + logging.warn_once( + "NOTE: ignoring missing APKINDEX due to PMB_APK_FORCE_MISSING_REPOSITORIES=1 (fine during bootstrap)" + ) + return True