From 57eea7b08b804d76bc64eb60442c97728c74f21d Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 7 Apr 2022 14:49:46 -0300 Subject: [PATCH] [debian] fix: removing unused packages on any type of transaction --- CHANGELOG.md | 1 + bauh/gems/debian/aptitude.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e678bd9c..d76ac9eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Debian - info: crashing when the package size has unexpected symbols [#251](https://github.com/vinifmor/bauh/issues/251) - displaying wrong symbols among numbers in install/uninstall/upgrade outputs for systems without english encoding installed + - removing unused packages on any type of transaction (this is the default behaviour for aptitude) - UI - not displaying the right unit symbol for byte based sizes (kB, MB, TB, ...) [#250](https://github.com/vinifmor/bauh/issues/250) diff --git a/bauh/gems/debian/aptitude.py b/bauh/gems/debian/aptitude.py index d9a7e20e..3de2d277 100644 --- a/bauh/gems/debian/aptitude.py +++ b/bauh/gems/debian/aptitude.py @@ -259,13 +259,16 @@ class Aptitude: @classmethod def gen_remove_cmd(cls, packages: Iterable[str], purge: bool, simulate: bool = False) -> str: - return cls.gen_transaction_cmd('purge' if purge else 'remove', packages, simulate) + return cls.gen_transaction_cmd(type_='purge' if purge else 'remove', packages=packages, + simulate=simulate) @staticmethod - def gen_transaction_cmd(type_: str, packages: Iterable[str], simulate: bool = False) -> str: + def gen_transaction_cmd(type_: str, packages: Iterable[str], simulate: bool = False, + delete_unused: bool = False) -> str: return f"aptitude {type_} -q -y --no-gui --full-resolver {' '.join(packages)}" \ f" -o Aptitude::ProblemResolver::RemoveScore=9999999" \ f" -o Aptitude::ProblemResolver::EssentialRemoveScore=9999999" \ + f" -o Aptitude::Delete-Unused={str(delete_unused).lower()}" \ f"{' -V -s -Z' if simulate else ''}" @property