forked from Mirror/pmbootstrap
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().
This commit is contained in:
parent
aa847501c8
commit
07f04ae12a
1 changed files with 12 additions and 2 deletions
|
@ -215,10 +215,15 @@ 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:
|
||||
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)
|
||||
|
@ -227,6 +232,11 @@ def update(arch: Arch | None = None, force: bool = False, existing_only: bool =
|
|||
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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue