From 27b896ca5f72b3c31db1979a2b796cbd3187102c Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 12 Apr 2023 22:47:50 +0300 Subject: [PATCH 01/37] Updated for blacklist pattern --- ChangeLog.txt | 4 ++++ slpkg/binaries/queries.py | 8 ++++---- slpkg/binaries/required.py | 6 +++--- slpkg/checks.py | 4 +--- slpkg/sbos/dependencies.py | 6 +++--- slpkg/sbos/queries.py | 17 +++-------------- slpkg/tracking.py | 4 +--- slpkg/utilities.py | 37 ++++++++++++++++++++----------------- slpkg/views/views.py | 7 +++---- 9 files changed, 42 insertions(+), 51 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 89107a72..aea461f2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.7.8 - 12/04/203 +Added: +- Module to support for Unix shell-style wildcards for blacklist + 4.7.7 - 07/04/2023 Updated: - Improve speed (Replace multi SQL queries) diff --git a/slpkg/binaries/queries.py b/slpkg/binaries/queries.py index 1287dd20..df065057 100644 --- a/slpkg/binaries/queries.py +++ b/slpkg/binaries/queries.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -from slpkg.blacklist import Blacklist +from slpkg.utilities import Utilities from slpkg.models.models import BinariesTable from slpkg.models.models import session as Session @@ -14,7 +14,7 @@ class BinQueries: self.repo: str = repo self.session = Session - self.black = Blacklist() + self.utils = Utilities() def repository_data(self) -> dict: """ Returns a dictionary with the repository data. """ @@ -36,7 +36,7 @@ class BinQueries: data.checksum, data.repo) for data in repository_data - if data.name not in self.black.packages() + if not self.utils.blacklist_pattern(data.name) } return repos_dict @@ -60,7 +60,7 @@ class BinQueries: data.checksum, data.repo) for data in repositories_data - if data.name not in self.black.packages() + if not self.utils.blacklist_pattern(data.name) } return repos_dict diff --git a/slpkg/binaries/required.py b/slpkg/binaries/required.py index c322b0dc..9877c538 100644 --- a/slpkg/binaries/required.py +++ b/slpkg/binaries/required.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -from slpkg.blacklist import Blacklist +from slpkg.utilities import Utilities from slpkg.repositories import Repositories @@ -15,7 +15,7 @@ class Required: self.name: str = name self.repo: str = repo self.repos = Repositories() - self.black = Blacklist() + self.utils = Utilities() self.special_repos: list = [ self.repos.salixos_repo_name, @@ -40,7 +40,7 @@ class Required: # Remove requirements that are included as dependencies, # but are not included in the repository. - if req not in list(self.data.keys()) or req in self.black.packages(): + if req not in list(self.data.keys()) or self.utils.blacklist_pattern(req): required.remove(req) continue diff --git a/slpkg/checks.py b/slpkg/checks.py index f09350d7..3f784da7 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -4,7 +4,6 @@ from pathlib import Path from slpkg.configs import Configs -from slpkg.blacklist import Blacklist from slpkg.utilities import Utilities from slpkg.repositories import Repositories from slpkg.models.models import session as Session @@ -21,7 +20,6 @@ class Check(Configs): self.flags: list = flags self.data: dict = data - self.black = Blacklist() self.utils = Utilities() self.repos = Repositories() @@ -82,7 +80,7 @@ class Check(Configs): blacklist: list = [] for pkg in package: - if pkg in self.black.packages(): + if self.utils.blacklist_pattern(pkg): blacklist.append(pkg) if blacklist: diff --git a/slpkg/sbos/dependencies.py b/slpkg/sbos/dependencies.py index 6ee571ec..6536c713 100644 --- a/slpkg/sbos/dependencies.py +++ b/slpkg/sbos/dependencies.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -from slpkg.blacklist import Blacklist +from slpkg.utilities import Utilities class Requires: @@ -13,7 +13,7 @@ class Requires: self.data: dict = data self.name: str = name - self.black = Blacklist() + self.utils = Utilities() def resolve(self) -> list: """ Resolve the dependencies. """ @@ -23,7 +23,7 @@ class Requires: # Remove requirements that are included as dependencies, # but are not included in the repository. - if req not in list(self.data.keys()) or req in self.black.packages(): + if req not in list(self.data.keys()) or self.utils.blacklist_pattern(req): requires.remove(req) continue diff --git a/slpkg/sbos/queries.py b/slpkg/sbos/queries.py index b7ae45f8..2d280f2d 100644 --- a/slpkg/sbos/queries.py +++ b/slpkg/sbos/queries.py @@ -1,10 +1,8 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -from sqlalchemy import inspect - from slpkg.configs import Configs -from slpkg.blacklist import Blacklist +from slpkg.utilities import Utilities from slpkg.repositories import Repositories from slpkg.models.models import session as Session from slpkg.models.models import SBoTable, PonceTable @@ -18,7 +16,7 @@ class SBoQueries(Configs): self.session = Session self.repos = Repositories() - self.black = Blacklist() + self.utils = Utilities() # Switch between sbo and ponce repository. self.sbo_table = SBoTable @@ -40,7 +38,7 @@ class SBoQueries(Configs): data.requires, data.short_description) for data in repository_data - if data.name not in self.black.packages() + if not self.utils.blacklist_pattern(data.name) } return repos_dict @@ -51,12 +49,3 @@ class SBoQueries(Configs): self.sbo_table.id).count() return count - - def repo_name(self) -> str: - """ Returns the repo name by the table. """ - table = inspect(self.sbo_table) - repo = self.repos.sbo_repo_name - if table.tables[0].name == 'poncetable': - repo = self.repos.ponce_repo_name - - return repo diff --git a/slpkg/tracking.py b/slpkg/tracking.py index 6d0999cd..f4dfbcb8 100644 --- a/slpkg/tracking.py +++ b/slpkg/tracking.py @@ -4,7 +4,6 @@ from slpkg.configs import Configs from slpkg.views.ascii import Ascii from slpkg.utilities import Utilities -from slpkg.blacklist import Blacklist class Tracking(Configs): @@ -18,7 +17,6 @@ class Tracking(Configs): self.ascii = Ascii() self.color = self.colour() self.utils = Utilities() - self.black = Blacklist() self.llc: str = self.ascii.lower_left_corner self.hl: str = self.ascii.horizontal_line @@ -69,7 +67,7 @@ class Tracking(Configs): print(f' {self.cyan}No dependencies{self.endc}') else: for i, req in enumerate(requires, start=1): - if req not in self.black.packages(): + if not self.utils.blacklist_pattern(req): require: str = f'{self.cyan}{req}{self.endc}' diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 9662523b..703b5319 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -5,6 +5,7 @@ import re import time import shutil import logging +import fnmatch import subprocess from pathlib import Path from typing import Generator, Union @@ -31,8 +32,7 @@ class Utilities: self.endc: str = self.color['endc'] self.bred: str = f'{self.bold}{self.red}' - self.installed_packages: list = list(self.all_installed()) - self.installed_package_names: list = list(self.all_installed_names()) + self.installed_packages: dict = dict(self.all_installed()) logging.basicConfig(filename=LoggingConfig.log_file, filemode='w', @@ -41,34 +41,29 @@ class Utilities: def is_package_installed(self, name: str) -> str: """ Returns the installed package name. """ - for package in self.installed_packages: - pkg_name: str = self.split_binary_pkg(package)[0] + try: + return self.installed_packages[name] + except KeyError: + return '' - if pkg_name == name: - return package - - return '' - - def all_installed(self) -> Generator: + def all_installed(self) -> dict: """ Return all installed packages from /val/log/packages folder. """ + # installed_dict: dict = {} var_log_packages: Path = 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 file.name + if not name.startswith('.') and not self.blacklist_pattern(name): + yield name, file.name + + # return installed_dict except ValueError as err: logger = logging.getLogger(__name__) logger.info('%s: %s: %s', self.__class__.__name__, Utilities.all_installed.__name__, err) - def all_installed_names(self) -> Generator: - """ Return all installed packages names from /val/log/packages folder. """ - for package in self.installed_packages: - yield self.split_binary_pkg(package)[0] - @staticmethod def remove_file_if_exists(path: Path, file: str) -> None: """ Clean the old files. """ @@ -196,3 +191,11 @@ class Utilities: packages += list(data.keys()) return packages + + def blacklist_pattern(self, name): + """ This module provides support for Unix shell-style wildcards. """ + if [ + black for black in self.black.packages() + if fnmatch.fnmatch(name, black) + ]: + return True diff --git a/slpkg/views/views.py b/slpkg/views/views.py index 9d2e8c7e..e027be5d 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -10,7 +10,6 @@ from slpkg.upgrade import Upgrade from slpkg.views.ascii import Ascii from slpkg.utilities import Utilities from slpkg.dialog_box import DialogBox -from slpkg.sbos.queries import SBoQueries from slpkg.repositories import Repositories from slpkg.models.models import LogsDependencies from slpkg.models.models import session as Session @@ -65,7 +64,7 @@ class ViewMessage(Configs): repo: str = self.repo else: version: str = self.data[package][2] - repo: str = SBoQueries().repo_name() + repo: str = self.repos.sbo_enabled_repository if mode in ['install', 'download']: color: str = self.cyan @@ -75,13 +74,13 @@ class ViewMessage(Configs): color: str = self.violet # If the package is installed and change the color to gray. - if package in self.utils.installed_package_names and mode == 'install': + if package in self.utils.installed_packages.keys() and mode == 'install': color: str = self.grey if self.upgrade.is_package_upgradeable(package) and mode == 'install': color: str = self.violet - if (package in self.utils.installed_package_names and mode == 'install' + if (package in self.utils.installed_packages.keys() and mode == 'install' and self.option_for_reinstall): color: str = self.violet From 8af2431f286384f5889d8b57b8cef81bdad877ce Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 12 Apr 2023 22:56:26 +0300 Subject: [PATCH 02/37] Removed unused --- slpkg/checks.py | 11 ----------- slpkg/main.py | 1 - 2 files changed, 12 deletions(-) diff --git a/slpkg/checks.py b/slpkg/checks.py index 3f784da7..19b3c6b4 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -75,17 +75,6 @@ class Check(Configs): if not_found: self.utils.raise_error_message(f'Not found \'{", ".join(not_found)}\' installed packages') - def is_blacklist(self, package: list) -> None: - """ Checking if the packages are blacklisted. """ - blacklist: list = [] - - for pkg in package: - if self.utils.blacklist_pattern(pkg): - blacklist.append(pkg) - - if blacklist: - self.utils.raise_error_message(f"The packages '{', '.join(blacklist)}' is blacklisted") - def is_empty_database(self) -> None: """ Checking for empty table and database file. """ db = Path(self.db_path, self.database_name) diff --git a/slpkg/main.py b/slpkg/main.py index 27450fcf..d32014e4 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -290,7 +290,6 @@ class Argparse(Configs): self.data: dict = SBoQueries().repository_data() self.check = Check(self.flags, self.data) - self.check.is_blacklist(self.args[1:]) logging.basicConfig(filename=LoggingConfig.log_file, filemode='w', From b3410f944f8ce7cf068d786909671423bd4c7cdd Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 12 Apr 2023 23:15:19 +0300 Subject: [PATCH 03/37] Updated toml files --- configs/blacklist.toml | 16 +- configs/repositories.toml | 346 +++++++++++++++++++------------------- configs/slpkg.toml | 110 ++++++------ 3 files changed, 239 insertions(+), 233 deletions(-) diff --git a/configs/blacklist.toml b/configs/blacklist.toml index ef083025..c7487498 100644 --- a/configs/blacklist.toml +++ b/configs/blacklist.toml @@ -1,7 +1,13 @@ [BLACKLIST] +# Add packages and separate them with commas. - # Add packages and separate them with commas. - # Example: ["package_1", "package_2", "package_3"]. - # The "%README%" is part of REQUIRES indicating that important - # informationabout dependencies is available in the README file. - PACKAGES = ["%README%"] +# Support for Unix shell-style wildcards: +# '*' matches everything +# '?' matches any single character +# '[seq]' matches any character in seq +# '[!seq]' matches any character not in seq +# See: https://docs.python.org/3.9/library/fnmatch.html + +# Example: ["package", "package*", "[package]"]. + +PACKAGES = [] diff --git a/configs/repositories.toml b/configs/repositories.toml index 098b414b..89b87807 100644 --- a/configs/repositories.toml +++ b/configs/repositories.toml @@ -15,193 +15,193 @@ [REPOSITORIES] - # SBo Repository for Slackware 15.0 stable. - SBO_REPO_NAME = "sbo" - SBO_REPO_MIRROR = "https://slackbuilds.org/slackbuilds/15.0/" - SBO_REPO_SLACKBUILDS = "SLACKBUILDS.TXT" - SBO_REPO_CHANGELOG = "ChangeLog.txt" - SBO_REPO_TAR_SUFFIX = ".tar.gz" - SBO_REPO_TAG = "_SBo" # Default repo TAG. - SBO_REPO_PATCH_TAG = "" # Patch the TAG. +# SBo Repository for Slackware 15.0 stable. +SBO_REPO_NAME = "sbo" +SBO_REPO_MIRROR = "https://slackbuilds.org/slackbuilds/15.0/" +SBO_REPO_SLACKBUILDS = "SLACKBUILDS.TXT" +SBO_REPO_CHANGELOG = "ChangeLog.txt" +SBO_REPO_TAR_SUFFIX = ".tar.gz" +SBO_REPO_TAG = "_SBo" # Default repo TAG. +SBO_REPO_PATCH_TAG = "" # Patch the TAG. - # Ponce Repository for Slackware -current. - PONCE_REPO = false - PONCE_REPO_NAME = "ponce" - PONCE_REPO_MIRROR = "https://cgit.ponce.cc/slackbuilds/plain/" - PONCE_REPO_SLACKBUILDS = "SLACKBUILDS.TXT" - PONCE_REPO_CHANGELOG = "ChangeLog.txt" - PONCE_REPO_TAG = "_SBo" # Default repo TAG. - PONCE_REPO_PATCH_TAG = "" # Patch the TAG. +# Ponce Repository for Slackware -current. +PONCE_REPO = false +PONCE_REPO_NAME = "ponce" +PONCE_REPO_MIRROR = "https://cgit.ponce.cc/slackbuilds/plain/" +PONCE_REPO_SLACKBUILDS = "SLACKBUILDS.TXT" +PONCE_REPO_CHANGELOG = "ChangeLog.txt" +PONCE_REPO_TAG = "_SBo" # Default repo TAG. +PONCE_REPO_PATCH_TAG = "" # Patch the TAG. - # Official repository for Slackware x86_64 15.0 stable. - # For Slackware x86_64 -current: - # https://slackware.uk/slackware/slackware64-current/ - SLACK_REPO = false - SLACK_REPO_NAME = "slack" - SLACK_REPO_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/" - SLACK_REPO_PACKAGES = "PACKAGES.TXT" - SLACK_REPO_CHECKSUMS = "CHECKSUMS.md5" - SLACK_REPO_CHANGELOG = "ChangeLog.txt" - SLACK_REPO_TAG = "" +# Official repository for Slackware x86_64 15.0 stable. +# For Slackware x86_64 -current: +# https://slackware.uk/slackware/slackware64-current/ +SLACK_REPO = false +SLACK_REPO_NAME = "slack" +SLACK_REPO_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/" +SLACK_REPO_PACKAGES = "PACKAGES.TXT" +SLACK_REPO_CHECKSUMS = "CHECKSUMS.md5" +SLACK_REPO_CHANGELOG = "ChangeLog.txt" +SLACK_REPO_TAG = "" - # Official repository for Slackware patches x86_64 15.0 stable. - # For Slackware patches x86_64 -current: - # https://slackware.uk/slackware/slackware64-current/extra/ - SLACK_EXTRA_REPO = false - SLACK_EXTRA_REPO_NAME = "slack_extra" - SLACK_EXTRA_REPO_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/" - SLACK_EXTRA_REPO_PACKAGES_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/extra/" - SLACK_EXTRA_REPO_PACKAGES = "PACKAGES.TXT" - SLACK_EXTRA_REPO_CHECKSUMS = "CHECKSUMS.md5" - SLACK_EXTRA_REPO_CHANGELOG = "ChangeLog.txt" - SLACK_EXTRA_REPO_TAG = "" +# Official repository for Slackware patches x86_64 15.0 stable. +# For Slackware patches x86_64 -current: +# https://slackware.uk/slackware/slackware64-current/extra/ +SLACK_EXTRA_REPO = false +SLACK_EXTRA_REPO_NAME = "slack_extra" +SLACK_EXTRA_REPO_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/" +SLACK_EXTRA_REPO_PACKAGES_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/extra/" +SLACK_EXTRA_REPO_PACKAGES = "PACKAGES.TXT" +SLACK_EXTRA_REPO_CHECKSUMS = "CHECKSUMS.md5" +SLACK_EXTRA_REPO_CHANGELOG = "ChangeLog.txt" +SLACK_EXTRA_REPO_TAG = "" - # Official repository for Slackware patches x86_64 15.0 stable. - # For Slackware patches x86_64 -current: - # https://slackware.uk/slackware/slackware64-current/patches/ - SLACK_PATCHES_REPO = false - SLACK_PATCHES_REPO_NAME = "slack_patches" - SLACK_PATCHES_REPO_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/" - SLACK_PATCHES_REPO_PACKAGES_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/patches/" - SLACK_PATCHES_REPO_PACKAGES = "PACKAGES.TXT" - SLACK_PATCHES_REPO_CHECKSUMS = "CHECKSUMS.md5" - SLACK_PATCHES_REPO_CHANGELOG = "ChangeLog.txt" - SLACK_PATCHES_REPO_TAG = "" +# Official repository for Slackware patches x86_64 15.0 stable. +# For Slackware patches x86_64 -current: +# https://slackware.uk/slackware/slackware64-current/patches/ +SLACK_PATCHES_REPO = false +SLACK_PATCHES_REPO_NAME = "slack_patches" +SLACK_PATCHES_REPO_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/" +SLACK_PATCHES_REPO_PACKAGES_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/patches/" +SLACK_PATCHES_REPO_PACKAGES = "PACKAGES.TXT" +SLACK_PATCHES_REPO_CHECKSUMS = "CHECKSUMS.md5" +SLACK_PATCHES_REPO_CHANGELOG = "ChangeLog.txt" +SLACK_PATCHES_REPO_TAG = "" - # AlienBob Repository for Slackware x86_64 15.0 stable. - # For Slackware x86_64 -current: - # http://slackware.uk/people/alien/sbrepos/current/x86_64/ - ALIEN_REPO = false - ALIEN_REPO_NAME = "alien" - ALIEN_REPO_MIRROR = "https://slackware.nl/people/alien/sbrepos/" - ALIEN_REPO_PACKAGES_MIRROR = "https://slackware.nl/people/alien/sbrepos/15.0/x86_64/" - ALIEN_REPO_PACKAGES = "PACKAGES.TXT" - ALIEN_REPO_CHECKSUMS = "CHECKSUMS.md5" - ALIEN_REPO_CHANGELOG = "ChangeLog.txt" - ALIEN_REPO_TAG = "alien" +# AlienBob Repository for Slackware x86_64 15.0 stable. +# For Slackware x86_64 -current: +# http://slackware.uk/people/alien/sbrepos/current/x86_64/ +ALIEN_REPO = false +ALIEN_REPO_NAME = "alien" +ALIEN_REPO_MIRROR = "https://slackware.nl/people/alien/sbrepos/" +ALIEN_REPO_PACKAGES_MIRROR = "https://slackware.nl/people/alien/sbrepos/15.0/x86_64/" +ALIEN_REPO_PACKAGES = "PACKAGES.TXT" +ALIEN_REPO_CHECKSUMS = "CHECKSUMS.md5" +ALIEN_REPO_CHANGELOG = "ChangeLog.txt" +ALIEN_REPO_TAG = "alien" - # Multilib Repository for Slackware x86_64 15.0 stable. - # For Slackware x86_64 -current: - # https://slackware.nl/people/alien/multilib/current/ - MULTILIB_REPO = false - MULTILIB_REPO_NAME = "multilib" - MULTILIB_REPO_MIRROR = "https://slackware.nl/people/alien/multilib/" - MULTILIB_REPO_PACKAGES_MIRROR = "https://slackware.nl/people/alien/multilib/15.0/" - MULTILIB_REPO_PACKAGES = "PACKAGES.TXT" - MULTILIB_REPO_CHECKSUMS = "CHECKSUMS.md5" - MULTILIB_REPO_CHANGELOG = "ChangeLog.txt" - MULTILIB_REPO_TAG = "alien" +# Multilib Repository for Slackware x86_64 15.0 stable. +# For Slackware x86_64 -current: +# https://slackware.nl/people/alien/multilib/current/ +MULTILIB_REPO = false +MULTILIB_REPO_NAME = "multilib" +MULTILIB_REPO_MIRROR = "https://slackware.nl/people/alien/multilib/" +MULTILIB_REPO_PACKAGES_MIRROR = "https://slackware.nl/people/alien/multilib/15.0/" +MULTILIB_REPO_PACKAGES = "PACKAGES.TXT" +MULTILIB_REPO_CHECKSUMS = "CHECKSUMS.md5" +MULTILIB_REPO_CHANGELOG = "ChangeLog.txt" +MULTILIB_REPO_TAG = "alien" - # Restricted Repository for Slackware x86_64 15.0 stable. - # For Slackware x86_64 -current: - # https://slackware.nl/people/alien/restricted_sbrepos/current/x86_64/ - RESTRICTED_REPO = false - RESTRICTED_REPO_NAME = "restricted" - RESTRICTED_REPO_MIRROR = "https://slackware.nl/people/alien/restricted_sbrepos/" - RESTRICTED_REPO_PACKAGES_MIRROR = "https://slackware.nl/people/alien/restricted_sbrepos/15.0/x86_64/" - RESTRICTED_REPO_PACKAGES = "PACKAGES.TXT" - RESTRICTED_REPO_CHECKSUMS = "CHECKSUMS.md5" - RESTRICTED_REPO_CHANGELOG = "ChangeLog.txt" - RESTRICTED_REPO_TAG = "alien" +# Restricted Repository for Slackware x86_64 15.0 stable. +# For Slackware x86_64 -current: +# https://slackware.nl/people/alien/restricted_sbrepos/current/x86_64/ +RESTRICTED_REPO = false +RESTRICTED_REPO_NAME = "restricted" +RESTRICTED_REPO_MIRROR = "https://slackware.nl/people/alien/restricted_sbrepos/" +RESTRICTED_REPO_PACKAGES_MIRROR = "https://slackware.nl/people/alien/restricted_sbrepos/15.0/x86_64/" +RESTRICTED_REPO_PACKAGES = "PACKAGES.TXT" +RESTRICTED_REPO_CHECKSUMS = "CHECKSUMS.md5" +RESTRICTED_REPO_CHANGELOG = "ChangeLog.txt" +RESTRICTED_REPO_TAG = "alien" - # Gnome Repository for Slackware x86_64 15.0 stable. - # For Slackware x86_64 -current: - # https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/ - GNOME_REPO = false - GNOME_REPO_NAME = "gnome" - GNOME_REPO_MIRROR = "https://reddoglinux.ddns.net/linux/gnome/41.x/x86_64/" - GNOME_REPO_PACKAGES = "PACKAGES.TXT" - GNOME_REPO_CHECKSUMS = "CHECKSUMS.md5" - GNOME_REPO_CHANGELOG = "ChangeLog.txt" - GNOME_REPO_TAG = "gfs" +# Gnome Repository for Slackware x86_64 15.0 stable. +# For Slackware x86_64 -current: +# https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/ +GNOME_REPO = false +GNOME_REPO_NAME = "gnome" +GNOME_REPO_MIRROR = "https://reddoglinux.ddns.net/linux/gnome/41.x/x86_64/" +GNOME_REPO_PACKAGES = "PACKAGES.TXT" +GNOME_REPO_CHECKSUMS = "CHECKSUMS.md5" +GNOME_REPO_CHANGELOG = "ChangeLog.txt" +GNOME_REPO_TAG = "gfs" - # MATE Repository for Slackware x86_64 15.0 stable. - # For Slackware x86_64 -current: - # https://slackware.uk/msb/current/1.26/x86_64/ - MSB_REPO = false - MSB_REPO_NAME = "msb" - MSB_REPO_MIRROR = "https://slackware.uk/msb/" - MSB_REPO_PACKAGES_MIRROR = 'https://slackware.uk/msb/15.0/1.26/x86_64/' - MSB_REPO_PACKAGES = "PACKAGES.TXT" - MSB_REPO_CHECKSUMS = "CHECKSUMS.md5" - MSB_REPO_CHANGELOG = "ChangeLog.txt" - MSB_REPO_TAG = "msb" +# MATE Repository for Slackware x86_64 15.0 stable. +# For Slackware x86_64 -current: +# https://slackware.uk/msb/current/1.26/x86_64/ +MSB_REPO = false +MSB_REPO_NAME = "msb" +MSB_REPO_MIRROR = "https://slackware.uk/msb/" +MSB_REPO_PACKAGES_MIRROR = 'https://slackware.uk/msb/15.0/1.26/x86_64/' +MSB_REPO_PACKAGES = "PACKAGES.TXT" +MSB_REPO_CHECKSUMS = "CHECKSUMS.md5" +MSB_REPO_CHANGELOG = "ChangeLog.txt" +MSB_REPO_TAG = "msb" - # Cinnamon Repository for Slackware x86_64 15.0 stable. - # For Slackware x86_64 -current: - # https://slackware.uk/csb/current/x86_64/ - CSB_REPO = false - CSB_REPO_NAME = "csb" - CSB_REPO_MIRROR = "https://slackware.uk/csb/" - CSB_REPO_PACKAGES_MIRROR = 'https://slackware.uk/csb/15.0/x86_64/' - CSB_REPO_PACKAGES = "PACKAGES.TXT" - CSB_REPO_CHECKSUMS = "CHECKSUMS.md5" - CSB_REPO_CHANGELOG = "ChangeLog.txt" - CSB_REPO_TAG = "csb" +# Cinnamon Repository for Slackware x86_64 15.0 stable. +# For Slackware x86_64 -current: +# https://slackware.uk/csb/current/x86_64/ +CSB_REPO = false +CSB_REPO_NAME = "csb" +CSB_REPO_MIRROR = "https://slackware.uk/csb/" +CSB_REPO_PACKAGES_MIRROR = 'https://slackware.uk/csb/15.0/x86_64/' +CSB_REPO_PACKAGES = "PACKAGES.TXT" +CSB_REPO_CHECKSUMS = "CHECKSUMS.md5" +CSB_REPO_CHANGELOG = "ChangeLog.txt" +CSB_REPO_TAG = "csb" - # Conraid Repository for Slackware x86_64 -current. - CONRAID_REPO = false - CONRAID_REPO_NAME = "conraid" - CONRAID_REPO_MIRROR = "https://slack.conraid.net/repository/slackware64-current/" - CONRAID_REPO_PACKAGES = "PACKAGES.TXT" - CONRAID_REPO_CHECKSUMS = "CHECKSUMS.md5" - CONRAID_REPO_CHANGELOG = "ChangeLog.txt" - CONRAID_REPO_TAG = "cf" +# Conraid Repository for Slackware x86_64 -current. +CONRAID_REPO = false +CONRAID_REPO_NAME = "conraid" +CONRAID_REPO_MIRROR = "https://slack.conraid.net/repository/slackware64-current/" +CONRAID_REPO_PACKAGES = "PACKAGES.TXT" +CONRAID_REPO_CHECKSUMS = "CHECKSUMS.md5" +CONRAID_REPO_CHANGELOG = "ChangeLog.txt" +CONRAID_REPO_TAG = "cf" - # Slackonly Repository for Slackware x86_64 15.0 stable. - # For Slackware x86_64 -current: - # https://packages.slackonly.com/pub/packages/current-x86_64/ - SLACKONLY_REPO = false - SLACKONLY_REPO_NAME = "slackonly" - SLACKONLY_REPO_MIRROR = "https://packages.slackonly.com/pub/packages/15.0-x86_64/" - SLACKONLY_REPO_PACKAGES = "PACKAGES.TXT" - SLACKONLY_REPO_CHECKSUMS = "CHECKSUMS.md5" - SLACKONLY_REPO_CHANGELOG = "ChangeLog.txt" - SLACKONLY_REPO_TAG = "slonly" +# Slackonly Repository for Slackware x86_64 15.0 stable. +# For Slackware x86_64 -current: +# https://packages.slackonly.com/pub/packages/current-x86_64/ +SLACKONLY_REPO = false +SLACKONLY_REPO_NAME = "slackonly" +SLACKONLY_REPO_MIRROR = "https://packages.slackonly.com/pub/packages/15.0-x86_64/" +SLACKONLY_REPO_PACKAGES = "PACKAGES.TXT" +SLACKONLY_REPO_CHECKSUMS = "CHECKSUMS.md5" +SLACKONLY_REPO_CHANGELOG = "ChangeLog.txt" +SLACKONLY_REPO_TAG = "slonly" - # Repository for Salix OS x86_64 15.0 stable. - SALIXOS_REPO = false - SALIXOS_REPO_NAME = "salixos" - SALIXOS_REPO_MIRROR = "https://download.salixos.org/x86_64/slackware-15.0/" - SALIXOS_REPO_PACKAGES = "PACKAGES.TXT" - SALIXOS_REPO_CHECKSUMS = "CHECKSUMS.md5" - SALIXOS_REPO_CHANGELOG = "ChangeLog.txt" - SALIXOS_REPO_TAG = "" +# Repository for Salix OS x86_64 15.0 stable. +SALIXOS_REPO = false +SALIXOS_REPO_NAME = "salixos" +SALIXOS_REPO_MIRROR = "https://download.salixos.org/x86_64/slackware-15.0/" +SALIXOS_REPO_PACKAGES = "PACKAGES.TXT" +SALIXOS_REPO_CHECKSUMS = "CHECKSUMS.md5" +SALIXOS_REPO_CHANGELOG = "ChangeLog.txt" +SALIXOS_REPO_TAG = "" - # Repository for Salix OS x86_64 15.0 stable. - SALIXOS_EXTRA_REPO = false - SALIXOS_EXTRA_REPO_NAME = "salixos_extra" - SALIXOS_EXTRA_REPO_MIRROR = "https://download.salixos.org/x86_64/slackware-15.0/" - SALIXOS_EXTRA_REPO_PACKAGES_MIRROR = 'https://download.salixos.org/x86_64/slackware-15.0/extra/' - SALIXOS_EXTRA_REPO_PACKAGES = "PACKAGES.TXT" - SALIXOS_EXTRA_REPO_CHECKSUMS = "CHECKSUMS.md5" - SALIXOS_EXTRA_REPO_CHANGELOG = "ChangeLog.txt" - SALIXOS_EXTRA_REPO_TAG = "" +# Repository for Salix OS x86_64 15.0 stable. +SALIXOS_EXTRA_REPO = false +SALIXOS_EXTRA_REPO_NAME = "salixos_extra" +SALIXOS_EXTRA_REPO_MIRROR = "https://download.salixos.org/x86_64/slackware-15.0/" +SALIXOS_EXTRA_REPO_PACKAGES_MIRROR = 'https://download.salixos.org/x86_64/slackware-15.0/extra/' +SALIXOS_EXTRA_REPO_PACKAGES = "PACKAGES.TXT" +SALIXOS_EXTRA_REPO_CHECKSUMS = "CHECKSUMS.md5" +SALIXOS_EXTRA_REPO_CHANGELOG = "ChangeLog.txt" +SALIXOS_EXTRA_REPO_TAG = "" - # Repository for Salix OS x86_64 15.0 stable. - SALIXOS_PATCHES_REPO = false - SALIXOS_PATCHES_REPO_NAME = "salixos_patches" - SALIXOS_PATCHES_REPO_MIRROR = "https://download.salixos.org/x86_64/slackware-15.0/" - SALIXOS_PATCHES_REPO_PACKAGES_MIRROR = 'https://download.salixos.org/x86_64/slackware-15.0/patches/' - SALIXOS_PATCHES_REPO_PACKAGES = "PACKAGES.TXT" - SALIXOS_PATCHES_REPO_CHECKSUMS = "CHECKSUMS.md5" - SALIXOS_PATCHES_REPO_CHANGELOG = "ChangeLog.txt" - SALIXOS_PATCHES_REPO_TAG = "_slack15.0" +# Repository for Salix OS x86_64 15.0 stable. +SALIXOS_PATCHES_REPO = false +SALIXOS_PATCHES_REPO_NAME = "salixos_patches" +SALIXOS_PATCHES_REPO_MIRROR = "https://download.salixos.org/x86_64/slackware-15.0/" +SALIXOS_PATCHES_REPO_PACKAGES_MIRROR = 'https://download.salixos.org/x86_64/slackware-15.0/patches/' +SALIXOS_PATCHES_REPO_PACKAGES = "PACKAGES.TXT" +SALIXOS_PATCHES_REPO_CHECKSUMS = "CHECKSUMS.md5" +SALIXOS_PATCHES_REPO_CHANGELOG = "ChangeLog.txt" +SALIXOS_PATCHES_REPO_TAG = "_slack15.0" - # Repository for Slackel OS x86_64 -current. - SLACKEL_REPO = false - SLACKEL_REPO_NAME = "slackel" - SLACKEL_REPO_MIRROR = "http://www.slackel.gr/repo/x86_64/current/" - SLACKEL_REPO_PACKAGES = "PACKAGES.TXT" - SLACKEL_REPO_CHECKSUMS = "CHECKSUMS.md5" - SLACKEL_REPO_CHANGELOG = "ChangeLog.txt" - SLACKEL_REPO_TAG = "dj" +# Repository for Slackel OS x86_64 -current. +SLACKEL_REPO = false +SLACKEL_REPO_NAME = "slackel" +SLACKEL_REPO_MIRROR = "http://www.slackel.gr/repo/x86_64/current/" +SLACKEL_REPO_PACKAGES = "PACKAGES.TXT" +SLACKEL_REPO_CHECKSUMS = "CHECKSUMS.md5" +SLACKEL_REPO_CHANGELOG = "ChangeLog.txt" +SLACKEL_REPO_TAG = "dj" - # Slint Repository for Slackware x86_64 15.0 stable. - SLINT_REPO = false - SLINT_REPO_NAME = "slint" - SLINT_REPO_MIRROR = "https://slackware.uk/slint/x86_64/slint-15.0/" - SLINT_REPO_PACKAGES = "PACKAGES.TXT" - SLINT_REPO_CHECKSUMS = "CHECKSUMS.md5" - SLINT_REPO_CHANGELOG = "ChangeLog.txt" - SLINT_REPO_TAG = "slint" +# Slint Repository for Slackware x86_64 15.0 stable. +SLINT_REPO = false +SLINT_REPO_NAME = "slint" +SLINT_REPO_MIRROR = "https://slackware.uk/slint/x86_64/slint-15.0/" +SLINT_REPO_PACKAGES = "PACKAGES.TXT" +SLINT_REPO_CHECKSUMS = "CHECKSUMS.md5" +SLINT_REPO_CHANGELOG = "ChangeLog.txt" +SLINT_REPO_TAG = "slint" diff --git a/configs/slpkg.toml b/configs/slpkg.toml index 27112ab1..1683b30b 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -1,58 +1,58 @@ [CONFIGS] - # OS architecture by default. - OS_ARCH = "x86_64" - # Where the packages download. - # This path working only with the command download. - DOWNLOAD_ONLY_PATH = "/tmp/slpkg/" - # File suffix for list packages. - # Change here if you are going to use '.sqf' files. - FILE_LIST_SUFFIX = ".pkgs" - # Configs for displaying colorful menu. Default is true. [true/false] - COLORS = true - # Dialog is a program that will let you present a variety of questions or - # display messages using dialog boxes from a shell script. - # Default is true. [true/false] - DIALOG = true - # If silent mode is true, it does not print the commands as they are executed. - # Default is true. [true/false] - SILENT_MODE = true - # Choose ascii printable characters. - # If true, it uses the extended characters, otherwise the basic ones. - # Default is true. [true/false]. - ASCII_CHARACTERS = true - # Set false to all the questions. If set false, option --yes will not work. - # Default is true. [true/false]. - ASK_QUESTION = true - # Download sources in parallel. Default is false. [true/false] - PARALLEL_DOWNLOADS = false - # Pass your file pattern here, if you want to work only with 'sbo' packages - # add '*_SBo' pattern. Default is the '*'. - FILE_PATTERN = "*" - # There are 5 predefined spinners for the progress bar. - # Default is pixel. [spinner/pie/moon/line/pixel] - PROGRESS_SPINNER = "pixel" - # Choose color for the progress bar spinner. - # Default is green. [green/violet/yellow/blue/cyan/grey/red] - SPINNER_COLOR = "green" +# OS architecture by default. +OS_ARCH = "x86_64" +# Where the packages download. +# This path working only with the command download. +DOWNLOAD_ONLY_PATH = "/tmp/slpkg/" +# File suffix for list packages. +# Change here if you are going to use '.sqf' files. +FILE_LIST_SUFFIX = ".pkgs" +# Configs for displaying colorful menu. Default is true. [true/false] +COLORS = true +# Dialog is a program that will let you present a variety of questions or +# display messages using dialog boxes from a shell script. +# Default is true. [true/false] +DIALOG = true +# If silent mode is true, it does not print the commands as they are executed. +# Default is true. [true/false] +SILENT_MODE = true +# Choose ascii printable characters. +# If true, it uses the extended characters, otherwise the basic ones. +# Default is true. [true/false]. +ASCII_CHARACTERS = true +# Set false to all the questions. If set false, option --yes will not work. +# Default is true. [true/false]. +ASK_QUESTION = true +# Download sources in parallel. Default is false. [true/false] +PARALLEL_DOWNLOADS = false +# Pass your file pattern here, if you want to work only with 'sbo' packages +# add '*_SBo' pattern. Default is the '*'. +FILE_PATTERN = "*" +# There are 5 predefined spinners for the progress bar. +# Default is pixel. [spinner/pie/moon/line/pixel] +PROGRESS_SPINNER = "pixel" +# Choose color for the progress bar spinner. +# Default is green. [green/violet/yellow/blue/cyan/grey/red] +SPINNER_COLOR = "green" - # Slackware command for install packages, instead, you can use 'installpkg'. - INSTALLPKG = "upgradepkg --install-new" - # Slackware command to reinstall packages. - REINSTALL = "upgradepkg --reinstall" - # Slackware command to remove packages. - REMOVEPKG = "removepkg" +# Slackware command for install packages, instead, you can use 'installpkg'. +INSTALLPKG = "upgradepkg --install-new" +# Slackware command to reinstall packages. +REINSTALL = "upgradepkg --reinstall" +# Slackware command to remove packages. +REMOVEPKG = "removepkg" - # You can choose a downloader among wget, curl and lftp. - # Default is wget. [wget/wget2/curl/lftp] - DOWNLOADER = "wget" - # Wget downloader options. - # -c, --continue: resume getting a partially-downloaded file. - # -q, Turn off Wget's output. - # --show-progress, Force wget to display the progress bar in any verbosity. - WGET_OPTIONS = "-c -q --progress=bar:force:noscroll --show-progress" - # Curl downloader options. - CURL_OPTIONS = "" - # Lftp donwloader options. - LFTP_GET_OPTIONS = "-c get -e" - # Lftp mirror options are used to synchronize with the repositories. - LFTP_MIRROR_OPTIONS = "-c mirror --parallel=100 --only-newer" +# You can choose a downloader among wget, curl and lftp. +# Default is wget. [wget/wget2/curl/lftp] +DOWNLOADER = "wget" +# Wget downloader options. +# -c, --continue: resume getting a partially-downloaded file. +# -q, Turn off Wget's output. +# --show-progress, Force wget to display the progress bar in any verbosity. +WGET_OPTIONS = "-c -q --progress=bar:force:noscroll --show-progress" +# Curl downloader options. +CURL_OPTIONS = "" +# Lftp donwloader options. +LFTP_GET_OPTIONS = "-c get -e" +# Lftp mirror options are used to synchronize with the repositories. +LFTP_MIRROR_OPTIONS = "-c mirror --parallel=100 --only-newer" From c37cab3d410696b06e0e7350a13a902612c0aae3 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 12 Apr 2023 23:24:40 +0300 Subject: [PATCH 04/37] Updated for coding style --- slpkg/utilities.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 703b5319..a6c6ef30 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -194,8 +194,5 @@ class Utilities: def blacklist_pattern(self, name): """ This module provides support for Unix shell-style wildcards. """ - if [ - black for black in self.black.packages() - if fnmatch.fnmatch(name, black) - ]: + if [black for black in self.black.packages() if fnmatch.fnmatch(name, black)]: return True From e7e5a313a96bf1c4322537251fe15521c5cb3504 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 12 Apr 2023 23:25:28 +0300 Subject: [PATCH 05/37] Updated for comments --- slpkg/utilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/utilities.py b/slpkg/utilities.py index a6c6ef30..48c2299b 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -40,7 +40,7 @@ class Utilities: level=logging.INFO) def is_package_installed(self, name: str) -> str: - """ Returns the installed package name. """ + """ Returns the installed package binary. """ try: return self.installed_packages[name] except KeyError: From aa3b26d06eef64ec32c90584ee4d07e79c101f69 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 12 Apr 2023 23:27:44 +0300 Subject: [PATCH 06/37] Updated for comments --- configs/blacklist.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/blacklist.toml b/configs/blacklist.toml index c7487498..31472d21 100644 --- a/configs/blacklist.toml +++ b/configs/blacklist.toml @@ -8,6 +8,6 @@ # '[!seq]' matches any character not in seq # See: https://docs.python.org/3.9/library/fnmatch.html -# Example: ["package", "package*", "[package]"]. +# Example: PACKAGES = ["package", "package*", "[package]"]. PACKAGES = [] From 8e54d2ba1ceabe5736dd4e3306de6394cbdd0635 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 12 Apr 2023 23:35:51 +0300 Subject: [PATCH 07/37] Updated for choose packages --- slpkg/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index d32014e4..b1fc5304 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -434,9 +434,8 @@ class Argparse(Configs): repo_packages: list = list(self.data.keys()) - installed: list = self.utils.installed_packages - if method in ['remove', 'find']: + installed: list = list(self.utils.installed_packages.values()) for package in installed: split_package: list = self.utils.split_binary_pkg(package) From 8d6314aa99964d7f9beb2ed583ea34481b747011 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 12 Apr 2023 23:42:15 +0300 Subject: [PATCH 08/37] Fixed usage message --- slpkg/views/cli_menu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index fb528fd9..c4a344f0 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -21,7 +21,7 @@ class Usage(Configs): """ Prints the minimal help menu. """ print(message) args: str = ( - f'\nUsage: {self.prog_name} [{self.cyan}COMMAND{self.endc}] [{self.yellow}OPTIONS{self.endc}]' + f'\nUsage: {self.prog_name} [{self.cyan}COMMAND{self.endc}] [{self.yellow}OPTIONS{self.endc}] ' f'[FILELIST|PACKAGES...]\n' f"\nTry '{self.prog_name} --help' for more options.\n") From 64b00c9b8b4c978b84cb9e1ac5effde5c202c45e Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 12 Apr 2023 23:47:09 +0300 Subject: [PATCH 09/37] Fixed for disabled repositories --- slpkg/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slpkg/main.py b/slpkg/main.py index b1fc5304..96a379bd 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -306,7 +306,10 @@ class Argparse(Configs): '-c', 'check-updates', ] - if self.binary_repo == '*' and not self.utils.is_option(except_options, self.args): + if self.binary_repo in self.repos.bin_repos_names and self.binary_repo not in self.repos.bin_enabled_repos: + self.usage.help_minimal(f"{self.prog_name}: repository '{self.binary_repo}' is disabled") + + elif self.binary_repo == '*' and not self.utils.is_option(except_options, self.args): self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.binary_repo}'") elif self.binary_repo not in self.repos.bin_repos_names and self.binary_repo != '*': From 92bd4ce575187a95408139ac4d946472eb01ac2a Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 12 Apr 2023 23:50:29 +0300 Subject: [PATCH 10/37] Fixed for search --- slpkg/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/search.py b/slpkg/search.py index 53ddfd03..b3e00687 100644 --- a/slpkg/search.py +++ b/slpkg/search.py @@ -43,7 +43,7 @@ class SearchPackage(Configs): for package in packages: for data_pkg in data.values(): - if package in data_pkg[1] or package == '*': + if package in data_pkg[0] or package == '*': matching += 1 print(f'{data_pkg[12]}: {self.cyan}{data_pkg[0]}{self.endc} ' From a2898404a1c926138ab200cf1e5e0a1f0baa8473 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 00:04:45 +0300 Subject: [PATCH 11/37] Fixed for version --- slpkg/sbos/slackbuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/sbos/slackbuild.py b/slpkg/sbos/slackbuild.py index 4bf728db..9074811d 100644 --- a/slpkg/sbos/slackbuild.py +++ b/slpkg/sbos/slackbuild.py @@ -378,7 +378,7 @@ class Slackbuilds(Configs): for package in dependencies: status: bool = False - repo_ver: str = self.data[package][0] + repo_ver: str = self.data[package][2] description: str = self.data[package][8] help_text: str = f'Description: {description}' upgradable: bool = self.upgrade.is_package_upgradeable(package) From cb948f3ec49ee574f04261bd01bfa5f1864515d0 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 08:55:33 +0300 Subject: [PATCH 12/37] Updated for reinstall option --- ChangeLog.txt | 4 +++- configs/slpkg.toml | 10 +++++++++- slpkg/binaries/install.py | 3 +++ slpkg/sbos/slackbuild.py | 3 +++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index aea461f2..07239760 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,8 @@ 4.7.8 - 12/04/203 Added: -- Module to support for Unix shell-style wildcards for blacklist +- Module to support for Unix shell-style wildcards for blacklist (Thanks yo marav) +Updated: +- Config file for --reinstall option (Thanks to rizitis) 4.7.7 - 07/04/2023 Updated: diff --git a/configs/slpkg.toml b/configs/slpkg.toml index 1683b30b..25afe6ea 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -36,9 +36,17 @@ PROGRESS_SPINNER = "pixel" SPINNER_COLOR = "green" # Slackware command for install packages, instead, you can use 'installpkg'. +# Normally upgradepkg only upgrades packages that are already installed +# on the system, and will skip any packages that do not already have a +# version installed. If --install- new is specified, the behavior is +# modified to install new packages in addition to upgrading existing ones. INSTALLPKG = "upgradepkg --install-new" # Slackware command to reinstall packages. -REINSTALL = "upgradepkg --reinstall" +# Upgradepkg usually skips packages if the exact same package (matching name, +# version, arch, and build number) is already installed on the system. Use +# the --reinstall option if you want to upgrade all packages even if the same +# version is already installed. +REINSTALL = "upgradepkg --install-new --reinstall" # Slackware command to remove packages. REMOVEPKG = "removepkg" diff --git a/slpkg/binaries/install.py b/slpkg/binaries/install.py index 15e8998c..8de3644f 100644 --- a/slpkg/binaries/install.py +++ b/slpkg/binaries/install.py @@ -253,6 +253,9 @@ class Packages(Configs): if self.mode == 'install' and not installed: status: bool = True + if self.option_for_reinstall: + status: bool = True + choices += [(package, repo_ver, status, help_text)] text: str = f'There are {len(choices)} dependencies:' diff --git a/slpkg/sbos/slackbuild.py b/slpkg/sbos/slackbuild.py index 9074811d..3c82143b 100644 --- a/slpkg/sbos/slackbuild.py +++ b/slpkg/sbos/slackbuild.py @@ -396,6 +396,9 @@ class Slackbuilds(Configs): if self.mode == 'install' and not installed: status: bool = True + if self.option_for_reinstall: + status: bool = True + choices += [(package, repo_ver, status, help_text)] text: str = f'There are {len(choices)} dependencies:' From 35c841da26207c3d54de117f909885067ee35bf1 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 09:13:18 +0300 Subject: [PATCH 13/37] Updated for count --- slpkg/binaries/queries.py | 8 -------- slpkg/repo_info.py | 8 +++----- slpkg/sbos/queries.py | 7 ------- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/slpkg/binaries/queries.py b/slpkg/binaries/queries.py index df065057..feb44934 100644 --- a/slpkg/binaries/queries.py +++ b/slpkg/binaries/queries.py @@ -64,11 +64,3 @@ class BinQueries: } return repos_dict - - def count_packages(self) -> int: - """ Counts the number of the packages. """ - count = self.session.query( - BinariesTable.id).where( - BinariesTable.repo == self.repo).count() - - return count diff --git a/slpkg/repo_info.py b/slpkg/repo_info.py index d9d87433..622ad850 100644 --- a/slpkg/repo_info.py +++ b/slpkg/repo_info.py @@ -5,11 +5,9 @@ import shutil from slpkg.configs import Configs from slpkg.utilities import Utilities -from slpkg.sbos.queries import SBoQueries from slpkg.repositories import Repositories -from slpkg.binaries.queries import BinQueries -from slpkg.models.models import LastRepoUpdated from slpkg.models.models import session as Session +from slpkg.models.models import LastRepoUpdated, SBoTable, BinariesTable class RepoInfo(Configs): @@ -61,9 +59,9 @@ class RepoInfo(Configs): if value[0]: if repo in [self.repos.sbo_repo_name, self.repos.ponce_repo_name]: - count = int(SBoQueries().count_packages()) + count = self.session.query(SBoTable.id).count() else: - count = int(BinQueries(repo).count_packages()) + count = self.session.query(BinariesTable).where(BinariesTable.repo == repo).count() total_packages += count diff --git a/slpkg/sbos/queries.py b/slpkg/sbos/queries.py index 2d280f2d..a002deca 100644 --- a/slpkg/sbos/queries.py +++ b/slpkg/sbos/queries.py @@ -42,10 +42,3 @@ class SBoQueries(Configs): } return repos_dict - - def count_packages(self) -> int: - """ Counts the number of the packages. """ - count = self.session.query( - self.sbo_table.id).count() - - return count From 6332169cc58eb92ea3d03536ea2fdf0f4305ce38 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 09:15:31 +0300 Subject: [PATCH 14/37] Updated for changelog --- ChangeLog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 07239760..b3b959db 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,7 @@ Added: - Module to support for Unix shell-style wildcards for blacklist (Thanks yo marav) Updated: - Config file for --reinstall option (Thanks to rizitis) +- Improve speed 4.7.7 - 07/04/2023 Updated: From 9487398738256b0e9272f7ec5158b881a19e6e71 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 09:16:52 +0300 Subject: [PATCH 15/37] Remove unused --- slpkg/utilities.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 48c2299b..b308ed56 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -48,8 +48,8 @@ class Utilities: def all_installed(self) -> dict: """ Return all installed packages from /val/log/packages folder. """ - # installed_dict: dict = {} var_log_packages: Path = 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] @@ -57,7 +57,6 @@ class Utilities: if not name.startswith('.') and not self.blacklist_pattern(name): yield name, file.name - # return installed_dict except ValueError as err: logger = logging.getLogger(__name__) logger.info('%s: %s: %s', self.__class__.__name__, From 4e2143ebc4e6ffdbf7de0e087773d0471538f6c6 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 12:29:08 +0300 Subject: [PATCH 16/37] Updated for proxies support #160 Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 1 + configs/slpkg.toml | 9 +++++++++ slpkg/check_updates.py | 17 +++++++++++++++-- slpkg/configs.py | 9 +++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index b3b959db..6d4346bd 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,7 @@ 4.7.8 - 12/04/203 Added: - Module to support for Unix shell-style wildcards for blacklist (Thanks yo marav) +- Supports proxies (Thanks to tpiszcze) #160 Updated: - Config file for --reinstall option (Thanks to rizitis) - Improve speed diff --git a/configs/slpkg.toml b/configs/slpkg.toml index 25afe6ea..8d8d86ff 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -64,3 +64,12 @@ CURL_OPTIONS = "" LFTP_GET_OPTIONS = "-c get -e" # Lftp mirror options are used to synchronize with the repositories. LFTP_MIRROR_OPTIONS = "-c mirror --parallel=100 --only-newer" + +# If you are going to use a proxy server, try to fill in these variables. +# Choose between http or socks proxy type, not both. +# If you want to use a socks proxy, you need to install the PySocks package. +# https://urllib3.readthedocs.io/en/stable/advanced-usage.html#socks-proxies +HTTP_PROXY_ADDRESS = "" +SOCKS_PROXY_ADDRESS = "" +PROXY_USERNAME = "" +PROXY_PASSWORD = "" diff --git a/slpkg/check_updates.py b/slpkg/check_updates.py index bda043f6..bb0c421b 100644 --- a/slpkg/check_updates.py +++ b/slpkg/check_updates.py @@ -2,9 +2,9 @@ # -*- coding: utf-8 -*- import os -import urllib3 from pathlib import Path from multiprocessing import Process +from urllib3 import PoolManager, ProxyManager, make_headers from slpkg.configs import Configs from slpkg.utilities import Utilities @@ -168,7 +168,20 @@ class CheckUpdates(Configs): def compare_dates(self) -> bool: local_date: int = 0 try: - http = urllib3.PoolManager() + http = PoolManager() + proxy_default_headers = make_headers(proxy_basic_auth=f'{self.proxy_username}:{self.proxy_password}') + + if self.http_proxy_address: + http = ProxyManager(f'{self.http_proxy_address}', headers=proxy_default_headers) + + elif self.socks_proxy_address: + try: + from urllib3.contrib.socks import SOCKSProxyManager + except (ModuleNotFoundError, ImportError): + raise SystemExit() + + http = SOCKSProxyManager(f'{self.socks_proxy_address}', headers=proxy_default_headers) + repo = http.request('GET', self.repo_chg_txt) except KeyboardInterrupt: raise SystemExit(1) diff --git a/slpkg/configs.py b/slpkg/configs.py index f867f1d1..24a69473 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -77,6 +77,11 @@ class Configs: progress_spinner: str = 'pixel' spinner_color: str = 'green' + http_proxy_address: str = '' + socks_proxy_address: str = '' + proxy_username: str = '' + proxy_password: str = '' + load = Load() configs = load.config_file(etc_path, prog_name) @@ -104,6 +109,10 @@ class Configs: file_pattern_conf: str = config['FILE_PATTERN'] progress_spinner: str = config['PROGRESS_SPINNER'] spinner_color: str = config['SPINNER_COLOR'] + http_proxy_address: str = config['HTTP_PROXY_ADDRESS'] + socks_proxy_address: str = config['SOCKS_PROXY_ADDRESS'] + proxy_username: str = config['PROXY_USERNAME'] + proxy_password: str = config['PROXY_PASSWORD'] except KeyError as error: raise SystemExit(f"\n{prog_name}: {color['bold']}{color['red']}Error{color['endc']}: " From a8f08ac62f67083cf080df268a3b61603cf9cc95 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 12:30:59 +0300 Subject: [PATCH 17/37] Updated for style --- configs/slpkg.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/slpkg.toml b/configs/slpkg.toml index 8d8d86ff..8112eb72 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -1,4 +1,5 @@ [CONFIGS] + # OS architecture by default. OS_ARCH = "x86_64" # Where the packages download. From 1f883ab57bad14faf6890846bec01e72054a25d1 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 12:36:05 +0300 Subject: [PATCH 18/37] Updated for tests --- tests/test_bin_queries.py | 3 --- tests/test_blacklist.py | 2 +- tests/test_checks.py | 6 ------ tests/test_configs.py | 4 ++++ tests/test_utilities.py | 8 -------- 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/tests/test_bin_queries.py b/tests/test_bin_queries.py index 4d0aa5b2..d2e75e45 100644 --- a/tests/test_bin_queries.py +++ b/tests/test_bin_queries.py @@ -9,9 +9,6 @@ class TestBinQueries(unittest.TestCase): self.repo_data = self.bin_queries.repository_data() self.repos_data = self.bin_queries.repositories_data() - def test_count_packages(self): - self.assertGreater(self.bin_queries.count_packages(), 1) - def test_repository_data(self): self.assertGreater(len(list(self.repo_data.keys())), 1) diff --git a/tests/test_blacklist.py b/tests/test_blacklist.py index 38499712..e12cc8a0 100644 --- a/tests/test_blacklist.py +++ b/tests/test_blacklist.py @@ -6,7 +6,7 @@ class TestBlacklist(unittest.TestCase): def test_blacklist(self): black = Blacklist() - self.assertListEqual(['%README%'], black.packages()) + self.assertListEqual([], black.packages()) if __name__ == '__main__': diff --git a/tests/test_checks.py b/tests/test_checks.py index 2506c121..e5e43282 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -20,12 +20,6 @@ class TestPkgInstalled(unittest.TestCase): def test_check_is_installed(self): self.assertIsNone(self.check.is_package_unsupported(self.packages)) - def test_check_blacklist(self): - self.assertIsNone(self.check.is_blacklist(self.packages)) - - def test_check_is_empty(self): - self.assertIsNone(self.check.is_blacklist(self.packages)) - if __name__ == "__main__": unittest.main() diff --git a/tests/test_configs.py b/tests/test_configs.py index 2018471e..a1108c78 100644 --- a/tests/test_configs.py +++ b/tests/test_configs.py @@ -38,6 +38,10 @@ class TestConfigs(unittest.TestCase): self.assertEqual('*', self.configs.file_pattern) self.assertEqual('pixel', self.configs.progress_spinner) self.assertEqual('green', self.configs.spinner_color) + self.assertEqual('', self.configs.http_proxy_address) + self.assertEqual('', self.configs.socks_proxy_address) + self.assertEqual('', self.configs.proxy_username) + self.assertEqual('', self.configs.proxy_password) if __name__ == '__main__': diff --git a/tests/test_utilities.py b/tests/test_utilities.py index 3063886a..901baf0c 100644 --- a/tests/test_utilities.py +++ b/tests/test_utilities.py @@ -36,14 +36,6 @@ class TestUtilities(unittest.TestCase): def test_all_installed(self): self.assertIn(self.package, self.utils.all_installed()) - def test_all_installed_names(self): - self.assertIn('aaa_base', self.utils.all_installed_names()) - self.assertIn('vim', self.utils.all_installed_names()) - self.assertIn('nano', self.utils.all_installed_names()) - self.assertIn('wget', self.utils.all_installed_names()) - self.assertIn('curl', self.utils.all_installed_names()) - self.assertIn('lftp', self.utils.all_installed_names()) - def test_read_build_tag(self): self.assertEqual('1', self.utils.read_sbo_build_tag('slpkg', 'system')) From 671e583b37c5591893a88e59c60a11df959c18a6 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 12:49:44 +0300 Subject: [PATCH 19/37] Updated for dict --- slpkg/dependees.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/slpkg/dependees.py b/slpkg/dependees.py index 96e1235e..625f2f1a 100644 --- a/slpkg/dependees.py +++ b/slpkg/dependees.py @@ -51,7 +51,7 @@ class Dependees(Configs): self.packages: list = self.utils.apply_package_pattern(self.data, self.packages) for pkg in self.packages: - dependees: list = list(self.find_requires(pkg)) + dependees: dict = dict(self.find_requires(pkg)) package: str = f'{self.byellow}{pkg}{self.endc}' @@ -71,17 +71,17 @@ class Dependees(Configs): print(f'{self.cyan} No dependees{self.endc}') sp: str = ' ' * 4 - for i, dep in enumerate(dependees, start=1): - dependency: str = f'{self.cyan}{dep[0]}{self.endc}' + for i, (name, requires) in enumerate(dependees.items(), start=1): + dependency: str = f'{self.cyan}{name}{self.endc}' if self.option_for_pkg_version: if self.option_for_binaries: - version: str = self.data[dep[0]][0] + version: str = self.data[name][0] else: - version: str = self.data[dep[0]][2] + version: str = self.data[name][2] - dependency: str = (f'{self.cyan}{dep[0]}{self.endc} {self.yellow}' + dependency: str = (f'{self.cyan}{name}{self.endc} {self.yellow}' f'{version}{self.endc}') if i == 1: @@ -91,13 +91,13 @@ class Dependees(Configs): if self.option_for_full_reverse: if i == len(dependees): - print(' ' * 4 + f' {self.llc}{self.hl} {self.violet}{dep[1]}{self.endc}') + print(' ' * 4 + f' {self.llc}{self.hl} {self.violet}{requires}{self.endc}') else: - print(' ' * 4 + f' {self.var}{self.hl} {self.violet}{dep[1]}{self.endc}') + print(' ' * 4 + f' {self.var}{self.hl} {self.violet}{requires}{self.endc}') print(f'\n{self.grey}{len(dependees)} dependees for {pkg}{self.endc}\n') - def find_requires(self, pkg: str) -> Generator[str, None, None]: + def find_requires(self, pkg: str) -> Generator: """ Find requires that package dependees. """ if self.option_for_binaries: @@ -106,11 +106,11 @@ class Dependees(Configs): for req in data[6].split(): if req == pkg: - yield [name, data[6]] + yield name, data[6] else: for name, data in self.data.items(): if name: for req in data[7].split(): if req == pkg: - yield [name, data[7]] + yield name, data[7] From 728180e0779b7f10881d212f97ae9885e93ae56d Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 12:52:04 +0300 Subject: [PATCH 20/37] Updated for unused if --- slpkg/dependees.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/slpkg/dependees.py b/slpkg/dependees.py index 625f2f1a..049ab46a 100644 --- a/slpkg/dependees.py +++ b/slpkg/dependees.py @@ -102,15 +102,13 @@ class Dependees(Configs): if self.option_for_binaries: for name, data in self.data.items(): - if name: - for req in data[6].split(): - if req == pkg: + for req in data[6].split(): + if req == pkg: - yield name, data[6] + yield name, data[6] else: for name, data in self.data.items(): - if name: - for req in data[7].split(): - if req == pkg: + for req in data[7].split(): + if req == pkg: - yield name, data[7] + yield name, data[7] From 3d79f64cfbdc379be0721b409fa002abcd71cea7 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 12:55:14 +0300 Subject: [PATCH 21/37] Updated for speed improve --- slpkg/dependees.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/slpkg/dependees.py b/slpkg/dependees.py index 049ab46a..889db024 100644 --- a/slpkg/dependees.py +++ b/slpkg/dependees.py @@ -102,13 +102,10 @@ class Dependees(Configs): if self.option_for_binaries: for name, data in self.data.items(): - for req in data[6].split(): - if req == pkg: + if pkg in data[6].split(): + yield name, data[6] - yield name, data[6] else: for name, data in self.data.items(): - for req in data[7].split(): - if req == pkg: - - yield name, data[7] + if pkg in data[7].split(): + yield name, data[7] From 201e0b92fd7eb3ebf6a9c4e15def28e3147416ee Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 13:05:33 +0300 Subject: [PATCH 22/37] Updated for enabled repos --- slpkg/repositories.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/slpkg/repositories.py b/slpkg/repositories.py index 414ac656..a86a40be 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -471,7 +471,4 @@ class Repositories: bin_repos_names = list(repositories.keys())[2:] # All the enabled binary repositories names. - for repo, enabled in repositories.items(): - if repo not in [sbo_repo_name, ponce_repo_name]: - if enabled[0]: - bin_enabled_repos.append(repo) + bin_enabled_repos = list(repositories.keys())[2:] From dd819af5aa680ff0ad6e7168c8c8391ab33a2d13 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 13:09:52 +0300 Subject: [PATCH 23/37] Fixed for find installed --- slpkg/find_installed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slpkg/find_installed.py b/slpkg/find_installed.py index d422cefc..869da014 100644 --- a/slpkg/find_installed.py +++ b/slpkg/find_installed.py @@ -21,7 +21,7 @@ class FindInstalled(Configs): self.endc: str = self.color['endc'] self.grey: str = self.color['grey'] - self.installed: list = self.utils.installed_packages + self.installed: dict = self.utils.installed_packages def find(self, packages: list) -> None: """ Find the packages. """ @@ -31,7 +31,7 @@ class FindInstalled(Configs): f'that contains \'{", ".join([p for p in packages])}\' files:\n') for pkg in packages: - for package in self.installed: + for package in self.installed.values(): if pkg in package or pkg == '*': matching.append(package) From 7ccf56a94257c613ad76860763f63e6b5b8836e8 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 13:12:00 +0300 Subject: [PATCH 24/37] Fixed for upgrade --- slpkg/upgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index 3bc28bd5..812d0e02 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -35,7 +35,7 @@ class Upgrade(Configs): """ Returns the upgradable packages. """ # Returns the matched packages between two lists. - packages: list = list(set(self.utils.installed_package_names) & set(list(self.data.keys()))) + packages: list = list(set(self.utils.installed_packages.keys()) & set(list(self.data.keys()))) for pkg in packages: if self.is_package_upgradeable(pkg): From 341ae6385c5550b77a6d4a9fdd0d3dab1111a239 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 13:17:14 +0300 Subject: [PATCH 25/37] Updated for version 4.7.8 --- setup.cfg | 2 +- slpkg/views/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 26d92d15..8b0d9bcd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = slpkg -version = 4.7.7 +version = 4.7.8 license_file = LICENSE author = Dimitris Zlatanidis author_email = d.zlatanidis@gmail.com diff --git a/slpkg/views/version.py b/slpkg/views/version.py index b1a0541c..a09d98b2 100644 --- a/slpkg/views/version.py +++ b/slpkg/views/version.py @@ -5,7 +5,7 @@ class Version: """ Print the version. """ def __init__(self): - self.version_info: tuple = (4, 7, 7) + self.version_info: tuple = (4, 7, 8) self.version: str = '{0}.{1}.{2}'.format(*self.version_info) self.license: str = 'MIT License' self.author: str = 'Dimitris Zlatanidis (dslackw)' From e6bd56a52a6afc9a2dadb2469337cf9773b7add5 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 13:46:14 +0300 Subject: [PATCH 26/37] Updated for comments --- slpkg/check_updates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/check_updates.py b/slpkg/check_updates.py index bb0c421b..825d3dc5 100644 --- a/slpkg/check_updates.py +++ b/slpkg/check_updates.py @@ -175,7 +175,7 @@ class CheckUpdates(Configs): http = ProxyManager(f'{self.http_proxy_address}', headers=proxy_default_headers) elif self.socks_proxy_address: - try: + try: # Try to import PySocks if it's installed. from urllib3.contrib.socks import SOCKSProxyManager except (ModuleNotFoundError, ImportError): raise SystemExit() From bdefbe6e60fc3fa7e25da72300345426f73970e9 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 17:33:21 +0300 Subject: [PATCH 27/37] Updated for optional deps --- requirements.txt | 5 ++++- setup.cfg | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7d355254..57e0054c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ SQLAlchemy >= 1.4.46 pythondialog >= 3.5.3 -progress >= 1.6 \ No newline at end of file +progress >= 1.6 + +[socks] +PySocks >= 1.7.1 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 8b0d9bcd..f4c62556 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,5 +43,9 @@ install_requires = progress >= 1.6 include_package_data = True +[options.extras_require] +socks = + PySocks >= 1.7.1 + [options.packages.find] where = . From d2b7438588ce545f9ba0f9d0cfa1ad4c64694698 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 17:40:16 +0300 Subject: [PATCH 28/37] Updated for version 4.7.8 --- man/slpkg.1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/man/slpkg.1 b/man/slpkg.1 index 2325642c..83f32bd3 100644 --- a/man/slpkg.1 +++ b/man/slpkg.1 @@ -1,4 +1,4 @@ -.TH slpkg 1 "Orestiada, Greece" "slpkg 4.7.7" dslackw +.TH slpkg 1 "Orestiada, Greece" "slpkg 4.7.8" dslackw .SH NAME .P slpkg \- Package manager utility for Slackware. @@ -225,18 +225,18 @@ When you use the install, build, upgrade or remove commands you should know that color will change to gray, if the package is upgradeable then it will change to violet, and if it is not installed then its color will be cyan. Also, if you try to remove a package you will see the package color turns red. -Example: If the package is already installed and the indicator color is grey and the option '-r, --reinstall' is not applied, +Example: If the package is already installed and the indicator color is grey and the option '\fB-r, --reinstall\fR' is not applied, the package will skip from the installation and you will see a message '(already installed)'. If the package is upgradeable, the installation will continue and the package will go to upgrade. For the upgrade command, you should know, that you can upgrade packages from different repositories, if you edit -the '/etc/slpkg/repositories.toml' file and remove the repository tag. Then the slpkg can't recognize the repository of the packages. +the '\fI/etc/slpkg/repositories.toml\fR' file and remove the repository tag. Then the slpkg can't recognize the repository of the packages. -With the remove command, it's going to remove the dependencies if the package had installed with the 'slpkg install' command, +With the remove command, it's going to remove the dependencies if the package had installed with the '\fIslpkg install\fR' command, otherwise, the slpkg does not know the dependencies that are installed with the packages that going to remove. You can apply the asterisk '*' instead of a package, to matching all the packages from a repository. You can't apply -an asterisk to the '-B, --bin-repos=' option, except for the '-s, search', '-u, update' and '-c, check-updates' commands. +an asterisk to the '\fB-B, --bin-repos=\fR' option, except for the '\fB-s, search\fR', '\fB-u, update\fR' and '\fB-c, check-updates\fR' commands. Command clean-data, removes the local repository data and the database data. From 9bdc8b2bf1d7be7eccc97aa3237ba10dfa25c4ba Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 19:02:10 +0300 Subject: [PATCH 29/37] Updated the readme --- README.rst | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index ba3d2f5b..97e6de16 100644 --- a/README.rst +++ b/README.rst @@ -27,7 +27,7 @@ Requirements Install ------- -Install from the official third-party `SBo repository `_ or directly from source: +Install it from the official third-party `SlackBuilds.org `_ repository or directly from source: .. code-block:: bash @@ -101,6 +101,36 @@ Usage Edit the config file in the /etc/slpkg/slpkg.toml or 'slpkg configs'. +How to start +------------ + +If you are going to use only the `SlackBuilds.org `_ repository, you don't need to edit the +:code:`/etc/slpkg/repositories.toml` file, otherwise edit the file and set :code:`true` the repositories you want. + +The second step is to update the package lists and install the data to the database, just run: + +.. code-block:: bash + + $ slpkg update + +or for binary repositories: + +.. code-block:: bash + + $ slpkg update -bin-repo='*' + +Now you are ready to start! + +To install a package from the `SlackBuilds.org `_ or `Ponce `_ repository for -current users, run: + +.. code-block:: bash + + $ slpkg install + +or from a binary repository: + + $ slpkg install --bin-repo= + Configuration files ------------------- From 623037a2e9515f5aef0c3899207d9a93cd6684e3 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 19:04:17 +0300 Subject: [PATCH 30/37] Updated the readme --- README.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 97e6de16..7681342b 100644 --- a/README.rst +++ b/README.rst @@ -117,11 +117,11 @@ or for binary repositories: .. code-block:: bash - $ slpkg update -bin-repo='*' + $ slpkg update --bin-repo='*' Now you are ready to start! -To install a package from the `SlackBuilds.org `_ or `Ponce `_ repository for -current users, run: +To install a package from the `SlackBuilds.org `_ or `Ponce `_ repository, run: .. code-block:: bash @@ -129,6 +129,8 @@ To install a package from the `SlackBuilds.org `_ or ` or from a binary repository: +.. code-block:: bash + $ slpkg install --bin-repo= From 5e6d190f4d3c531262f1a6dda736484c8291ce76 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 19:11:41 +0300 Subject: [PATCH 31/37] Updated the readme --- README.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.rst b/README.rst index 7681342b..ccc1140b 100644 --- a/README.rst +++ b/README.rst @@ -133,6 +133,22 @@ or from a binary repository: $ slpkg install --bin-repo= +You can install a whole repository with the command: + +.. code-block:: bash + + $ slpkg install '*' --bin-repo=gnome --resolve-off + +Note: Apply the option '--resolve-off' to speed up the process because the gnome repository has no references to the dependencies. + + +To remove a package with the dependencies: + +.. code-block:: bash + + $ slpkg remove + + Configuration files ------------------- @@ -189,6 +205,11 @@ If you feel satisfied with this project and want to thanks me make a donation. .. image:: https://gitlab.com/dslackw/images/raw/master/donate/paypaldonate.png :target: https://www.paypal.me/dslackw +Report bugs +----------- + +Please report any issue here: `Issues `_ + Copyright --------- From 376f7eb0c1c4c3866dbbc1047e03665e5e0eae14 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 19:14:24 +0300 Subject: [PATCH 32/37] Updated the readme --- README.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index ccc1140b..fac8e758 100644 --- a/README.rst +++ b/README.rst @@ -141,13 +141,17 @@ You can install a whole repository with the command: Note: Apply the option '--resolve-off' to speed up the process because the gnome repository has no references to the dependencies. - To remove a package with the dependencies: .. code-block:: bash $ slpkg remove +For further information please read the manpage: + +.. code-block:: bash + + $ man slpkg Configuration files From 77bd79381c37eb8c9f180e2905b8f0ff69205e72 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 19:16:50 +0300 Subject: [PATCH 33/37] Updated the readme --- README.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index fac8e758..bc530f67 100644 --- a/README.rst +++ b/README.rst @@ -147,7 +147,14 @@ To remove a package with the dependencies: $ slpkg remove -For further information please read the manpage: +If you wan to search a package from all binaries repositories, run: + +.. code-block:: bash + + $ slpkg search libreoffice --bin-repo='*' + + +For further information, please read the manpage: .. code-block:: bash From af24e57276542889fd17f50a94b3b8526dad2532 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 19:18:23 +0300 Subject: [PATCH 34/37] Updated the readme --- README.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.rst b/README.rst index bc530f67..3fe60799 100644 --- a/README.rst +++ b/README.rst @@ -160,6 +160,12 @@ For further information, please read the manpage: $ man slpkg +Edit the :code:`/etc/slpkg/slpkg.toml` file: + +.. code-block:: bash + + $ slpkg configs + Configuration files ------------------- From cb151176912a2d3232705c0c0d511203fe87bf2f Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 23:42:25 +0300 Subject: [PATCH 35/37] Updated the readme --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 3fe60799..8ad357f0 100644 --- a/README.rst +++ b/README.rst @@ -160,7 +160,7 @@ For further information, please read the manpage: $ man slpkg -Edit the :code:`/etc/slpkg/slpkg.toml` file: +Edit the configuration :code:`/etc/slpkg/slpkg.toml` file: .. code-block:: bash From 6b89d277d16313ea27bc4fb26a6ac3a0cea54ee0 Mon Sep 17 00:00:00 2001 From: maravtdm Date: Thu, 13 Apr 2023 22:43:59 +0200 Subject: [PATCH 36/37] add MUST YOU KNOW CHAPTER --- man/slpkg-fr.1 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/man/slpkg-fr.1 b/man/slpkg-fr.1 index c775acb8..8e1660b0 100644 --- a/man/slpkg-fr.1 +++ b/man/slpkg-fr.1 @@ -210,6 +210,33 @@ En plus de la façon classique, vous pouvez mettre ensemble plusieurs options qu Au lieu de paquets, vous pouvez passer un fichier texte avec le suffixe '.pkgs' et les noms des paquets. Exemple : 'slpkg install list.pkgs'. Éditer la configuration '/etc/slpkg/slpkg.toml' pour changer le suffixe si vous le souhaitez. Vous pouvez utiliser des listes provenant d'autres sources, avec des fichiers '.sqf'. .RE +.SH A SAVOIR +.P +Il y a cinq indicateurs lorsque certaines commandes sont utilisées, par exemple : + +Cyan : Installer, Jaune : Pour construire, Gris : C'est installé, Violet : Pour la mise à jour, Rouge : Pour supprimer. + +Lorsque vous utilisez les commandes install, build, upgrade ou remove, vous devez savoir que si le paquet est installé, +sa couleur passera au gris, si le paquet peut être mis à niveau, il devient violet. Et s'il n'est pas installé alors +sa couleur sera cyan. De même, si vous essayez de supprimer un paquet, la couleur du paquet devient rouge. + +Exemple : Si le paquet est déjà installé, que la couleur de l'indicateur est grise et que l'option '\fB-r, --reinstall\fR' n'est pas appliquée, +le paquetage ne sera pas installé et le message "(already installed)" s'affichera. +Si le paquet peut être mis à niveau, l'installation se poursuivra et le paquet passera à la mise à niveau. + +Pour la commande de mise à niveau, vous devez savoir que vous pouvez mettre à niveau des paquets provenant de différents dépôts, si vous éditez +le fichier '\fI/etc/slpkg/repositories.toml\fR' et supprimez la balise repository. Le slpkg ne peut alors pas reconnaître le dépôt des paquets. + +Avec la commande remove, il va supprimer les dépendances si le paquet a été installé avec la commande '\fIslpkg install\fR', +sinon, le slpkg ne connaît pas les dépendances qui sont installées avec les paquets qu'il va supprimer. + +Vous pouvez appliquer l'astérisque '*' à la place d'un paquet, pour faire correspondre tous les paquets d'un dépôt. Vous ne pouvez pas appliquer +un astérisque à l'option '\fB-B, --bin-repos=\fR', sauf pour les commandes '\fB-s, search\fR', '\fB-u, update\fR' et '\fB-c, check-updates\fR'. + +La commande clean-data supprime les données du référentiel local et de la base de données. + +Remarque : il n'existe actuellement aucune fonction permettant d'indiquer les paquets si les couleurs sont désactivées. +.RE .SH FICHIERS DE CONFIGURATION .P Fichier de \fBconfiguration\fP : /etc/slpkg/slpkg.toml From 3030782a5b9cffa8ecbbc937e9bdae220f134142 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Apr 2023 23:45:15 +0300 Subject: [PATCH 37/37] Updated for comments --- configs/slpkg.toml | 2 +- slpkg/check_updates.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/slpkg.toml b/configs/slpkg.toml index 8112eb72..51f507b7 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -68,7 +68,7 @@ LFTP_MIRROR_OPTIONS = "-c mirror --parallel=100 --only-newer" # If you are going to use a proxy server, try to fill in these variables. # Choose between http or socks proxy type, not both. -# If you want to use a socks proxy, you need to install the PySocks package. +# For a socks proxy, you need to install the PySocks package. # https://urllib3.readthedocs.io/en/stable/advanced-usage.html#socks-proxies HTTP_PROXY_ADDRESS = "" SOCKS_PROXY_ADDRESS = "" diff --git a/slpkg/check_updates.py b/slpkg/check_updates.py index 825d3dc5..6d087f73 100644 --- a/slpkg/check_updates.py +++ b/slpkg/check_updates.py @@ -175,6 +175,7 @@ class CheckUpdates(Configs): http = ProxyManager(f'{self.http_proxy_address}', headers=proxy_default_headers) elif self.socks_proxy_address: + # https://urllib3.readthedocs.io/en/stable/advanced-usage.html#socks-proxies try: # Try to import PySocks if it's installed. from urllib3.contrib.socks import SOCKSProxyManager except (ModuleNotFoundError, ImportError):