1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-13 19:39:51 +03:00

PMB_APK_FORCE_MISSING_REPOSITORIES: new env var (MR 2318)

This is needed to bring up the v24.06 repositories at
build.postmarketos.org. With the latest apk version, apk refuses to
operate if an URL from /etc/apk/repositories cannot be fetched.

Before the repositories are created for the first time, they do not
exist, so we will just set PMB_APK_FORCE_MISSING_REPOSITORIES=1 in bpo
to be not blocked here.

I've also spent significant time on alternative implementations, but
they have problems:
- Let bpo create an empty APKINDEX before building the first package,
  but this was a larger code change, leading to lots of adjustments in
  the tests, and ultimately it seems it didn't work properly (it seems
  apk/abuild doesn't create a valid signed APKINDEX for one that has no
  packages).
- Do not set the --mirror-pmOS argument for the "final" repository, only
  the "wip" repository, until the "final" repository is available for
  the first time. This works fine for x86_64, but not for foreign arch
  repositories because then the cross compilers from the x86_64
  repository are not available. I've also tried to make a different env
  var that ensures we don't write the non-existing repository to
  /etc/apk/repositories from within pmbootstrap if initializing a
  foreign arch chroot, but then we would find a sane way to do this only
  for the "final" repository and not for the "wip" repository which
  leads to a lot more complexity than this patch.

So this is not the nicest solution (apk still tries to fetch the indexes
and gets a 404), but it is the simplest one and unblocks us from working
on v24.06. Also it doesn't add more complexity which is important in the
middle of the feature freeze we are currently in.

Related: bpo issue 137
Related: d76213e643
Related: https://postmarketos.org/blog/2024/05/19/pmOS-update-2024-05/#pmbootstrap-230-and-feature-freeze
This commit is contained in:
Oliver Smith 2024-05-28 23:12:13 +02:00
parent 3eca24f1ed
commit 0d6c03b201
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 11 additions and 1 deletions

View file

@ -198,6 +198,10 @@ def install_run_apk(args, to_add, to_add_local, to_del, suffix):
# gets confused # gets confused
command += ["--no-interactive"] command += ["--no-interactive"]
# Ignore missing repos before initial build (bpo#137)
if os.getenv("PMB_APK_FORCE_MISSING_REPOSITORIES") == 1:
command = ["--force-missing-repositories"] + command
if args.offline: if args.offline:
command = ["--no-network"] + command command = ["--no-network"] + command
if i == 0: if i == 0:

View file

@ -183,4 +183,10 @@ def init(args, suffix="native", usr_merge=UsrMerge.AUTO,
# Upgrade packages in the chroot, in case alpine-base, apk, etc. have been # Upgrade packages in the chroot, in case alpine-base, apk, etc. have been
# built from source with pmbootstrap # built from source with pmbootstrap
pmb.chroot.root(args, ["apk", "--no-network", "upgrade", "-a"], suffix) command = ["--no-network", "upgrade", "-a"]
# Ignore missing repos before initial build (bpo#137)
if os.getenv("PMB_APK_FORCE_MISSING_REPOSITORIES") == 1:
command = ["--force-missing-repositories"] + command
pmb.chroot.root(args, ["apk"] + command, suffix)