From 4c04260b9783d3c14c6187fced640292d41725e8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 3 Apr 2018 08:28:29 -0400 Subject: [PATCH] [packages] Don't change the global package list. - Count only the packages that will be changed, given the current locale settings. - Preserve global storage unchanged (don't remove any locale-packages). --- src/modules/packages/main.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py index 3105474f8..f252bc15f 100644 --- a/src/modules/packages/main.py +++ b/src/modules/packages/main.py @@ -367,20 +367,20 @@ def run_operations(pkgman, entry): global group_packages, completed_packages, mode_packages for key in entry.keys(): - entry[key] = subst_locale(entry[key]) - group_packages = len(entry[key]) + package_list = subst_locale(entry[key]) + group_packages = len(package_list) if key == "install": _change_mode(INSTALL) - if all([isinstance(x, str) for x in entry[key]]): - pkgman.install(entry[key]) + if all([isinstance(x, str) for x in package_list]): + pkgman.install(package_list) else: - for package in entry[key]: + for package in package_list: pkgman.install_package(package) elif key == "try_install": _change_mode(INSTALL) # we make a separate package manager call for each package so a # single failing package won't stop all of them - for package in entry[key]: + for package in package_list: try: pkgman.install_package(package) except subprocess.CalledProcessError: @@ -389,10 +389,10 @@ def run_operations(pkgman, entry): libcalamares.utils.debug(warn_text) elif key == "remove": _change_mode(REMOVE) - pkgman.remove(entry[key]) + pkgman.remove(package_list) elif key == "try_remove": _change_mode(REMOVE) - for package in entry[key]: + for package in package_list: try: pkgman.remove([package]) except subprocess.CalledProcessError: @@ -401,9 +401,9 @@ def run_operations(pkgman, entry): libcalamares.utils.debug(warn_text) elif key == "localInstall": _change_mode(INSTALL) - pkgman.install(entry[key], from_local=True) + pkgman.install(package_list, from_local=True) - completed_packages += len(entry[key]) + completed_packages += len(package_list) libcalamares.job.setprogress(completed_packages * 1.0 / total_packages) libcalamares.utils.debug(pretty_name()) @@ -447,7 +447,7 @@ def run(): completed_packages = 0 for op in operations: for packagelist in op.values(): - total_packages += len(packagelist) + total_packages += len(subst_locale(packagelist)) if not total_packages: # Avoids potential divide-by-zero in progress reporting