diff --git a/slpkg/binaries/install.py b/slpkg/binaries/install.py index fbd232f2..01060511 100644 --- a/slpkg/binaries/install.py +++ b/slpkg/binaries/install.py @@ -82,6 +82,12 @@ class Packages(Configs): if not self.utils.is_option(self.flag_resolve_off, self.flags): for pkg in self.packages: + + # Skip installed package when the option --skip-installed is applied. + if (self.utils.is_option(self.flag_skip_installed, self.flags) and + self.utils.is_package_installed(pkg)): + continue + self.packages_requires += Required(pkg, self.repo).resolve() # Clean dependencies from the dependencies list if already added with main packages. @@ -124,12 +130,18 @@ class Packages(Configs): and continue to install if the package is upgradable or the --reinstall option applied. """ - if self.utils.is_option(self.flag_skip_installed, self.flags): + if (self.utils.is_option(self.flag_skip_installed, self.flags) + and not self.utils.is_option(self.flag_reinstall, self.flags)): return False - if self.upgrade.is_package_upgradeable(name) or self.utils.is_option(self.flag_reinstall, self.flags): + if self.utils.is_option(self.flag_reinstall, self.flags): return True + if not self.upgrade.is_package_upgradeable(name): + return False + + return True + def checksum(self) -> None: """ Packages checksums. """ md5 = Md5sum(self.flags)