build: finish builder rework (MR 2252)

Rename build.package() to build.packages() and take a list of packages
to build, since every caller was inside a for loop this simplifies
usage and let's us give nicer log output by doing all the builds first,
so log messages don't get lost in the middle.

Behaviour is cleaned up so this shouuuuld work pretty well now. It
properly descends into dependencies and will build dependencies even if
the package given doesn't need building. Technically this was only done
before during install where the dependencies were recursed in
chroot.apk.install().

It probably makes the most sense to have a mode where it doesn't build
dependencies but warns the user about it, at least when invoked via
pmbootstrap build.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-10 01:04:13 +02:00 committed by Oliver Smith
parent e00d2a8e6d
commit 6857882cf0
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
7 changed files with 203 additions and 117 deletions

View file

@ -125,10 +125,11 @@ def build(args: PmbArgs):
context = get_context()
# Build all packages
for package in args.packages:
arch_package = args.arch or pmb.build.autodetect.arch(package)
if not pmb.build.package(context, package, arch_package, force,
args.strict, src=src):
built = pmb.build.packages(context, args.packages, args.arch, force,
strict=args.strict, src=src)
# Notify about packages that weren't built
for package in set(args.packages) - set(built):
logging.info("NOTE: Package '" + package + "' is up to date. Use"
" 'pmbootstrap build " + package + " --force'"
" if needed.")