[debian] fix: removing unused packages on any type of transaction

This commit is contained in:
Vinicius Moreira
2022-04-07 14:49:46 -03:00
parent 29f096297b
commit 57eea7b08b
2 changed files with 6 additions and 2 deletions

View File

@@ -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)

View File

@@ -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