Fixed upgrade

This commit is contained in:
Dimitris Zlatanidis 2023-01-20 18:12:29 +02:00
parent b4e010dbb1
commit 16da4eec5a

View file

@ -7,11 +7,11 @@ from slpkg.blacklist import Blacklist
from slpkg.dependencies import Requires from slpkg.dependencies import Requires
class Upgrade(Utilities): class Upgrade:
""" Upgrade the installed packages. """ """ Upgrade the installed packages. """
def __init__(self): def __init__(self):
super(Utilities, self).__init__() self.utils = Utilities()
def packages(self): def packages(self):
""" Compares version of packages and returns the maximum. """ """ Compares version of packages and returns the maximum. """
@ -19,14 +19,14 @@ class Upgrade(Utilities):
black = Blacklist().get() black = Blacklist().get()
upgrade, requires = [], [] upgrade, requires = [], []
installed = self.all_installed() installed = self.utils.all_installed()
for pkg in installed: for pkg in installed:
inst_pkg_name = self.split_installed_pkg(pkg)[0] inst_pkg_name = self.utils.split_installed_pkg(pkg)[0]
if inst_pkg_name not in black and inst_pkg_name in repo_packages: if inst_pkg_name not in black and inst_pkg_name in repo_packages:
if self.is_repo_version_bigger(inst_pkg_name): if self.utils.is_repo_version_bigger(inst_pkg_name):
requires += Requires(inst_pkg_name).resolve() requires += Requires(inst_pkg_name).resolve()
upgrade.append(inst_pkg_name) upgrade.append(inst_pkg_name)