From 477a9691b80188baf294e10c9ecf147ed7bd6327 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 18 Oct 2022 22:13:30 +0300 Subject: [PATCH 01/10] Added print README in the search option Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 4 ++++ slpkg/create_data.py | 26 +++++++++++++------------- slpkg/dependencies.py | 2 +- slpkg/search.py | 9 +++++++-- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f1d78603..89a283eb 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.2.1 - 18/10/2022 +Added: +- Print the README file in the search option + 4.2.0 - 14/10/2022 Updated: - Moved option --download-only to commands diff --git a/slpkg/create_data.py b/slpkg/create_data.py index 9eba7bd6..be1308c8 100644 --- a/slpkg/create_data.py +++ b/slpkg/create_data.py @@ -20,19 +20,19 @@ class CreateData: def insert_sbo_table(self): sbo_tags = [ - "SLACKBUILD NAME:", - "SLACKBUILD LOCATION:", - "SLACKBUILD FILES:", - "SLACKBUILD VERSION:", - "SLACKBUILD DOWNLOAD:", - "SLACKBUILD DOWNLOAD_x86_64:", - "SLACKBUILD MD5SUM:", - "SLACKBUILD MD5SUM_x86_64:", - "SLACKBUILD REQUIRES:", - "SLACKBUILD SHORT DESCRIPTION:" + 'SLACKBUILD NAME:', + 'SLACKBUILD LOCATION:', + 'SLACKBUILD FILES:', + 'SLACKBUILD VERSION:', + 'SLACKBUILD DOWNLOAD:', + 'SLACKBUILD DOWNLOAD_x86_64:', + 'SLACKBUILD MD5SUM:', + 'SLACKBUILD MD5SUM_x86_64:', + 'SLACKBUILD REQUIRES:', + 'SLACKBUILD SHORT DESCRIPTION:' ] - sbo_file = self.read_file(f"{self.sbo_repo_path}/SLACKBUILDS.TXT") + sbo_file = self.read_file(f'{self.sbo_repo_path}/SLACKBUILDS.TXT') cache = [] # init cache @@ -42,7 +42,7 @@ class CreateData: for tag in sbo_tags: if line.startswith(tag): - line = line.replace(tag, "").strip() + line = line.replace(tag, '').strip() cache.append(line) if (i % 11) == 0: @@ -60,5 +60,5 @@ class CreateData: self.session.commit() def read_file(self, file: str): - with open(file, "r", encoding="utf-8") as f: + with open(file, 'r', encoding='utf-8') as f: return f.readlines() diff --git a/slpkg/dependencies.py b/slpkg/dependencies.py index 13c462b3..ce180768 100644 --- a/slpkg/dependencies.py +++ b/slpkg/dependencies.py @@ -17,7 +17,7 @@ class Requires: requires = SBoQueries(self.name).requires() for req in requires: - if req and req != "%README%": + if req and req != '%README%': sub = SBoQueries(req).requires() for s in sub: requires.append(s) diff --git a/slpkg/search.py b/slpkg/search.py index 048bbc87..91c84059 100644 --- a/slpkg/search.py +++ b/slpkg/search.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- +import urllib3 from dataclasses import dataclass from slpkg.configs import Configs @@ -16,6 +17,7 @@ class Search: sbo_url: str = Configs.sbo_url def package(self, packages): + http = urllib3.PoolManager() color = self.colors() GREEN = color['GREEN'] BLUE = color['BLUE'] @@ -36,6 +38,9 @@ class Search: SBoTable.location ).filter(SBoTable.name == package).first() + readme = http.request( + 'GET', f'{self.sbo_url}/{info[9]}/{info[0]}/README') + print(f'Name: {GREEN}{info[0]}{ENDC}\n' f'Version: {GREEN}{info[1]}{ENDC}\n' f'Requires: {GREEN}{info[2]}{ENDC}\n' @@ -45,5 +50,5 @@ class Search: f'Md5sum_x86_64: {YELLOW}{info[6]}{ENDC}\n' f'Files: {GREEN}{info[7]}{ENDC}\n' f'Description: {GREEN}{info[8]}{ENDC}\n' - f'SBo url: {BLUE}{self.sbo_url}/{info[9]}/' - f'{info[0]}{ENDC}\n') + f'SBo url: {BLUE}{self.sbo_url}/{info[9]}/{info[0]}{ENDC}\n' + f'README: {readme.data.decode()}') From 7061252688089a1f42503a67915e01e26bfbaf5a Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 19 Oct 2022 19:55:45 +0300 Subject: [PATCH 02/10] Update configs for sbo repository Signed-off-by: Dimitris Zlatanidis --- configs/slpkg.yml | 6 +++--- slpkg/checks.py | 4 ++-- slpkg/configs.py | 12 ++++++------ slpkg/download_only.py | 4 ++-- slpkg/find_installed.py | 4 ++-- slpkg/slackbuild.py | 6 ++---- slpkg/upgrade.py | 4 ++-- slpkg/views/views.py | 4 ++-- tests/test_configs.py | 12 ++++++------ 9 files changed, 27 insertions(+), 29 deletions(-) diff --git a/configs/slpkg.yml b/configs/slpkg.yml index de2c1d61..27632e2d 100644 --- a/configs/slpkg.yml +++ b/configs/slpkg.yml @@ -13,9 +13,9 @@ configs: repo_version: 15.0 sbo_url: http://slackbuilds.org/slackbuilds/15.0 sbo_txt: SLACKBUILDS.TXT - tar_suffix: .tar.gz - pkg_suffix: .tgz - repo_tag: _SBo + sbo_tar_suffix: .tar.gz + sbo_pkg_suffix: .tgz + sbo_repo_tag: _SBo installpkg: upgradepkg --install-new reinstall: upgradepkg --reinstall removepkg: removepkg diff --git a/slpkg/checks.py b/slpkg/checks.py index 53b95a5f..4a701292 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -13,7 +13,7 @@ from slpkg.blacklist import Blacklist class Check: ''' Some checks before proceed. ''' log_packages: str = Configs.log_packages - repo_tag: str = Configs.repo_tag + sbo_repo_tag: str = Configs.sbo_repo_tag def exists(self, slackbuilds: list): ''' Checking if the slackbuild exists in the repository. ''' @@ -42,7 +42,7 @@ class Check: for package in os.listdir(self.log_packages): for sbo in slackbuilds: - if sbo + '-' in package and self.repo_tag in package: + if sbo + '-' in package and self.sbo_repo_tag in package: return raise SystemExit('\nNot found installed packages.\n') diff --git a/slpkg/configs.py b/slpkg/configs.py index 6bf64405..b8e59759 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -36,9 +36,9 @@ class Configs: repo_version: str = '15.0' sbo_url: str = f'http://slackbuilds.org/slackbuilds/{repo_version}' sbo_txt: str = 'SLACKBUILDS.TXT' - tar_suffix: str = '.tar.gz' - pkg_suffix: str = '.tgz' - repo_tag: str = '_SBo' + sbo_tar_suffix: str = '.tar.gz' + sbo_pkg_suffix: str = '.tgz' + sbo_repo_tag: str = '_SBo' # Slackware commands installpkg: str = 'upgradepkg --install-new' @@ -83,9 +83,9 @@ class Configs: repo_version: str = config['repo_version'] sbo_url: str = config['sbo_url'] sbo_txt: str = config['sbo_txt'] - tar_suffix: str = config['tar_suffix'] - pkg_suffix: str = config['pkg_suffix'] - repo_tag: str = config['repo_tag'] + sbo_tar_suffix: str = config['tar_suffix'] + sbo_pkg_suffix: str = config['pkg_suffix'] + sbo_repo_tag: str = config['repo_tag'] # Slackware commands installpkg: str = config['installpkg'] diff --git a/slpkg/download_only.py b/slpkg/download_only.py index 38f7492b..b0c865dc 100644 --- a/slpkg/download_only.py +++ b/slpkg/download_only.py @@ -17,7 +17,7 @@ class Download: session: str = Session download_only = Configs.download_only sbo_url: str = Configs.sbo_url - tar_suffix: str = Configs.tar_suffix + sbo_tar_suffix: str = Configs.sbo_tar_suffix def packages(self, slackbuilds: list): @@ -27,7 +27,7 @@ class Download: wget = Wget() for sbo in slackbuilds: - file = f'{sbo}{self.tar_suffix}' + file = f'{sbo}{self.sbo_tar_suffix}' location = SBoQueries(sbo).location() url = f'{self.sbo_url}/{location}/{file}' diff --git a/slpkg/find_installed.py b/slpkg/find_installed.py index 7e41e345..f3ea255c 100644 --- a/slpkg/find_installed.py +++ b/slpkg/find_installed.py @@ -11,13 +11,13 @@ from slpkg.configs import Configs class FindInstalled: log_packages: str = Configs.log_packages colors: dict = Configs.colour - repo_tag: str = Configs.repo_tag + sbo_repo_tag: str = Configs.sbo_repo_tag def find(self, packages: list): matching = [] for pkg in packages: for package in os.listdir(self.log_packages): - if pkg in package and self.repo_tag in package: + if pkg in package and self.sbo_repo_tag in package: matching.append(package) self.matched(matching) diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 00c04553..09697251 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -32,9 +32,7 @@ class Slackbuilds: build_path: str = Configs.build_path tmp_slpkg: str = Configs.tmp_slpkg tmp_path: str = Configs.tmp_path - tar_suffix: str = Configs.tar_suffix - repo_tag: str = Configs.repo_tag - pkg_suffix: str = Configs.pkg_suffix + sbo_tar_suffix: str = Configs.sbo_tar_suffix installpkg: str = Configs.installpkg reinstall: str = Configs.reinstall @@ -98,7 +96,7 @@ class Slackbuilds: wget = Wget() for sbo in self.install_order: - file = f'{sbo}{self.tar_suffix}' + file = f'{sbo}{self.sbo_tar_suffix}' self.utils.remove_file_if_exists(self.tmp_slpkg, file) self.utils.remove_folder_if_exists(self.build_path, sbo) diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index c6b112d0..9045bda7 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -12,12 +12,12 @@ from slpkg.queries import SBoQueries @dataclass class Upgrade: log_packages: str = Configs.log_packages - repo_tag: str = Configs.repo_tag + sbo_repo_tag: str = Configs.sbo_repo_tag def packages(self): ''' Compares version of packages and returns the maximum. ''' for pkg in os.listdir(self.log_packages): - if pkg.endswith(self.repo_tag): + if pkg.endswith(self.sbo_repo_tag): name = '-'.join(pkg.split('-')[:-3]) installed_ver = pkg.replace(name + '-', '').split('-')[0] repo_ver = SBoQueries(name).version() diff --git a/slpkg/views/views.py b/slpkg/views/views.py index 90e3741a..6b0f7f39 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -17,7 +17,7 @@ class ViewMessage: flags: list colors: dict = Configs.colour log_packages: str = Configs.log_packages - repo_tag: str = Configs.repo_tag + sbo_repo_tag: str = Configs.sbo_repo_tag arch: str = Configs.os_arch session: str = Session utils: str = Utilities() @@ -131,7 +131,7 @@ class ViewMessage: for package in installed: black = package.split('-')[0] - if (package.startswith(name) and self.repo_tag in package and + if (package.startswith(name) and self.sbo_repo_tag in package and black not in self.black.get()): self.installed_packages.append(package) print(f'[{color["RED"]} delete {color["ENDC"]}] -> {package}') diff --git a/tests/test_configs.py b/tests/test_configs.py index 0f35d22c..9b3fc51a 100644 --- a/tests/test_configs.py +++ b/tests/test_configs.py @@ -7,9 +7,9 @@ class TestConfigs(unittest.TestCase): def setUp(self): self.repo_version = Configs.repo_version self.sbo_txt = Configs.sbo_txt - self.tar_suffix = Configs.tar_suffix - self.pkg_suffix = Configs.pkg_suffix - self.repo_tag = Configs.repo_tag + self.sbo_tar_suffix = Configs.sbo_tar_suffix + self.sbo_pkg_suffix = Configs.sbo_pkg_suffix + self.sbo_repo_tag = Configs.sbo_repo_tag self.os_arch = Configs.os_arch def test_repo_version(self): @@ -19,13 +19,13 @@ class TestConfigs(unittest.TestCase): self.assertEqual('SLACKBUILDS.TXT', self.sbo_txt) def test_tar_suffix(self): - self.assertEqual('.tar.gz', self.tar_suffix) + self.assertEqual('.tar.gz', self.sbo_tar_suffix) def test_pkg_suffix(self): - self.assertEqual('.tgz', self.pkg_suffix) + self.assertEqual('.tgz', self.sbo_pkg_suffix) def test_repo_tag(self): - self.assertEqual('_SBo', self.repo_tag) + self.assertEqual('_SBo', self.sbo_repo_tag) def test_os_arch(self): self.assertEqual('x86_64', self.os_arch) From 09e02e3daa33c3cdff333f91337e7de8aabff987 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 19 Oct 2022 20:01:32 +0300 Subject: [PATCH 03/10] Removed unused Signed-off-by: Dimitris Zlatanidis --- configs/slpkg.yml | 1 - slpkg/configs.py | 2 -- tests/test_configs.py | 4 ---- 3 files changed, 7 deletions(-) diff --git a/configs/slpkg.yml b/configs/slpkg.yml index 27632e2d..3e032f21 100644 --- a/configs/slpkg.yml +++ b/configs/slpkg.yml @@ -14,7 +14,6 @@ configs: sbo_url: http://slackbuilds.org/slackbuilds/15.0 sbo_txt: SLACKBUILDS.TXT sbo_tar_suffix: .tar.gz - sbo_pkg_suffix: .tgz sbo_repo_tag: _SBo installpkg: upgradepkg --install-new reinstall: upgradepkg --reinstall diff --git a/slpkg/configs.py b/slpkg/configs.py index b8e59759..090d3d8e 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -37,7 +37,6 @@ class Configs: sbo_url: str = f'http://slackbuilds.org/slackbuilds/{repo_version}' sbo_txt: str = 'SLACKBUILDS.TXT' sbo_tar_suffix: str = '.tar.gz' - sbo_pkg_suffix: str = '.tgz' sbo_repo_tag: str = '_SBo' # Slackware commands @@ -84,7 +83,6 @@ class Configs: sbo_url: str = config['sbo_url'] sbo_txt: str = config['sbo_txt'] sbo_tar_suffix: str = config['tar_suffix'] - sbo_pkg_suffix: str = config['pkg_suffix'] sbo_repo_tag: str = config['repo_tag'] # Slackware commands diff --git a/tests/test_configs.py b/tests/test_configs.py index 9b3fc51a..eed7e1a5 100644 --- a/tests/test_configs.py +++ b/tests/test_configs.py @@ -8,7 +8,6 @@ class TestConfigs(unittest.TestCase): self.repo_version = Configs.repo_version self.sbo_txt = Configs.sbo_txt self.sbo_tar_suffix = Configs.sbo_tar_suffix - self.sbo_pkg_suffix = Configs.sbo_pkg_suffix self.sbo_repo_tag = Configs.sbo_repo_tag self.os_arch = Configs.os_arch @@ -21,9 +20,6 @@ class TestConfigs(unittest.TestCase): def test_tar_suffix(self): self.assertEqual('.tar.gz', self.sbo_tar_suffix) - def test_pkg_suffix(self): - self.assertEqual('.tgz', self.sbo_pkg_suffix) - def test_repo_tag(self): self.assertEqual('_SBo', self.sbo_repo_tag) From cce92e779339254b8e83a272f19fccf0d8a068bf Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 19 Oct 2022 20:18:13 +0300 Subject: [PATCH 04/10] Added-updated comments Signed-off-by: Dimitris Zlatanidis --- configs/slpkg.yml | 13 +++++++++++++ slpkg/configs.py | 14 ++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/configs/slpkg.yml b/configs/slpkg.yml index 3e032f21..0be2f7da 100644 --- a/configs/slpkg.yml +++ b/configs/slpkg.yml @@ -1,5 +1,8 @@ configs: + # OS architecture by default os_arch: x86_64 + + # All necessary paths tmp_path: /tmp tmp_slpkg: /tmp/slpkg build_path: /tmp/slpkg/build @@ -9,14 +12,24 @@ configs: db_path: /var/lib/slpkg/database sbo_repo_path: /var/lib/slpkg/repository log_packages: /var/log/packages + + # Database name database: database.slpkg + + # SBo repository configs repo_version: 15.0 sbo_url: http://slackbuilds.org/slackbuilds/15.0 sbo_txt: SLACKBUILDS.TXT sbo_tar_suffix: .tar.gz sbo_repo_tag: _SBo + + # Slackware commands installpkg: upgradepkg --install-new reinstall: upgradepkg --reinstall removepkg: removepkg + + # Cli menu colors configs colors: on + + # Wget options wget_options: -c -N diff --git a/slpkg/configs.py b/slpkg/configs.py index 090d3d8e..f2074f70 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -32,7 +32,7 @@ class Configs: # Database name database: str = f'database.{prog_name}' - # Repository details + # SBo repository configs repo_version: str = '15.0' sbo_url: str = f'http://slackbuilds.org/slackbuilds/{repo_version}' sbo_txt: str = 'SLACKBUILDS.TXT' @@ -44,8 +44,10 @@ class Configs: reinstall: str = 'upgradepkg --reinstall' removepkg: str = 'removepkg' - # Other configs + # Cli menu colors configs colors: str = 'on' + + # Wget options wget_options = '-c -N' # Creating the build path @@ -59,6 +61,7 @@ class Configs: configs = yaml.safe_load(conf) try: + config = configs['configs'] # OS architecture by default @@ -78,7 +81,7 @@ class Configs: # Database name database: str = config['database'] - # Repository details + # SBo repository details repo_version: str = config['repo_version'] sbo_url: str = config['sbo_url'] sbo_txt: str = config['sbo_txt'] @@ -90,9 +93,12 @@ class Configs: reinstall: str = config['reinstall'] removepkg: str = config['removepkg'] - # Other configs + # Cli menu colors configs colors: str = config['colors'] + + # Wget options wget_options: str = config['wget_options'] + except KeyError: pass From 2919edabe75a5e0412823258aa5a7ee08be02a33 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 19 Oct 2022 20:21:18 +0300 Subject: [PATCH 05/10] Update repo version for sbo only Signed-off-by: Dimitris Zlatanidis --- configs/slpkg.yml | 2 +- slpkg/configs.py | 6 +++--- tests/test_configs.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configs/slpkg.yml b/configs/slpkg.yml index 0be2f7da..d16b9fe0 100644 --- a/configs/slpkg.yml +++ b/configs/slpkg.yml @@ -17,7 +17,7 @@ configs: database: database.slpkg # SBo repository configs - repo_version: 15.0 + sbo_repo_version: 15.0 sbo_url: http://slackbuilds.org/slackbuilds/15.0 sbo_txt: SLACKBUILDS.TXT sbo_tar_suffix: .tar.gz diff --git a/slpkg/configs.py b/slpkg/configs.py index f2074f70..89e45c1a 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -33,8 +33,8 @@ class Configs: database: str = f'database.{prog_name}' # SBo repository configs - repo_version: str = '15.0' - sbo_url: str = f'http://slackbuilds.org/slackbuilds/{repo_version}' + sbo_repo_version: str = '15.0' + sbo_url: str = f'http://slackbuilds.org/slackbuilds/{sbo_repo_version}' sbo_txt: str = 'SLACKBUILDS.TXT' sbo_tar_suffix: str = '.tar.gz' sbo_repo_tag: str = '_SBo' @@ -82,7 +82,7 @@ class Configs: database: str = config['database'] # SBo repository details - repo_version: str = config['repo_version'] + sbo_repo_version: str = config['sbo_repo_version'] sbo_url: str = config['sbo_url'] sbo_txt: str = config['sbo_txt'] sbo_tar_suffix: str = config['tar_suffix'] diff --git a/tests/test_configs.py b/tests/test_configs.py index eed7e1a5..8b8a9fe4 100644 --- a/tests/test_configs.py +++ b/tests/test_configs.py @@ -5,14 +5,14 @@ from slpkg.configs import Configs class TestConfigs(unittest.TestCase): def setUp(self): - self.repo_version = Configs.repo_version + self.sbo_repo_version = Configs.sbo_repo_version self.sbo_txt = Configs.sbo_txt self.sbo_tar_suffix = Configs.sbo_tar_suffix self.sbo_repo_tag = Configs.sbo_repo_tag self.os_arch = Configs.os_arch def test_repo_version(self): - self.assertEqual(15.0, self.repo_version) + self.assertEqual(15.0, self.sbo_repo_version) def test_sbo_txt(self): self.assertEqual('SLACKBUILDS.TXT', self.sbo_txt) From d830324f86ac5200b049d0e369d1991b61b7c635 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 19 Oct 2022 21:04:53 +0300 Subject: [PATCH 06/10] Removed unused Signed-off-by: Dimitris Zlatanidis --- configs/slpkg.yml | 1 - slpkg/configs.py | 4 +--- tests/test_configs.py | 4 ---- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/configs/slpkg.yml b/configs/slpkg.yml index d16b9fe0..5642392c 100644 --- a/configs/slpkg.yml +++ b/configs/slpkg.yml @@ -17,7 +17,6 @@ configs: database: database.slpkg # SBo repository configs - sbo_repo_version: 15.0 sbo_url: http://slackbuilds.org/slackbuilds/15.0 sbo_txt: SLACKBUILDS.TXT sbo_tar_suffix: .tar.gz diff --git a/slpkg/configs.py b/slpkg/configs.py index 89e45c1a..524e24b6 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -33,8 +33,7 @@ class Configs: database: str = f'database.{prog_name}' # SBo repository configs - sbo_repo_version: str = '15.0' - sbo_url: str = f'http://slackbuilds.org/slackbuilds/{sbo_repo_version}' + sbo_url: str = 'http://slackbuilds.org/slackbuilds/15.0' sbo_txt: str = 'SLACKBUILDS.TXT' sbo_tar_suffix: str = '.tar.gz' sbo_repo_tag: str = '_SBo' @@ -82,7 +81,6 @@ class Configs: database: str = config['database'] # SBo repository details - sbo_repo_version: str = config['sbo_repo_version'] sbo_url: str = config['sbo_url'] sbo_txt: str = config['sbo_txt'] sbo_tar_suffix: str = config['tar_suffix'] diff --git a/tests/test_configs.py b/tests/test_configs.py index 8b8a9fe4..394aa167 100644 --- a/tests/test_configs.py +++ b/tests/test_configs.py @@ -5,15 +5,11 @@ from slpkg.configs import Configs class TestConfigs(unittest.TestCase): def setUp(self): - self.sbo_repo_version = Configs.sbo_repo_version self.sbo_txt = Configs.sbo_txt self.sbo_tar_suffix = Configs.sbo_tar_suffix self.sbo_repo_tag = Configs.sbo_repo_tag self.os_arch = Configs.os_arch - def test_repo_version(self): - self.assertEqual(15.0, self.sbo_repo_version) - def test_sbo_txt(self): self.assertEqual('SLACKBUILDS.TXT', self.sbo_txt) From 9d3729efb39cda7a9d5fd8faf40b5ea535609cee Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 19 Oct 2022 21:10:07 +0300 Subject: [PATCH 07/10] Update configs for sbo repository Signed-off-by: Dimitris Zlatanidis --- configs/slpkg.yml | 2 +- slpkg/configs.py | 8 ++++---- slpkg/download_only.py | 4 ++-- slpkg/search.py | 6 +++--- slpkg/slackbuild.py | 4 ++-- slpkg/update_repository.py | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/configs/slpkg.yml b/configs/slpkg.yml index 5642392c..803f3301 100644 --- a/configs/slpkg.yml +++ b/configs/slpkg.yml @@ -17,7 +17,7 @@ configs: database: database.slpkg # SBo repository configs - sbo_url: http://slackbuilds.org/slackbuilds/15.0 + sbo_repo_url: http://slackbuilds.org/slackbuilds/15.0 sbo_txt: SLACKBUILDS.TXT sbo_tar_suffix: .tar.gz sbo_repo_tag: _SBo diff --git a/slpkg/configs.py b/slpkg/configs.py index 524e24b6..0c3d2c84 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -33,7 +33,7 @@ class Configs: database: str = f'database.{prog_name}' # SBo repository configs - sbo_url: str = 'http://slackbuilds.org/slackbuilds/15.0' + sbo_repo_url: str = 'http://slackbuilds.org/slackbuilds/15.0' sbo_txt: str = 'SLACKBUILDS.TXT' sbo_tar_suffix: str = '.tar.gz' sbo_repo_tag: str = '_SBo' @@ -81,10 +81,10 @@ class Configs: database: str = config['database'] # SBo repository details - sbo_url: str = config['sbo_url'] + sbo_repo_url: str = config['sbo_repo_url'] sbo_txt: str = config['sbo_txt'] - sbo_tar_suffix: str = config['tar_suffix'] - sbo_repo_tag: str = config['repo_tag'] + sbo_tar_suffix: str = config['sbo_tar_suffix'] + sbo_repo_tag: str = config['sbo_repo_tag'] # Slackware commands installpkg: str = config['installpkg'] diff --git a/slpkg/download_only.py b/slpkg/download_only.py index b0c865dc..0900c281 100644 --- a/slpkg/download_only.py +++ b/slpkg/download_only.py @@ -16,7 +16,7 @@ class Download: flags: list session: str = Session download_only = Configs.download_only - sbo_url: str = Configs.sbo_url + sbo_repo_url: str = Configs.sbo_repo_url sbo_tar_suffix: str = Configs.sbo_tar_suffix def packages(self, slackbuilds: list): @@ -29,7 +29,7 @@ class Download: for sbo in slackbuilds: file = f'{sbo}{self.sbo_tar_suffix}' location = SBoQueries(sbo).location() - url = f'{self.sbo_url}/{location}/{file}' + url = f'{self.sbo_repo_url}/{location}/{file}' wget.download(self.download_only, url) diff --git a/slpkg/search.py b/slpkg/search.py index 91c84059..a302ecb6 100644 --- a/slpkg/search.py +++ b/slpkg/search.py @@ -14,7 +14,7 @@ from slpkg.models.models import session as Session class Search: session: str = Session colors: dict = Configs.colour - sbo_url: str = Configs.sbo_url + sbo_repo_url: str = Configs.sbo_repo_url def package(self, packages): http = urllib3.PoolManager() @@ -39,7 +39,7 @@ class Search: ).filter(SBoTable.name == package).first() readme = http.request( - 'GET', f'{self.sbo_url}/{info[9]}/{info[0]}/README') + 'GET', f'{self.sbo_repo_url}/{info[9]}/{info[0]}/README') print(f'Name: {GREEN}{info[0]}{ENDC}\n' f'Version: {GREEN}{info[1]}{ENDC}\n' @@ -50,5 +50,5 @@ class Search: f'Md5sum_x86_64: {YELLOW}{info[6]}{ENDC}\n' f'Files: {GREEN}{info[7]}{ENDC}\n' f'Description: {GREEN}{info[8]}{ENDC}\n' - f'SBo url: {BLUE}{self.sbo_url}/{info[9]}/{info[0]}{ENDC}\n' + f'SBo url: {BLUE}{self.sbo_repo_url}/{info[9]}/{info[0]}{ENDC}\n' f'README: {readme.data.decode()}') diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 09697251..885da919 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -28,7 +28,7 @@ class Slackbuilds: session: str = Session utils: str = Utilities() build_path: str = Configs.build_path - sbo_url: str = Configs.sbo_url + sbo_repo_url: str = Configs.sbo_repo_url build_path: str = Configs.build_path tmp_slpkg: str = Configs.tmp_slpkg tmp_path: str = Configs.tmp_path @@ -102,7 +102,7 @@ class Slackbuilds: self.utils.remove_folder_if_exists(self.build_path, sbo) location = SBoQueries(sbo).location() - url = f'{self.sbo_url}/{location}/{file}' + url = f'{self.sbo_repo_url}/{location}/{file}' wget.download(self.tmp_slpkg, url) diff --git a/slpkg/update_repository.py b/slpkg/update_repository.py index 1ad443c9..4ba0cad1 100644 --- a/slpkg/update_repository.py +++ b/slpkg/update_repository.py @@ -18,7 +18,7 @@ from slpkg.models.models import session as Session class UpdateRepository: ''' Deletes and install the data. ''' sbo_repo_path: str = Configs.sbo_repo_path - url: str = Configs.sbo_url + url: str = Configs.sbo_repo_url sbo_txt: str = Configs.sbo_txt db_path: str = Configs.db_path database: str = Configs.database @@ -29,10 +29,10 @@ class UpdateRepository: self.delete_file(self.sbo_repo_path, self.sbo_txt) self.delete_sbo_data() - sbo_url = f'{self.url}/{self.sbo_txt}' + sbo_repo_url = f'{self.url}/{self.sbo_txt}' wget = Wget() - wget.download(self.sbo_repo_path, sbo_url) + wget.download(self.sbo_repo_path, sbo_repo_url) data = CreateData() data.insert_sbo_table() From 40657212afc65952055f95f5bf0e6b83fb211463 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 19 Oct 2022 21:12:15 +0300 Subject: [PATCH 08/10] Updated changelog Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 89a283eb..7565c939 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,8 @@ 4.2.1 - 18/10/2022 Added: - Print the README file in the search option +Updated: +- Configs for sbo repository 4.2.0 - 14/10/2022 Updated: From 67e28fecc7e4a9b4845ea01f1988ac7f6a2a43e8 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 19 Oct 2022 21:18:25 +0300 Subject: [PATCH 09/10] Updated comments in .yml files Signed-off-by: Dimitris Zlatanidis --- configs/blacklist.yml | 4 +++- configs/slpkg.yml | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/configs/blacklist.yml b/configs/blacklist.yml index 348c014f..e85b367d 100644 --- a/configs/blacklist.yml +++ b/configs/blacklist.yml @@ -1,2 +1,4 @@ blacklist: - packages: [] + + # Add packages and separate them with commas. + packages: [] diff --git a/configs/slpkg.yml b/configs/slpkg.yml index 803f3301..889b3fc4 100644 --- a/configs/slpkg.yml +++ b/configs/slpkg.yml @@ -1,8 +1,8 @@ configs: - # OS architecture by default + # OS architecture by default. os_arch: x86_64 - # All necessary paths + # All necessary paths. tmp_path: /tmp tmp_slpkg: /tmp/slpkg build_path: /tmp/slpkg/build @@ -13,22 +13,22 @@ configs: sbo_repo_path: /var/lib/slpkg/repository log_packages: /var/log/packages - # Database name + # Database name. database: database.slpkg - # SBo repository configs + # SBo repository configs. sbo_repo_url: http://slackbuilds.org/slackbuilds/15.0 sbo_txt: SLACKBUILDS.TXT sbo_tar_suffix: .tar.gz sbo_repo_tag: _SBo - # Slackware commands + # Slackware commands. installpkg: upgradepkg --install-new reinstall: upgradepkg --reinstall removepkg: removepkg - # Cli menu colors configs + # Cli menu colors configs. colors: on - # Wget options + # Wget options. wget_options: -c -N From 24122b79b4716efecea2159bbb2963cc363f36e2 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 20 Oct 2022 12:49:51 +0300 Subject: [PATCH 10/10] Updated for version 4.2.1 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 2cfbc7c7..41c1a295 100644 --- a/README.rst +++ b/README.rst @@ -30,8 +30,8 @@ Install from the official third-party `SBo repository