diff --git a/ChangeLog.txt b/ChangeLog.txt index 5e109acb..14c38f1c 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,10 @@ +4.3.0 - 23/11/2022 +Added: +- Message for blacklisted packages +- Homepage in the view command +Updated: +- The cli menu + 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..cb5d70c6 100644 --- a/README.rst +++ b/README.rst @@ -30,8 +30,8 @@ Install from the official third-party `SBo repository 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/setup.cfg b/setup.cfg index dc301d71..e02ef05a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = slpkg -version = 4.2.9 +version = 4.3.0 license_file = LICENSE author = Dimitris Zlatanidis author_email = d.zlatanidis@gmail.com diff --git a/slpkg/checks.py b/slpkg/checks.py index f57e9413..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. ''' @@ -49,14 +50,19 @@ 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 packages \'{", ".join(packages)}\' is blacklisted.\n' + f'Please edit the blacklist.yml file in {self.etc_path} ' + 'folder.\n') def database(self): ''' Checking for empty table ''' diff --git a/slpkg/main.py b/slpkg/main.py index 80094cd1..4a725391 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() @@ -230,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/version.py b/slpkg/version.py index f7472b0e..d4b52e85 100644 --- a/slpkg/version.py +++ b/slpkg/version.py @@ -10,7 +10,7 @@ from slpkg.configs import Configs @dataclass class Version: prog_name: str = Configs.prog_name - version_info: tuple = (4, 2, 9) + version_info: tuple = (4, 3, 0) version: str = '{0}.{1}.{2}'.format(*version_info) license: str = 'MIT License' author: str = 'dslackw' diff --git a/slpkg/view_package.py b/slpkg/view_package.py index f389b731..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' @@ -64,6 +67,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}') 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.']