forked from Mirror/pmbootstrap
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.
This commit is contained in:
parent
e91dbefd16
commit
12948eeb3d
1 changed files with 5 additions and 2 deletions
|
@ -154,6 +154,11 @@ def install(args, packages, suffix="native", build=True):
|
||||||
special case that all packages are expected to be in Alpine's
|
special case that all packages are expected to be in Alpine's
|
||||||
repositories, set this to False for performance optimization.
|
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
|
# Initialize chroot
|
||||||
check_min_version(args, suffix)
|
check_min_version(args, suffix)
|
||||||
pmb.chroot.init(args, suffix)
|
pmb.chroot.init(args, suffix)
|
||||||
|
@ -173,8 +178,6 @@ def install(args, packages, suffix="native", build=True):
|
||||||
if build:
|
if build:
|
||||||
install_build(args, package, arch)
|
install_build(args, package, arch)
|
||||||
to_add.append(package)
|
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
|
# Sanitize packages: don't allow '--allow-untrusted' and other options
|
||||||
# to be passed to apk!
|
# to be passed to apk!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue