build: envkernel: fix package output (MR 2252)

To support multiple aports we changed how we configure
/home/pmos/packages in the buildroot so it now points to whichever local
binary repo makes sense for the package being built.

Copy over the code to envkernel run_abuild() so the packages actually
get installed to $WORK/packages

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-10 13:21:31 +02:00 committed by Oliver Smith
parent 0e638329d1
commit 50943b9fc5
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 17 additions and 3 deletions

View file

@ -146,6 +146,21 @@ def run_abuild(context: Context, pkgname: str, arch: Arch, apkbuild_path: Path,
# Create working directory for abuild
pmb.build.copy_to_buildpath(pkgname)
# FIXME: duplicated from pmb.build._package.run_aports()
# This is needed to set up the package output directory for
# abuild and shouldn't really be done here.
channel = pmb.config.pmaports.read_config()["channel"]
pkgdir = context.config.work / "packages" / channel
if not pkgdir.exists():
pmb.helpers.run.root(["mkdir", "-p", pkgdir])
pmb.helpers.run.root(["chown", "-R", f"{pmb.config.chroot_uid_user}:{pmb.config.chroot_uid_user}",
pkgdir.parent])
pmb.chroot.rootm([["mkdir", "-p", "/home/pmos/packages"],
["rm", "-f", "/home/pmos/packages/pmos"],
["ln", "-sf", f"/mnt/pmbootstrap/packages/{channel}",
"/home/pmos/packages/pmos"]], chroot)
# Create symlink from abuild working directory to envkernel build directory
if kbuild_out != "":
if os.path.islink(chroot / "mnt/linux" / kbuild_out) and \
@ -201,8 +216,7 @@ def package_kernel(args: PmbArgs):
chroot = pmb.build.autodetect.chroot(apkbuild, arch)
# Install package dependencies
depends, _ = pmb.build._package.build_depends(
context, apkbuild, Arch.native(), strict=False)
depends = pmb.build.get_depends(context, apkbuild)
pmb.build.init(chroot)
if arch.cpu_emulation_required():
depends.append(f"binutils-{arch}")