From c898b13296a39acdfa5be2f985be0354438a7b04 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sat, 28 May 2022 12:08:40 +0200 Subject: [PATCH] pmb.chroot.apk.install: rename to{add,del} vars (MR 2185) Put underscores between the words for consistency with other variable names. Since the whole function is about dealing with packages, remove the "packages_" prefix to make them shorter. packages_toadd -> to_add packages_todel -> to_del --- pmb/chroot/apk.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pmb/chroot/apk.py b/pmb/chroot/apk.py index 7898ea4c..6f30e8e9 100644 --- a/pmb/chroot/apk.py +++ b/pmb/chroot/apk.py @@ -208,22 +208,22 @@ def install(args, packages, suffix="native", build=True): # Filter outdated packages (build them if required) packages_installed = installed(args, suffix) - packages_toadd = [] - packages_todel = [] + to_add = [] + to_del = [] for package in packages_with_depends: if not install_is_necessary( args, build, arch, package, packages_installed): continue if package.startswith("!"): - packages_todel.append(package.lstrip("!")) + to_del.append(package.lstrip("!")) else: - packages_toadd.append(package) - if not len(packages_toadd) and not len(packages_todel): + 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! - for package in packages_toadd + packages_todel: + for package in to_add + to_del: if package.startswith("-"): raise ValueError(f"Invalid package name: {package}") @@ -236,7 +236,7 @@ def install(args, packages, suffix="native", build=True): # Local packages: Using the path instead of pkgname makes apk update # packages of the same version if the build date is different - packages_toadd = replace_aports_packages_with_path(args, packages_toadd, + to_add = replace_aports_packages_with_path(args, to_add, suffix, arch) # Split off conflicts @@ -246,13 +246,13 @@ def install(args, packages, suffix="native", build=True): # Use a virtual package to mark only the explicitly requested packages as # explicitly installed, not their dependencies or specific paths (#1212) commands = [["add"] + packages_without_conflicts] - if len(packages_toadd) and packages_without_conflicts != packages_toadd: + if len(to_add) and packages_without_conflicts != to_add: commands = [["add", "-u", "--virtual", ".pmbootstrap"] + - packages_toadd, + to_add, ["add"] + packages_without_conflicts, ["del", ".pmbootstrap"]] - if len(packages_todel): - commands.append(["del"] + packages_todel) + if len(to_del): + commands.append(["del"] + to_del) for (i, command) in enumerate(commands): if args.offline: command = ["--no-network"] + command