chroot: apk: fix local repos with apk.static (MR 2252)

It turns out that apk with the --root argument will still treat local
repositories relative to the host. This makes sense considering the
intended usecase, however as a result the recent change to use
apk.static for all apk commands inside the target root will break the
use of local packages.

To fix this, adjust how we populate /etc/apk/repositories, changing the
default to no longer include the local user repo. Instead we pass
--repository to apk.static with the host path to the repo.

The only time we want to add the user repo to /etc/apk/repositories
inside the chroot is when the user enters the chroot, so a special case
is added to helpers/frontend.py for the chroot command.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-14 04:10:50 +02:00 committed by Oliver Smith
parent 77f66eb43d
commit 3034768a1a
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 15 additions and 7 deletions

View file

@ -53,7 +53,7 @@ def apkindex_hash(url: str, length: int=8) -> Path:
# FIXME: make config.mirrors a normal dict
# mypy: disable-error-code="literal-required"
@Cache("user_repository", "mirrors_exclude")
def urls(user_repository=True, mirrors_exclude: List[str] = []):
def urls(user_repository=False, mirrors_exclude: List[str] = []):
"""Get a list of repository URLs, as they are in /etc/apk/repositories.
:param user_repository: add /mnt/pmbootstrap/packages