Fixed for install

This commit is contained in:
Dimitris Zlatanidis 2023-03-30 16:27:42 +03:00
parent c1d877bab7
commit cdd28f0197
2 changed files with 13 additions and 17 deletions

View file

@ -100,10 +100,7 @@ class Packages(Configs):
for pkg in self.install_order:
skip_package: str = self.skip_installed_package(pkg)
if not skip_package:
if self.is_for_install(pkg):
mirror: str = BinQueries(pkg, self.repo).mirror()
location: str = BinQueries(pkg, self.repo).location()
package: str = BinQueries(pkg, self.repo).package_bin()
@ -111,9 +108,8 @@ class Packages(Configs):
pkg_urls.append(f'{mirror}{location}/{package}')
self.binary_packages.append(package)
self.utils.remove_file_if_exists(self.tmp_slpkg, package)
else:
version: str = self.utils.split_binary_pkg(skip_package)[1]
version: str = BinQueries(pkg, self.repo).version()
self.view_message.view_skipping_packages(pkg, version)
if pkg_urls:
@ -121,13 +117,13 @@ class Packages(Configs):
down.download()
print()
def skip_installed_package(self, package) -> str:
def is_for_install(self, name) -> bool:
""" Skip installed package when the option --skip-installed is applied. """
installed_package: str = self.utils.is_package_installed(package)
if self.utils.is_option(self.flag_skip_installed, self.flags):
return False
if (installed_package and self.mode == 'upgrade' and not self.upgrade.is_package_upgradeable(package)
or self.mode == 'install' and not self.utils.is_option(self.flag_reinstall, self.flags)):
return installed_package
if self.upgrade.is_package_upgradeable(name) or self.utils.is_option(self.flag_reinstall, self.flags):
return True
def checksum(self) -> None:
""" Packages checksums. """

View file

@ -37,18 +37,18 @@ class Upgrade(Configs):
if self.is_package_upgradeable(inst_package):
yield inst_package
def is_package_upgradeable(self, package: str) -> bool:
def is_package_upgradeable(self, name: str) -> bool:
""" Checks for installed and upgradeable packages. """
inst_package: str = self.utils.is_package_installed(package)
inst_package: str = self.utils.is_package_installed(name)
inst_version: str = self.utils.split_binary_pkg(inst_package)[1]
inst_build: str = self.utils.split_binary_pkg(inst_package)[3]
if self.utils.is_option(self.flag_bin_repository, self.flags):
repo_package: str = BinQueries(package, self.repo).package_bin()
repo_version: str = BinQueries(package, self.repo).version()
repo_package: str = BinQueries(name, self.repo).package_bin()
repo_version: str = BinQueries(name, self.repo).version()
repo_build: str = self.utils.split_binary_pkg(repo_package)[3]
else:
repo_version: str = SBoQueries(package).version()
repo_build: str = self.utils.read_sbo_build_tag(package)
repo_version: str = SBoQueries(name).version()
repo_build: str = self.utils.read_sbo_build_tag(name)
return parse(repo_version + repo_build) > parse(inst_version + inst_build)