From 12948eeb3d36c124d38ffac73f0db210f01b237c Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sun, 29 May 2022 10:30:20 +0200 Subject: [PATCH] pmb.chroot.apk.install: move empty packages check (MR 2185) Since the previous commit that adds install_build(), all packages either end up in to_add or to_del. Move the check for empty packages to the top of the function, and directly check the packages variable. I think it's worth keeping this check because it's shorter to add this check once here than having it a few times in other place where we may have or may not have something to install. And so we can avoid printing an empty "install" message with no packages. --- pmb/chroot/apk.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pmb/chroot/apk.py b/pmb/chroot/apk.py index a0ceb5bb..ea8808ea 100644 --- a/pmb/chroot/apk.py +++ b/pmb/chroot/apk.py @@ -154,6 +154,11 @@ def install(args, packages, suffix="native", build=True): special case that all packages are expected to be in Alpine's repositories, set this to False for performance optimization. """ + if not packages: + logging.verbose("pmb.chroot.apk.install called with empty packages list," + " ignoring") + return + # Initialize chroot check_min_version(args, suffix) pmb.chroot.init(args, suffix) @@ -173,8 +178,6 @@ def install(args, packages, suffix="native", build=True): if build: install_build(args, package, arch) to_add.append(package) - if not len(to_add) and not len(to_del): - return # Sanitize packages: don't allow '--allow-untrusted' and other options # to be passed to apk!