build: ignore invalid checksums unless --strict (MR 2252)

We can fairly easily patch abuild by appending anything we want to the
APKBUILD file after copying it to the chroot.

Leverage this to override the verify() function so that it doesn't die
when checksums don't match.

Instead let's build the package anyway, but set a flag and print a
warning with instructions on how to generate the checksums.

We should continue to require APKBUILDs in pmaports to have valid
checksums.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-14 05:13:24 +02:00 committed by Oliver Smith
parent d75f1cf525
commit 7d85bb31d5
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
4 changed files with 39 additions and 3 deletions

View file

@ -314,11 +314,15 @@ def run_abuild(context: Context, apkbuild, channel, arch: Arch, strict=False, fo
cmd += ["-f"]
# Copy the aport to the chroot and build it
pmb.build.copy_to_buildpath(apkbuild["pkgname"], suffix)
pmb.build.copy_to_buildpath(apkbuild["pkgname"], suffix, no_override=strict)
override_source(apkbuild, apkbuild["pkgver"], src, suffix)
link_to_git_dir(suffix)
pmb.chroot.user(cmd, suffix, Path("/home/pmos/build"), env=env)
if (suffix / "tmp/apkbuild_verify_failed").exists():
logging.info("WARNING: Some checksums didn't match, run"
f" 'pmbootstrap checksum {apkbuild['pkgname']}' to fix them.")
def finish(apkbuild, channel, arch, output: Path, chroot: Chroot, strict=False):
"""Various finishing tasks that need to be done after a build."""