mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Updated for utilities
This commit is contained in:
parent
c0b361b4d2
commit
41fa486843
4 changed files with 7 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue