Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2022-11-25 08:42:47 +02:00
commit 8b046b8aff
8 changed files with 81 additions and 66 deletions

View file

@ -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 4.2.9 - 19/11/2022
Bugfixed: Bugfixed:
- slpkg upgrade fails when a package is blacklisted #149 - slpkg upgrade fails when a package is blacklisted #149

View file

@ -30,8 +30,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
.. code-block:: bash .. code-block:: bash
$ tar xvf slpkg-4.2.9.tar.gz $ tar xvf slpkg-4.3.0.tar.gz
$ cd slpkg-4.2.9 $ cd slpkg-4.3.0
$ ./install.sh $ ./install.sh
@ -48,28 +48,28 @@ Usage
Packaging tool that interacts with the SBo repository. Packaging tool that interacts with the SBo repository.
COMMANDS: COMMANDS:
update Update the package lists. update Update the package lists.
upgrade Upgrade all the packages. upgrade Upgrade all the packages.
check-updates Check for news on ChangeLog.txt. check-updates Check for news on ChangeLog.txt.
build <packages> Build only the packages. clean-logs Clean dependencies log tracking.
install <packages> Build and install the packages. clean-tmp Deletes all the downloaded sources.
download <packages> Download only the scripts and sources. -b, build <packages> Build only the packages.
remove <packages> Remove installed packages. -i, install <packages> Build and install the packages.
find <packages> Find installed packages. -d, download <packages> Download only the scripts and sources.
view <packages> View packages from the repository. -r, remove <packages> Remove installed packages.
search <packages> Search packages from the repository. -f, find <packages> Find installed packages.
clean-logs Clean dependencies log tracking. -w, view <packages> View packages from the repository.
clean-tmp Deletes all the downloaded sources. -s, search <packages> Search packages from the repository.
OPTIONS: OPTIONS:
--yes Answer Yes to all questions. --yes Answer Yes to all questions.
--jobs Set it for multicore systems. --jobs Set it for multicore systems.
--resolve-off Turns off dependency resolving. --resolve-off Turns off dependency resolving.
--reinstall Upgrade packages of the same version. --reinstall Upgrade packages of the same version.
--skip-installed Skip installed packages. --skip-installed Skip installed packages.
-h, --help Show this message and exit. -h, --help Show this message and exit.
-v, --version Print version and exit. -v, --version Print version and exit.
If you need more information try to use slpkg manpage. If you need more information try to use slpkg manpage.

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = slpkg name = slpkg
version = 4.2.9 version = 4.3.0
license_file = LICENSE license_file = LICENSE
author = Dimitris Zlatanidis author = Dimitris Zlatanidis
author_email = d.zlatanidis@gmail.com author_email = d.zlatanidis@gmail.com

View file

@ -16,6 +16,7 @@ class Check:
sbo_repo_tag: str = Configs.sbo_repo_tag sbo_repo_tag: str = Configs.sbo_repo_tag
db_path: str = Configs.db_path db_path: str = Configs.db_path
database_name: str = Configs.database database_name: str = Configs.database
etc_path: str = Configs.etc_path
def exists(self, slackbuilds: list): def exists(self, slackbuilds: list):
''' Checking if the slackbuild exists in the repository. ''' ''' Checking if the slackbuild exists in the repository. '''
@ -49,14 +50,19 @@ class Check:
raise SystemExit('\nNot found installed packages.\n') raise SystemExit('\nNot found installed packages.\n')
def blacklist(self, slackbuilds: list): def blacklist(self, slackbuilds: list):
''' Checking for packages on the blacklist and removing them. ''' ''' Checking if the packages are blacklisted. '''
packages = []
black = Blacklist() black = Blacklist()
for package in black.get(): for package in black.get():
if package in slackbuilds: 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): def database(self):
''' Checking for empty table ''' ''' Checking for empty table '''

View file

@ -33,6 +33,8 @@ class Argparse:
if len(self.args) == 0: if len(self.args) == 0:
usage(1) usage(1)
self.check.blacklist(self.args)
def flag(self): def flag(self):
self.flags = [] self.flags = []
@ -140,9 +142,6 @@ class Argparse:
packages = list(set(self.args[1:])) packages = list(set(self.args[1:]))
self.check.database() self.check.database()
packages = self.check.blacklist(packages)
self.check.installed(packages) self.check.installed(packages)
remove = RemovePackages(packages, self.flags) remove = RemovePackages(packages, self.flags)
@ -155,9 +154,6 @@ class Argparse:
packages = list(set(self.args[1:])) packages = list(set(self.args[1:]))
self.check.database() self.check.database()
packages = self.check.blacklist(packages)
self.check.exists(packages) self.check.exists(packages)
view = ViewPackage() view = ViewPackage()
@ -171,8 +167,6 @@ class Argparse:
self.check.database() self.check.database()
packages = self.check.blacklist(packages)
search = SearchPackage() search = SearchPackage()
search.package(packages) search.package(packages)
raise SystemExit() raise SystemExit()
@ -184,8 +178,6 @@ class Argparse:
self.check.database() self.check.database()
packages = self.check.blacklist(packages)
find = FindInstalled() find = FindInstalled()
find.find(packages) find.find(packages)
raise SystemExit() raise SystemExit()
@ -230,15 +222,22 @@ def main():
'update': argparse.update, 'update': argparse.update,
'upgrade': argparse.upgrade, 'upgrade': argparse.upgrade,
'check-updates': argparse.check_updates, '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-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: try:

View file

@ -10,7 +10,7 @@ from slpkg.configs import Configs
@dataclass @dataclass
class Version: class Version:
prog_name: str = Configs.prog_name 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) version: str = '{0}.{1}.{2}'.format(*version_info)
license: str = 'MIT License' license: str = 'MIT License'
author: str = 'dslackw' author: str = 'dslackw'

