Commit 80e7496f authored by Alan's avatar Alan

ASP: also gracefully remove ASP with target version

Will-fix: #15822
parent ebc4da01
......@@ -462,22 +462,23 @@ def apt_hook_post():
packages = json.load(f)
os.remove(ASP_STATE_PACKAGES)
additional_packages = get_additional_packages(search_new_persistence=True)
additional_packages_names = map(
filter_package_details,
get_additional_packages(search_new_persistence=True))
apt_cache = apt.cache.Cache()
# Filter automatically installed packages and packages already configured
# as additional software
new_manually_installed_packages = set(filter(
lambda pkg: not apt_cache[pkg].is_auto_installed
and pkg not in map(filter_package_details,
additional_packages), # NOQA: E131
and pkg not in additional_packages_names, # NOQA: E131
set(packages["installed"])))
if new_manually_installed_packages:
handle_installed_packages(new_manually_installed_packages)
# Filter non-additional software packages
additional_packages_removed = set(packages["removed"]).intersection(
additional_packages)
additional_packages_names)
if additional_packages_removed:
handle_removed_packages(additional_packages_removed)
......
pythonlib @ 177079fc
Subproject commit 7b72784ac48dfb2b444d2f4331bf672446c8b906
Subproject commit 177079fc262090da0b7309cb2fadbf872f8c20c3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment