Updated for utilities

This commit is contained in:
Dimitris Zlatanidis 2023-04-07 13:10:28 +03:00
parent c0b361b4d2
commit 41fa486843
4 changed files with 7 additions and 17 deletions

View file

@ -1,3 +1,7 @@
4.7.7 - 07/04/2023
Updated:
- For utilities to improve speed
4.7.6 - 04/04/2023 4.7.6 - 04/04/2023
Fixed: Fixed:
- Upgrade packages with build numbers greater to >= 10 - Upgrade packages with build numbers greater to >= 10

View file

@ -25,7 +25,6 @@ class Blacklist(Configs):
def packages(self) -> list: def packages(self) -> list:
""" Reads the blacklist file. """ """ Reads the blacklist file. """
if self.blacklist_file_toml.is_file(): if self.blacklist_file_toml.is_file():
try: try:
with open(self.blacklist_file_toml, 'rb') as black: with open(self.blacklist_file_toml, 'rb') as black:

View file

@ -26,8 +26,6 @@ class Upgrade(Configs):
self.flag_bin_repository: list = ['-B', '--bin-repo='] self.flag_bin_repository: list = ['-B', '--bin-repo=']
self.repo_for_binaries: bool = self.utils.is_option(self.flag_bin_repository, self.flags) self.repo_for_binaries: bool = self.utils.is_option(self.flag_bin_repository, self.flags)
self.all_installed: list = self.utils.installed_package_names
logging.basicConfig(filename=str(LoggingConfig.log_file), logging.basicConfig(filename=str(LoggingConfig.log_file),
filemode='w', filemode='w',
encoding='utf-8', encoding='utf-8',
@ -41,7 +39,7 @@ class Upgrade(Configs):
repo_packages: list = list(SBoQueries('').sbos()) repo_packages: list = list(SBoQueries('').sbos())
# Returns the matched packages between two lists. # Returns the matched packages between two lists.
packages: list = list(set(self.all_installed) & set(repo_packages)) packages: list = list(set(self.utils.installed_package_names) & set(repo_packages))
for pkg in packages: for pkg in packages:

View file

@ -69,19 +69,8 @@ class Utilities:
def all_installed_names(self) -> Generator: def all_installed_names(self) -> Generator:
""" Return all installed packages names from /val/log/packages folder. """ """ Return all installed packages names from /val/log/packages folder. """
var_log_packages = Path(self.configs.log_packages) for package in self.installed_packages:
yield self.split_binary_pkg(package)[0]
try:
for file in var_log_packages.glob(self.configs.file_pattern):
name = self.split_binary_pkg(file.name)[0]
if not name.startswith('.') and name not in self.black.packages():
yield name
except ValueError as err:
logger = logging.getLogger(__name__)
logger.info('%s: %s: %s', self.__class__.__name__,
Utilities.all_installed_names.__name__,
err)
@staticmethod @staticmethod
def remove_file_if_exists(path: Path, file: str) -> None: def remove_file_if_exists(path: Path, file: str) -> None: