install: fix --no-local-pkgs

As chroot.glob() now returns a generator, convert it to a list first to
check if it is empty. This may not be the most efficient method, but
since we expect it to be empty here it is fine.

Without this patch, it always shows the error even if there are no
locally built packages:

  ERROR: --no-local-pkgs specified, but locally built packages found. Consider 'pmbootstrap zap -p' to delete them.
This commit is contained in:
Oliver Smith 2024-09-19 02:00:13 +02:00
parent 9cec60e057
commit 0478c30e5c
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -396,7 +396,7 @@ def install(args: PmbArgs) -> None:
config.build_pkgs_on_install = False
# Safest way to avoid installing local packages is having none
if (config.work / "packages").glob("*"):
if list((config.work / "packages").glob("*")):
raise ValueError(
"--no-local-pkgs specified, but locally built"
" packages found. Consider 'pmbootstrap zap -p'"