View file

@ -46,8 +46,10 @@ class ViewPackage:
info_file = http.request( info_file = http.request(
'GET', f'{self.sbo_repo_url}/{info[9]}/{info[0]}/{info[0]}.info') '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(): for line in info_file.data.decode().splitlines():
if line.startswith('HOMEPAGE'):
homepage = line[10:-1].strip()
if line.startswith('MAINTAINER'): if line.startswith('MAINTAINER'):
maintainer = line[12:-1].strip() maintainer = line[12:-1].strip()
if line.startswith('EMAIL'): if line.startswith('EMAIL'):
@ -56,6 +58,7 @@ class ViewPackage:
print(f'Name: {GREEN}{info[0]}{ENDC}\n' print(f'Name: {GREEN}{info[0]}{ENDC}\n'
f'Version: {GREEN}{info[1]}{ENDC}\n' f'Version: {GREEN}{info[1]}{ENDC}\n'
f'Requires: {GREEN}{info[2]}{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 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 sources: {BLUE}{info[3]}{ENDC}\n'
f'Download_x86_64 sources: {BLUE}{info[4]}{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'Files: {GREEN}{info[7]}{ENDC}\n'
f'Description: {GREEN}{info[8]}{ENDC}\n' f'Description: {GREEN}{info[8]}{ENDC}\n'
f'SBo url: {BLUE}{self.sbo_repo_url}/{info[9]}/{info[0]}{ENDC}\n' f'SBo url: {BLUE}{self.sbo_repo_url}/{info[9]}/{info[0]}{ENDC}\n'
f'Maintainer: {BLUE}{maintainer}{ENDC}\n' f'Maintainer: {YELLOW}{maintainer}{ENDC}\n'
f'Email: {BLUE}{email}{ENDC}\n' f'Email: {YELLOW}{email}{ENDC}\n'
f'\nREADME: {CYAN}{readme.data.decode()}{ENDC}') f'\nREADME: {CYAN}{readme.data.decode()}{ENDC}')

View file

@ -19,26 +19,26 @@ def usage(status: int):
f'{BOLD}DESCRIPTION:{ENDC}', f'{BOLD}DESCRIPTION:{ENDC}',
' Packaging tool that interacts with the SBo repository.\n', ' Packaging tool that interacts with the SBo repository.\n',
f'{BOLD}COMMANDS:{ENDC}', f'{BOLD}COMMANDS:{ENDC}',
f' {RED}update{ENDC} Update the package lists.', f' {RED}update{ENDC} Update the package lists.',
f' {CYAN}upgrade{ENDC} Upgrade all the packages.', f' {CYAN}upgrade{ENDC} Upgrade all the packages.',
f' {CYAN}check-updates{ENDC} Check for news on ChangeLog.txt.', f' {CYAN}check-updates{ENDC} Check for news on ChangeLog.txt.',
f' {CYAN}build{ENDC} <packages> Build only the packages.', f' {CYAN}clean-logs{ENDC} Clean dependencies log tracking.',
f' {CYAN}install{ENDC} <packages> Build and install the packages.', f' {CYAN}clean-tmp{ENDC} Delete all the downloaded sources.',
f' {CYAN}download{ENDC} <packages> Download only the scripts and sources.', f' {CYAN}-b, build{ENDC} <packages> Build only the packages.',
f' {CYAN}remove{ENDC} <packages> Remove installed packages.', f' {CYAN}-i, install{ENDC} <packages> Build and install the packages.',
f' {CYAN}find{ENDC} <packages> Find installed packages.', f' {CYAN}-d, download{ENDC} <packages> Download only the scripts and sources.',
f' {CYAN}view{ENDC} <packages> View packages from the repository.', f' {CYAN}-r, remove{ENDC} <packages> Remove installed packages.',
f' {CYAN}search{ENDC} <packages> Search packages from the repository.', f' {CYAN}-f, find{ENDC} <packages> Find installed packages.',
f' {CYAN}clean-logs{ENDC} Clean dependencies log tracking.', f' {CYAN}-w, view{ENDC} <packages> View packages from the repository.',
f' {CYAN}clean-tmp{ENDC} Delete all the downloaded sources.\n', f' {CYAN}-s, search{ENDC} <packages> Search packages from the repository.\n',
f'{BOLD}OPTIONS:{ENDC}', f'{BOLD}OPTIONS:{ENDC}',
f' {YELLOW}--yes{ENDC} Answer Yes to all questions.', f' {YELLOW}--yes{ENDC} Answer Yes to all questions.',
f' {YELLOW}--jobs{ENDC} Set it for multicore systems.', f' {YELLOW}--jobs{ENDC} Set it for multicore systems.',
f' {YELLOW}--resolve-off{ENDC} Turns off dependency resolving.', f' {YELLOW}--resolve-off{ENDC} Turns off dependency resolving.',
f' {YELLOW}--reinstall{ENDC} Upgrade packages of the same version.', f' {YELLOW}--reinstall{ENDC} Upgrade packages of the same version.',
f' {YELLOW}--skip-installed{ENDC} Skip installed packages.\n', f' {YELLOW}--skip-installed{ENDC} Skip installed packages.\n',
' -h, --help Show this message and exit.', ' -h, --help Show this message and exit.',
' -v, --version Print version and exit.\n', ' -v, --version Print version and exit.\n',
'Edit the configuration file in the /etc/slpkg/slpkg.yml.', 'Edit the configuration file in the /etc/slpkg/slpkg.yml.',
'If you need more information try to use slpkg manpage.'] 'If you need more information try to use slpkg manpage.']