diff --git a/ChangeLog.txt b/ChangeLog.txt index b60196ea..0250122e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.7.7 - 07/04/2023 +Updated: +- For utilities to improve speed + 4.7.6 - 04/04/2023 Fixed: - Upgrade packages with build numbers greater to >= 10 diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 242e06a6..68fb380b 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -25,7 +25,6 @@ class Blacklist(Configs): def packages(self) -> list: """ Reads the blacklist file. """ - if self.blacklist_file_toml.is_file(): try: with open(self.blacklist_file_toml, 'rb') as black: diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index 4eee8499..fc193174 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -26,8 +26,6 @@ class Upgrade(Configs): self.flag_bin_repository: list = ['-B', '--bin-repo='] 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), filemode='w', encoding='utf-8', @@ -41,7 +39,7 @@ class Upgrade(Configs): repo_packages: list = list(SBoQueries('').sbos()) # 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: diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 4abafb42..9d2ddcb1 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -69,19 +69,8 @@ class Utilities: def all_installed_names(self) -> Generator: """ Return all installed packages names from /val/log/packages folder. """ - var_log_packages = Path(self.configs.log_packages) - - 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) + for package in self.installed_packages: + yield self.split_binary_pkg(package)[0] @staticmethod def remove_file_if_exists(path: Path, file: str) -> None: