mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-16 07:47:35 +01:00
Updated to ignore blacklist installed packages
This commit is contained in:
parent
7c2f6aabf2
commit
d45adc6465
3 changed files with 13 additions and 3 deletions
|
@ -1,5 +1,9 @@
|
|||
## slpkg - ChangeLog
|
||||
|
||||
### 5.0.4 - 01/04/2024
|
||||
- Updated:
|
||||
* Updated to ignore blacklist installed packages
|
||||
|
||||
### 5.0.3 - 01/04/2024
|
||||
- Updated:
|
||||
* Updated for slpkg_new-configs and (D)iff command (Thanks to Marav)
|
||||
|
|
|
@ -30,10 +30,9 @@ class Check(Configs):
|
|||
def is_package_installed(self, packages: list) -> None:
|
||||
""" Checking for installed packages. """
|
||||
not_found: list = []
|
||||
blacklist_packages: list = self.utils.ignore_packages(packages)
|
||||
|
||||
for pkg in packages:
|
||||
if not self.utils.is_package_installed(pkg) or pkg in blacklist_packages:
|
||||
if not self.utils.is_package_installed(pkg):
|
||||
not_found.append(pkg)
|
||||
|
||||
if not_found:
|
||||
|
|
|
@ -25,21 +25,28 @@ class Utilities(Configs):
|
|||
def is_package_installed(self, name: str) -> str:
|
||||
""" Returns the installed package binary. """
|
||||
installed_package: Generator = self.log_packages.glob(f'{name}*')
|
||||
|
||||
for installed in installed_package:
|
||||
inst_name: str = self.split_package(installed.name)['name']
|
||||
if inst_name == name:
|
||||
if inst_name == name and inst_name not in self.ignore_packages([inst_name]):
|
||||
return installed.name
|
||||
return ''
|
||||
|
||||
def all_installed(self) -> dict:
|
||||
""" Return all installed packages from /val/log/packages folder. """
|
||||
installed_packages: dict = {}
|
||||
|
||||
for file in self.log_packages.glob('*'):
|
||||
name: str = self.split_package(file.name)['name']
|
||||
|
||||
if not name.startswith('.'):
|
||||
installed_packages[name] = file.name
|
||||
|
||||
blacklist_packages: list = self.ignore_packages(list(installed_packages.keys()))
|
||||
if blacklist_packages:
|
||||
for black in blacklist_packages:
|
||||
del installed_packages[black]
|
||||
|
||||
return installed_packages
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in a new issue