From 0acbf687b5c59cebf81518f7b007d7a27d5ce7a7 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 23 Nov 2022 12:10:36 +0200 Subject: [PATCH 1/7] Switch to yellow Signed-off-by: Dimitris Zlatanidis --- slpkg/view_package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slpkg/view_package.py b/slpkg/view_package.py index f389b731..739661da 100644 --- a/slpkg/view_package.py +++ b/slpkg/view_package.py @@ -64,6 +64,6 @@ 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'Maintainer: {BLUE}{maintainer}{ENDC}\n' - f'Email: {BLUE}{email}{ENDC}\n' + f'Maintainer: {YELLOW}{maintainer}{ENDC}\n' + f'Email: {YELLOW}{email}{ENDC}\n' f'\nREADME: {CYAN}{readme.data.decode()}{ENDC}') From d5bca75e53ac5de55e9cce540f4253b12abd2ab0 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 23 Nov 2022 17:05:30 +0200 Subject: [PATCH 2/7] Updated for blacklist Signed-off-by: Dimitris Zlatanidis --- slpkg/checks.py | 9 ++++++--- slpkg/main.py | 12 ++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/slpkg/checks.py b/slpkg/checks.py index f57e9413..c9bf38ff 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -49,14 +49,17 @@ class Check: raise SystemExit('\nNot found installed packages.\n') def blacklist(self, slackbuilds: list): - ''' Checking for packages on the blacklist and removing them. ''' + ''' Checking if the packages are blacklisted. ''' + packages = [] black = Blacklist() for package in black.get(): if package in slackbuilds: - slackbuilds.remove(package) + packages.append(package) - return slackbuilds + if packages: + raise SystemExit( + f'\nThe package \'{", ".join(packages)}\' is blacklisted.\n') def database(self): ''' Checking for empty table ''' diff --git a/slpkg/main.py b/slpkg/main.py index 80094cd1..fcbac2a6 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -33,6 +33,8 @@ class Argparse: if len(self.args) == 0: usage(1) + self.check.blacklist(self.args) + def flag(self): self.flags = [] @@ -140,9 +142,6 @@ class Argparse: packages = list(set(self.args[1:])) self.check.database() - - packages = self.check.blacklist(packages) - self.check.installed(packages) remove = RemovePackages(packages, self.flags) @@ -155,9 +154,6 @@ class Argparse: packages = list(set(self.args[1:])) self.check.database() - - packages = self.check.blacklist(packages) - self.check.exists(packages) view = ViewPackage() @@ -171,8 +167,6 @@ class Argparse: self.check.database() - packages = self.check.blacklist(packages) - search = SearchPackage() search.package(packages) raise SystemExit() @@ -184,8 +178,6 @@ class Argparse: self.check.database() - packages = self.check.blacklist(packages) - find = FindInstalled() find.find(packages) raise SystemExit() From 3084395f75619c904c2fb7dfe0baf7e46d2c117d Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 23 Nov 2022 17:07:17 +0200 Subject: [PATCH 3/7] Updated for version 4.3.0 Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 4 ++++ README.rst | 4 ++-- setup.cfg | 2 +- slpkg/version.py | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 5e109acb..6853e61e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.3.0 - 23/11/2022 +Added: +- Message for blacklisted packages + 4.2.9 - 19/11/2022 Bugfixed: - slpkg upgrade fails when a package is blacklisted #149 diff --git a/README.rst b/README.rst index 5c759f40..b1c180ef 100644 --- a/README.rst +++ b/README.rst @@ -30,8 +30,8 @@ Install from the official third-party `SBo repository Date: Wed, 23 Nov 2022 19:33:13 +0200 Subject: [PATCH 4/7] Updated message Signed-off-by: Dimitris Zlatanidis --- slpkg/checks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slpkg/checks.py b/slpkg/checks.py index c9bf38ff..874ac698 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -59,7 +59,8 @@ class Check: if packages: raise SystemExit( - f'\nThe package \'{", ".join(packages)}\' is blacklisted.\n') + f'\nThe packages \'{", ".join(packages)}\' is blacklisted.\n' + 'Please edit the blacklist.yml file in /etc/slpkg folder.\n') def database(self): ''' Checking for empty table ''' From 5a2ac83b2a60ebf0eda5636acc3023e00f1bc3c5 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 23 Nov 2022 21:07:29 +0200 Subject: [PATCH 5/7] Updated with config Signed-off-by: Dimitris Zlatanidis --- slpkg/checks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/slpkg/checks.py b/slpkg/checks.py index 874ac698..8cc46435 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -16,6 +16,7 @@ class Check: sbo_repo_tag: str = Configs.sbo_repo_tag db_path: str = Configs.db_path database_name: str = Configs.database + etc_path: str = Configs.etc_path def exists(self, slackbuilds: list): ''' Checking if the slackbuild exists in the repository. ''' @@ -60,7 +61,8 @@ class Check: if packages: raise SystemExit( f'\nThe packages \'{", ".join(packages)}\' is blacklisted.\n' - 'Please edit the blacklist.yml file in /etc/slpkg folder.\n') + f'Please edit the blacklist.yml file in {self.etc_path} ' + 'folder.\n') def database(self): ''' Checking for empty table ''' From b91963ed9fd7d421b34163661cdb611be677c45b Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 23 Nov 2022 21:25:55 +0200 Subject: [PATCH 6/7] Updated the cli menu Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 2 ++ README.rst | 38 +++++++++++++++++++------------------- slpkg/main.py | 23 +++++++++++++++-------- slpkg/views/cli_menu.py | 38 +++++++++++++++++++------------------- 4 files changed, 55 insertions(+), 46 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6853e61e..b17cdc50 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,8 @@ 4.3.0 - 23/11/2022 Added: - Message for blacklisted packages +Updated: +- The cli menu 4.2.9 - 19/11/2022 Bugfixed: diff --git a/README.rst b/README.rst index b1c180ef..cb5d70c6 100644 --- a/README.rst +++ b/README.rst @@ -48,28 +48,28 @@ Usage Packaging tool that interacts with the SBo repository. COMMANDS: - update Update the package lists. - upgrade Upgrade all the packages. - check-updates Check for news on ChangeLog.txt. - build Build only the packages. - install Build and install the packages. - download Download only the scripts and sources. - 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. + update Update the package lists. + upgrade Upgrade all the packages. + check-updates Check for news on ChangeLog.txt. + clean-logs Clean dependencies log tracking. + clean-tmp Deletes all the downloaded sources. + -b, build Build only the packages. + -i, install Build and install the packages. + -d, download Download only the scripts and sources. + -r, remove Remove installed packages. + -f, find Find installed packages. + -w, view View packages from the repository. + -s, search Search packages from the repository. OPTIONS: - --yes Answer Yes to all questions. - --jobs Set it for multicore systems. - --resolve-off Turns off dependency resolving. - --reinstall Upgrade packages of the same version. - --skip-installed Skip installed packages. + --yes Answer Yes to all questions. + --jobs Set it for multicore systems. + --resolve-off Turns off dependency resolving. + --reinstall Upgrade packages of the same version. + --skip-installed Skip installed packages. - -h, --help Show this message and exit. - -v, --version Print version and exit. + -h, --help Show this message and exit. + -v, --version Print version and exit. If you need more information try to use slpkg manpage. diff --git a/slpkg/main.py b/slpkg/main.py index fcbac2a6..4a725391 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -222,15 +222,22 @@ def main(): 'update': argparse.update, 'upgrade': argparse.upgrade, 'check-updates': argparse.check_updates, - 'build': argparse.build, - 'install': argparse.install, - 'download': argparse.download, - 'remove': argparse.remove, - 'view': argparse.view, - 'find': argparse.find, - 'search': argparse.search, 'clean-logs': argparse.clean_logs, - 'clean-tmp': argparse.clean_tmp + 'clean-tmp': argparse.clean_tmp, + 'build': argparse.build, + '-b': argparse.build, + 'install': argparse.install, + '-i': argparse.install, + 'download': argparse.download, + '-d': argparse.download, + 'remove': argparse.remove, + '-r': argparse.remove, + 'view': argparse.view, + '-w': argparse.view, + 'find': argparse.find, + '-f': argparse.find, + 'search': argparse.search, + '-s': argparse.search } try: diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 80417829..15457d5c 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -19,26 +19,26 @@ def usage(status: int): f'{BOLD}DESCRIPTION:{ENDC}', ' Packaging tool that interacts with the SBo repository.\n', f'{BOLD}COMMANDS:{ENDC}', - f' {RED}update{ENDC} Update the package lists.', - f' {CYAN}upgrade{ENDC} Upgrade all the packages.', - f' {CYAN}check-updates{ENDC} Check for news on ChangeLog.txt.', - f' {CYAN}build{ENDC} Build only the packages.', - f' {CYAN}install{ENDC} Build and install the packages.', - f' {CYAN}download{ENDC} Download only the scripts and sources.', - 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' {RED}update{ENDC} Update the package lists.', + f' {CYAN}upgrade{ENDC} Upgrade all the packages.', + f' {CYAN}check-updates{ENDC} Check for news on ChangeLog.txt.', + f' {CYAN}clean-logs{ENDC} Clean dependencies log tracking.', + f' {CYAN}clean-tmp{ENDC} Delete all the downloaded sources.', + f' {CYAN}-b, build{ENDC} Build only the packages.', + f' {CYAN}-i, install{ENDC} Build and install the packages.', + f' {CYAN}-d, download{ENDC} Download only the scripts and sources.', + f' {CYAN}-r, remove{ENDC} Remove installed packages.', + f' {CYAN}-f, find{ENDC} Find installed packages.', + f' {CYAN}-w, view{ENDC} View packages from the repository.', + f' {CYAN}-s, search{ENDC} Search packages from the repository.\n', f'{BOLD}OPTIONS:{ENDC}', - f' {YELLOW}--yes{ENDC} Answer Yes to all questions.', - f' {YELLOW}--jobs{ENDC} Set it for multicore systems.', - f' {YELLOW}--resolve-off{ENDC} Turns off dependency resolving.', - f' {YELLOW}--reinstall{ENDC} Upgrade packages of the same version.', - f' {YELLOW}--skip-installed{ENDC} Skip installed packages.\n', - ' -h, --help Show this message and exit.', - ' -v, --version Print version and exit.\n', + f' {YELLOW}--yes{ENDC} Answer Yes to all questions.', + f' {YELLOW}--jobs{ENDC} Set it for multicore systems.', + f' {YELLOW}--resolve-off{ENDC} Turns off dependency resolving.', + f' {YELLOW}--reinstall{ENDC} Upgrade packages of the same version.', + f' {YELLOW}--skip-installed{ENDC} Skip installed packages.\n', + ' -h, --help Show this message and exit.', + ' -v, --version Print version and exit.\n', 'Edit the configuration file in the /etc/slpkg/slpkg.yml.', 'If you need more information try to use slpkg manpage.'] From 6d9a1290d435f6819fcff64fe9417435531793fa Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 24 Nov 2022 11:11:14 +0200 Subject: [PATCH 7/7] Added homepage Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 1 + slpkg/view_package.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index b17cdc50..14c38f1c 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,7 @@ 4.3.0 - 23/11/2022 Added: - Message for blacklisted packages +- Homepage in the view command Updated: - The cli menu diff --git a/slpkg/view_package.py b/slpkg/view_package.py index 739661da..524e4041 100644 --- a/slpkg/view_package.py +++ b/slpkg/view_package.py @@ -46,8 +46,10 @@ class ViewPackage: info_file = http.request( 'GET', f'{self.sbo_repo_url}/{info[9]}/{info[0]}/{info[0]}.info') - maintainer, email = '', '' + maintainer, email, homepage = '', '', '' for line in info_file.data.decode().splitlines(): + if line.startswith('HOMEPAGE'): + homepage = line[10:-1].strip() if line.startswith('MAINTAINER'): maintainer = line[12:-1].strip() if line.startswith('EMAIL'): @@ -56,6 +58,7 @@ class ViewPackage: print(f'Name: {GREEN}{info[0]}{ENDC}\n' f'Version: {GREEN}{info[1]}{ENDC}\n' f'Requires: {GREEN}{info[2]}{ENDC}\n' + f'Homepage: {BLUE}{homepage}{ENDC}\n' f'Download SlackBuild: {BLUE}{self.sbo_repo_url}/{info[9]}/{info[0]}{self.sbo_tar_suffix}{ENDC}\n' f'Download sources: {BLUE}{info[3]}{ENDC}\n' f'Download_x86_64 sources: {BLUE}{info[4]}{ENDC}\n'