From 005328b47edb2e58cf9a3318beb3d863087b84de Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 20 Oct 2022 20:16:04 +0300 Subject: [PATCH 01/12] Updated for package arch chose Signed-off-by: Dimitris Zlatanidis --- slpkg/queries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/queries.py b/slpkg/queries.py index f6b24c4b..25a54c17 100644 --- a/slpkg/queries.py +++ b/slpkg/queries.py @@ -106,7 +106,7 @@ class SBoQueries: return '' def _chose_arch(self, arch, arch64): - if self.os_arch and arch64: + if self.os_arch == 'x86_64' and arch64: return arch64 return arch From 2318f841773e1d14772de9497b4069e026b6e288 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 20 Oct 2022 20:40:01 +0300 Subject: [PATCH 02/12] Removed version for skip installed option Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 4 ++++ slpkg/slackbuild.py | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 7565c939..b721f724 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.2.2 - 20/10/2022 +Updated: +- Remove version for skip installed option + 4.2.1 - 18/10/2022 Added: - Print the README file in the search option diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 885da919..7f3407d8 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -75,9 +75,8 @@ class Slackbuilds: for dep in deps: # Checks if the package was installed and skipped. - pkg = f'{dep}-{SBoQueries(dep).version()}' if ('--skip-installed' in self.flags and - self.utils.is_installed(f'{pkg}-')): + self.utils.is_installed(f'{dep}-')): continue if dep not in self.slackbuilds: From e3074c0daaa2aa10c5e4bdd21741b3e2cb3ad60c Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 21 Oct 2022 21:08:06 +0300 Subject: [PATCH 03/12] Removed unused configurations by user Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 3 ++- configs/slpkg.yml | 5 ----- slpkg/configs.py | 5 ----- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index b721f724..d03974da 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,7 @@ 4.2.2 - 20/10/2022 Updated: -- Remove version for skip installed option +- Removed version for skip installed option +- Removed unused configurations 4.2.1 - 18/10/2022 Added: diff --git a/configs/slpkg.yml b/configs/slpkg.yml index 889b3fc4..df7bf954 100644 --- a/configs/slpkg.yml +++ b/configs/slpkg.yml @@ -3,15 +3,10 @@ configs: os_arch: x86_64 # All necessary paths. - tmp_path: /tmp tmp_slpkg: /tmp/slpkg build_path: /tmp/slpkg/build download_only: /tmp/slpkg - lib_path: /var/lib/slpkg - etc_path: /etc/slpkg - db_path: /var/lib/slpkg/database sbo_repo_path: /var/lib/slpkg/repository - log_packages: /var/log/packages # Database name. database: database.slpkg diff --git a/slpkg/configs.py b/slpkg/configs.py index 0c3d2c84..d79dab7f 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -67,15 +67,10 @@ class Configs: os_arch: str = config['os_arch'] # All necessary paths - tmp_path: str = config['tmp_path'] tmp_slpkg: str = config['tmp_slpkg'] build_path: str = config['build_path'] download_only: str = config['download_only'] - lib_path: str = config['lib_path'] - etc_path: str = config['etc_path'] - db_path: str = config['db_path'] sbo_repo_path: str = config['sbo_repo_path'] - log_packages: str = config['log_packages'] # Database name database: str = config['database'] From aea515d43a2d695ed284a57ad8dbe3cdcf60daaa Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 22 Oct 2022 19:46:10 +0300 Subject: [PATCH 04/12] Updated configuration file Signed-off-by: Dimitris Zlatanidis --- configs/slpkg.yml | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/configs/slpkg.yml b/configs/slpkg.yml index df7bf954..163cf606 100644 --- a/configs/slpkg.yml +++ b/configs/slpkg.yml @@ -2,28 +2,48 @@ configs: # OS architecture by default. os_arch: x86_64 - # All necessary paths. + # Tmp path for slpkg. tmp_slpkg: /tmp/slpkg + + # Path for building source and the script build_path: /tmp/slpkg/build + + # This path working only with the command download. download_only: /tmp/slpkg + + # The path that the SLACKBUILDS.TXT file downloaded. sbo_repo_path: /var/lib/slpkg/repository - # Database name. + # The name of the database. Default name is 'database.slpkg'. database: database.slpkg - # SBo repository configs. + # Slackbuilds.org repository url. sbo_repo_url: http://slackbuilds.org/slackbuilds/15.0 + + # The sbo repository main file. sbo_txt: SLACKBUILDS.TXT + + # The sbo tar suffix. sbo_tar_suffix: .tar.gz + + # The sbo repo tag. sbo_repo_tag: _SBo - # Slackware commands. + # Slackware install command. Alternative you can + # use 'installpkg', if you want. installpkg: upgradepkg --install-new + + # Upgrade or reinstall slackware command. reinstall: upgradepkg --reinstall + + # Slackware command fro remove packages. removepkg: removepkg - # Cli menu colors configs. + # Cli menu colors configs. Default is on. [on/off] colors: on - # Wget options. + # Wget downloader options. + # -c, --continue: resume getting a partially-downloaded file. + # -N, --timestamping: don't re-retrieve files unless newer + # than local. wget_options: -c -N From 5b79be899f427f4792bfba10a93f7f8198b98c37 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 23 Oct 2022 19:42:24 +0300 Subject: [PATCH 05/12] Updated for version 4.2.2 Signed-off-by: Dimitris Zlatanidis --- README.rst | 4 ++-- setup.cfg | 2 +- slpkg/version.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 41c1a295..5c6a5273 100644 --- a/README.rst +++ b/README.rst @@ -30,8 +30,8 @@ Install from the official third-party `SBo repository Date: Mon, 24 Oct 2022 12:19:13 +0300 Subject: [PATCH 06/12] Renamed command search to view Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 1 + README.rst | 2 +- man/slpkg.1 | 6 +++--- slpkg/main.py | 10 +++++----- slpkg/{search.py => view_package.py} | 2 +- slpkg/views/cli_menu.py | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) rename slpkg/{search.py => view_package.py} (98%) diff --git a/ChangeLog.txt b/ChangeLog.txt index d03974da..37334a94 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,6 +2,7 @@ Updated: - Removed version for skip installed option - Removed unused configurations +- Search command to view 4.2.1 - 18/10/2022 Added: diff --git a/README.rst b/README.rst index 5c6a5273..b503f515 100644 --- a/README.rst +++ b/README.rst @@ -55,7 +55,7 @@ Usage download Download only the packages. remove Remove installed packages. find Find installed packages. - search Search packages on repository. + view View packages from the repository. clean-logs Clean dependencies log tracking. clean-tmp Deletes all the downloaded sources. diff --git a/man/slpkg.1 b/man/slpkg.1 index f9b0cc8d..eb4ff38e 100644 --- a/man/slpkg.1 +++ b/man/slpkg.1 @@ -4,7 +4,7 @@ slpkg - [OPTIONS] [COMMAND] .SH SYNAPSES .P -slpkg [-h|-v] [update] [upgrade] [build] [install] [download] [remove] [find] [search] [clean-logs] [clean-tmp] --yes --jobs --resolve-off --reinstall --skip-installed +slpkg [-h|-v] [update] [upgrade] [build] [install] [download] [remove] [find] [view] [clean-logs] [clean-tmp] --yes --jobs --resolve-off --reinstall --skip-installed .SH DESCRIPTION .P Slpkg is a software package manager that installs, updates, and removes packages on Slackware based systems. It automatically computes dependencies and figures out what things should occur to install packages. Slpkg makes it easier to maintain groups of machines without having to manually update. @@ -47,9 +47,9 @@ find Find sbo installed packages on your distribution. .RE .P -search +view .RS -Search packages on repository and view everything in your terminal. +View packages from the repository and get everything in your terminal. .RE .P clean-logs diff --git a/slpkg/main.py b/slpkg/main.py index f8b2bb95..b2c9888a 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -6,7 +6,7 @@ import sys from dataclasses import dataclass from slpkg.checks import Check -from slpkg.search import Search +from slpkg.view_package import ViewPackage from slpkg.upgrade import Upgrade from slpkg.version import Version from slpkg.configs import Configs @@ -131,15 +131,15 @@ class Argparse: raise SystemExit() usage(1) - def search(self): + def view(self): if len(self.args) >= 2 and not self.flags: packages = list(set(self.args[1:])) packages = self.check.blacklist(packages) self.check.exists(packages) - search = Search() - search.package(packages) + view = ViewPackage() + view.package(packages) raise SystemExit() usage(1) @@ -193,7 +193,7 @@ def main(): 'install': argparse.install, 'download': argparse.download, 'remove': argparse.remove, - 'search': argparse.search, + 'view': argparse.view, 'find': argparse.find, 'clean-logs': argparse.clean_logs, 'clean-tmp': argparse.clean_tmp diff --git a/slpkg/search.py b/slpkg/view_package.py similarity index 98% rename from slpkg/search.py rename to slpkg/view_package.py index a302ecb6..dc760b31 100644 --- a/slpkg/search.py +++ b/slpkg/view_package.py @@ -11,7 +11,7 @@ from slpkg.models.models import session as Session @dataclass -class Search: +class ViewPackage: session: str = Session colors: dict = Configs.colour sbo_repo_url: str = Configs.sbo_repo_url diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 2d11ddfc..696d67ee 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -26,7 +26,7 @@ def usage(status: int): f' {CYAN}download{ENDC} Download only the packages.', f' {CYAN}remove{ENDC} Remove installed packages.', f' {CYAN}find{ENDC} Find installed packages.', - f' {CYAN}search{ENDC} Search packages on repository.', + f' {CYAN}view{ENDC} View packages from the repository.', f' {CYAN}clean-logs{ENDC} Clean dependencies log tracking.', f' {CYAN}clean-tmp{ENDC} Delete all the downloaded sources.\n', f'{BOLD}OPTIONS:{ENDC}', From 72249c0f1e55f70afc2975f5cbb8db77b56a3d17 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 24 Oct 2022 19:59:51 +0300 Subject: [PATCH 07/12] Added a new search command Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 2 ++ README.rst | 1 + man/slpkg.1 | 7 ++++++- slpkg/main.py | 16 +++++++++++++++- slpkg/search.py | 20 ++++++++++++++++++++ slpkg/views/cli_menu.py | 1 + 6 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 slpkg/search.py diff --git a/ChangeLog.txt b/ChangeLog.txt index 37334a94..a0edf413 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,8 @@ Updated: - Removed version for skip installed option - Removed unused configurations - Search command to view +Added: +- A new search command to search and match packages from the repository 4.2.1 - 18/10/2022 Added: diff --git a/README.rst b/README.rst index b503f515..82f0a21c 100644 --- a/README.rst +++ b/README.rst @@ -56,6 +56,7 @@ Usage remove Remove installed packages. find Find installed packages. view View packages from the repository. + search Search packages from the repository. clean-logs Clean dependencies log tracking. clean-tmp Deletes all the downloaded sources. diff --git a/man/slpkg.1 b/man/slpkg.1 index eb4ff38e..74932573 100644 --- a/man/slpkg.1 +++ b/man/slpkg.1 @@ -4,7 +4,7 @@ slpkg - [OPTIONS] [COMMAND] .SH SYNAPSES .P -slpkg [-h|-v] [update] [upgrade] [build] [install] [download] [remove] [find] [view] [clean-logs] [clean-tmp] --yes --jobs --resolve-off --reinstall --skip-installed +slpkg [-h|-v] [update] [upgrade] [build] [install] [download] [remove] [find] [view] [search] [clean-logs] [clean-tmp] --yes --jobs --resolve-off --reinstall --skip-installed .SH DESCRIPTION .P Slpkg is a software package manager that installs, updates, and removes packages on Slackware based systems. It automatically computes dependencies and figures out what things should occur to install packages. Slpkg makes it easier to maintain groups of machines without having to manually update. @@ -52,6 +52,11 @@ view View packages from the repository and get everything in your terminal. .RE .P +search +.RS +Search and match packages from the repository. +.RE +.P clean-logs .RS Cleans dependencies log tracking. diff --git a/slpkg/main.py b/slpkg/main.py index b2c9888a..d81f21c1 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -6,14 +6,15 @@ import sys from dataclasses import dataclass from slpkg.checks import Check -from slpkg.view_package import ViewPackage from slpkg.upgrade import Upgrade from slpkg.version import Version from slpkg.configs import Configs from slpkg.utilities import Utilities +from slpkg.search import SearchPackage from slpkg.views.cli_menu import usage from slpkg.download_only import Download from slpkg.slackbuild import Slackbuilds +from slpkg.view_package import ViewPackage from slpkg.find_installed import FindInstalled from slpkg.remove_packages import RemovePackages from slpkg.clean_logs import CleanLogsDependencies @@ -143,6 +144,18 @@ class Argparse: raise SystemExit() usage(1) + def search(self): + if len(self.args) >= 2 and not self.flags: + packages = list(set(self.args[1:])) + packages = self.check.blacklist(packages) + + # self.check.exists(packages) + + search = SearchPackage() + search.package(packages) + raise SystemExit() + usage(1) + def find(self): if len(self.args) >= 2 and not self.flags: packages = list(set(self.args[1:])) @@ -195,6 +208,7 @@ def main(): 'remove': argparse.remove, 'view': argparse.view, 'find': argparse.find, + 'search': argparse.search, 'clean-logs': argparse.clean_logs, 'clean-tmp': argparse.clean_tmp } diff --git a/slpkg/search.py b/slpkg/search.py new file mode 100644 index 00000000..3e1a1e99 --- /dev/null +++ b/slpkg/search.py @@ -0,0 +1,20 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + + +from dataclasses import dataclass + +from slpkg.queries import SBoQueries + + +@dataclass +class SearchPackage: + + def package(self, packages): + names = SBoQueries('').names() + + for name in names: + for package in packages: + if package in name: + print(f'{name}-{SBoQueries(name).version()} ' + f'{SBoQueries(name).description()}') diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 696d67ee..5cf78c30 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -27,6 +27,7 @@ def usage(status: int): f' {CYAN}remove{ENDC} Remove installed packages.', f' {CYAN}find{ENDC} Find installed packages.', f' {CYAN}view{ENDC} View packages from the repository.', + f' {CYAN}search{ENDC} Search packages from the repository.', f' {CYAN}clean-logs{ENDC} Clean dependencies log tracking.', f' {CYAN}clean-tmp{ENDC} Delete all the downloaded sources.\n', f'{BOLD}OPTIONS:{ENDC}', From 2eba52c1b7a89b4b32ee57e0125ec0005ca1f202 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 24 Oct 2022 20:01:01 +0300 Subject: [PATCH 08/12] Removed unused Signed-off-by: Dimitris Zlatanidis --- slpkg/main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index d81f21c1..fc2c49a3 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -149,8 +149,6 @@ class Argparse: packages = list(set(self.args[1:])) packages = self.check.blacklist(packages) - # self.check.exists(packages) - search = SearchPackage() search.package(packages) raise SystemExit() From ae40b6130e253c85d6d04bb7057840fc25090059 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 24 Oct 2022 20:09:03 +0300 Subject: [PATCH 09/12] Added color in description Signed-off-by: Dimitris Zlatanidis --- slpkg/search.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/slpkg/search.py b/slpkg/search.py index 3e1a1e99..b6ceae9e 100644 --- a/slpkg/search.py +++ b/slpkg/search.py @@ -5,16 +5,22 @@ from dataclasses import dataclass from slpkg.queries import SBoQueries +from slpkg.configs import Configs @dataclass class SearchPackage: + colors: dict = Configs.colour def package(self, packages): + color = self.colors() + CYAN = color['CYAN'] + ENDC = color['ENDC'] + names = SBoQueries('').names() for name in names: for package in packages: if package in name: print(f'{name}-{SBoQueries(name).version()} ' - f'{SBoQueries(name).description()}') + f'{CYAN}{SBoQueries(name).description()}{ENDC}') From 496ccc25ec439c60ca15804d6c1da0ad3d9704a4 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 24 Oct 2022 20:11:34 +0300 Subject: [PATCH 10/12] Removed name from description Signed-off-by: Dimitris Zlatanidis --- slpkg/search.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/slpkg/search.py b/slpkg/search.py index b6ceae9e..958e1f9d 100644 --- a/slpkg/search.py +++ b/slpkg/search.py @@ -22,5 +22,6 @@ class SearchPackage: for name in names: for package in packages: if package in name: - print(f'{name}-{SBoQueries(name).version()} ' - f'{CYAN}{SBoQueries(name).description()}{ENDC}') + desc = SBoQueries(name).description().replace(name, '') + print(f'{name}-{SBoQueries(name).version()}' + f'{CYAN}{desc}{ENDC}') From 53fd7bf9c10c323e870c7e028889f375e4629d90 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 24 Oct 2022 20:15:15 +0300 Subject: [PATCH 11/12] Added color for readme Signed-off-by: Dimitris Zlatanidis --- slpkg/view_package.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slpkg/view_package.py b/slpkg/view_package.py index dc760b31..0d9efeea 100644 --- a/slpkg/view_package.py +++ b/slpkg/view_package.py @@ -22,6 +22,7 @@ class ViewPackage: GREEN = color['GREEN'] BLUE = color['BLUE'] YELLOW = color['YELLOW'] + CYAN = color['CYAN'] ENDC = color['ENDC'] for package in packages: @@ -51,4 +52,4 @@ class ViewPackage: f'Files: {GREEN}{info[7]}{ENDC}\n' f'Description: {GREEN}{info[8]}{ENDC}\n' f'SBo url: {BLUE}{self.sbo_repo_url}/{info[9]}/{info[0]}{ENDC}\n' - f'README: {readme.data.decode()}') + f'README: {CYAN}{readme.data.decode()}{ENDC}') From 75cca386b76a295a67eb675a1e4bcda437a80314 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 28 Oct 2022 08:42:51 +0300 Subject: [PATCH 12/12] Added some information Signed-off-by: Dimitris Zlatanidis --- slpkg/find_installed.py | 4 ++++ slpkg/search.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/slpkg/find_installed.py b/slpkg/find_installed.py index f3ea255c..62904a72 100644 --- a/slpkg/find_installed.py +++ b/slpkg/find_installed.py @@ -15,6 +15,10 @@ class FindInstalled: def find(self, packages: list): matching = [] + + print(f'The list below shows the packages ' + f'that contains \'{", ".join([p for p in packages])}\' files:\n') + for pkg in packages: for package in os.listdir(self.log_packages): if pkg in package and self.sbo_repo_tag in package: diff --git a/slpkg/search.py b/slpkg/search.py index 958e1f9d..ca069db5 100644 --- a/slpkg/search.py +++ b/slpkg/search.py @@ -19,6 +19,9 @@ class SearchPackage: names = SBoQueries('').names() + print(f'The list below shows the packages ' + f'that contains \'{", ".join([p for p in packages])}\' files:\n') + for name in names: for package in packages: if package in name: