From ceddfdb536c7a82bb500dfc186b05c3f26c5836c Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 20 Sep 2024 19:59:07 +0300 Subject: [PATCH] Updated for new added packages Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 3 +++ slpkg/main.py | 10 ++++++++++ slpkg/upgrade.py | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 2a7c652d..1650b786 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,9 @@ - Fixed: * Fixed ascii characters done and failed +- Updated: + * Updated the upgrade method to first add newly added packages to install + ### 5.1.2 - 22/08/2024 - Fixed: diff --git a/slpkg/main.py b/slpkg/main.py index 9828a894..c10f0809 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -448,6 +448,7 @@ class Menu(Configs): # pylint: disable=[R0902] """ command: str = Menu.upgrade.__name__ removed: list = [] + added: list = [] if len(self.args) == 1: @@ -464,14 +465,23 @@ class Menu(Configs): # pylint: disable=[R0902] for package in packages: if package.endswith('_Removed.'): removed.append(package.replace('_Removed.', '')) + if package.endswith('_Added.'): + added.append(package.replace('_Added.', '')) if removed: packages = [pkg for pkg in packages if not pkg.endswith('_Removed.')] remove = RemovePackages(removed, self.flags) remove.remove(upgrade=True) + if added: + packages = [pkg for pkg in packages if not pkg.endswith('_Added.')] + added = self.choose.packages(self.data, added, command) + packages: list = self.choose.packages(self.data, packages, command) + # Add the new added packages front to list for install. + packages: list = added.extend(packages) + if not packages: print('\nEverything is up-to-date!\n') raise SystemExit(0) diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index 0dafc0b7..2227eac1 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -84,12 +84,12 @@ class Upgrade(Configs): # pylint: disable=[R0902] if self.repository in self.repos.remove_packages: if name not in self.data.keys(): - yield name + '_Removed.' + yield f'{name}_Removed.' if self.repository in self.repos.new_packages: for name in self.data.keys(): if not self.utils.is_package_installed(name): - yield name + yield f'{name}_Added.' def is_package_upgradeable(self, installed: str) -> bool: # pylint: disable=[R0911] """Return True for upgradeable packages.