Fixed for blacklist

This commit is contained in:
Dimitris Zlatanidis 2022-06-18 19:35:09 +03:00
parent aa4197a27b
commit cd6995c3d5

View file

@ -7,6 +7,7 @@ import subprocess
from slpkg.metadata import Metadata from slpkg.metadata import Metadata
from dataclasses import dataclass from dataclasses import dataclass
from slpkg.blacklist import Blacklist
from slpkg.views.views import ViewMessage from slpkg.views.views import ViewMessage
from slpkg.models.models import LogsDependencies from slpkg.models.models import LogsDependencies
from slpkg.models.models import session as Session from slpkg.models.models import session as Session
@ -18,6 +19,7 @@ class RemovePackages:
packages: str packages: str
flags: list flags: list
session: str = Session session: str = Session
black: list = Blacklist()
log_packages: str = Metadata.log_packages log_packages: str = Metadata.log_packages
repo_tag: str = Metadata.repo_tag repo_tag: str = Metadata.repo_tag
removepkg: str = Metadata.removepkg removepkg: str = Metadata.removepkg
@ -73,7 +75,10 @@ class RemovePackages:
''' View and creates list with packages for remove. ''' ''' View and creates list with packages for remove. '''
installed = os.listdir(self.log_packages) installed = os.listdir(self.log_packages)
color = self.color() color = self.color()
for package in installed: for package in installed:
if package.startswith(name) and self.repo_tag in package: black = package.split('-')[0]
if (package.startswith(name) and self.repo_tag in package and
black not in self.black.get()):
self.installed_packages.append(package) self.installed_packages.append(package)
print(f'[{color["RED"]} delete {color["ENDC"]}] -> {package}') print(f'[{color["RED"]} delete {color["ENDC"]}] -> {package}')