From 4d3c0a7778466d119b760841d0c7a2d2000c8bcc Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 30 Oct 2022 21:20:05 +0200 Subject: [PATCH 1/4] Added patching SBo TAG from the configuration file #147 Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 4 ++++ slpkg/slackbuild.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 311902d8..58e094cc 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.2.4 - 30/10/2022 +Added: +- Patching SBo TAG from the configuration file + 4.2.3 - 28/10/2022 Updated: - Creating all necessary paths from the config file diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 7f3407d8..c729bbe3 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -28,6 +28,7 @@ class Slackbuilds: session: str = Session utils: str = Utilities() build_path: str = Configs.build_path + sbo_repo_tag: str = Configs.sbo_repo_tag sbo_repo_url: str = Configs.sbo_repo_url build_path: str = Configs.build_path tmp_slpkg: str = Configs.tmp_slpkg @@ -107,6 +108,8 @@ class Slackbuilds: self.utils.untar_archive(self.tmp_slpkg, file, self.build_path) + self.patch_sbo_tag(sbo) + sources = SBoQueries(sbo).sources() self.download_sources(sbo, sources) @@ -120,6 +123,18 @@ class Slackbuilds: if '--resolve-off' not in self.flags: self.logging_installed_dependencies(sbo) + def patch_sbo_tag(self, sbo): + ''' Patching SBo TAG from the configuration file. ''' + sbo_script = f'{self.build_path}/{sbo}/{sbo}.SlackBuild' + with open(sbo_script, 'r', encoding='utf-8') as f: + lines = f.readlines() + + with open(sbo_script, 'w') as script: + for line in lines: + if line.startswith('TAG=$'): + line = f'TAG=${{TAG:-{self.sbo_repo_tag}}}\n' + script.write(line) + def logging_installed_dependencies(self, name: str): ''' Logging installed dependencies and used for remove. ''' exist = self.session.query(LogsDependencies.name).filter( From cd51d40aefd222e494c6edeac81e7b926c8c71e4 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 31 Oct 2022 08:52:20 +0200 Subject: [PATCH 2/4] Updated cli help menu #148 Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 2 ++ README.rst | 4 ++-- slpkg/views/cli_menu.py | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 58e094cc..513732de 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,8 @@ 4.2.4 - 30/10/2022 Added: - Patching SBo TAG from the configuration file +Updated: +- The cli help menu 4.2.3 - 28/10/2022 Updated: diff --git a/README.rst b/README.rst index f5233117..d6c2ac8b 100644 --- a/README.rst +++ b/README.rst @@ -52,7 +52,7 @@ Usage upgrade Upgrade all the packages. build Build only the packages. install Build and install the packages. - download Download only the packages. + download Download only the scripts and sources. remove Remove installed packages. find Find installed packages. view View packages from the repository. @@ -64,7 +64,7 @@ Usage --yes Answer Yes to all questions. --jobs Set it for multicore systems. --resolve-off Turns off dependency resolving. - --reinstall Use this option if you want to upgrade. + --reinstall Upgrade packages of the same version. --skip-installed Skip installed packages. -h, --help Show this message and exit. diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 5cf78c30..0c6091c6 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -23,7 +23,7 @@ def usage(status: int): f' {CYAN}upgrade{ENDC} Upgrade all the packages.', f' {CYAN}build{ENDC} Build only the packages.', f' {CYAN}install{ENDC} Build and install the packages.', - f' {CYAN}download{ENDC} Download only 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.', @@ -34,7 +34,7 @@ def usage(status: int): 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} Use this option if you want to upgrade.', + 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', From feca2904593cdf58057ab9db0adb20b21894bdfc Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 31 Oct 2022 18:27:12 +0200 Subject: [PATCH 3/4] Updated for version 4.2.4 Signed-off-by: Dimitris Zlatanidis --- README.rst | 6 +++--- man/slpkg.1 | 3 +-- setup.cfg | 2 +- slpkg/version.py | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index d6c2ac8b..1b64176f 100644 --- a/README.rst +++ b/README.rst @@ -30,8 +30,8 @@ Install from the official third-party `SBo repository Date: Mon, 31 Oct 2022 18:38:16 +0200 Subject: [PATCH 4/4] Added download SlackBuild script in the view command Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 1 + slpkg/view_package.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 513732de..4f05dae0 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,7 @@ 4.2.4 - 30/10/2022 Added: - Patching SBo TAG from the configuration file +- Download the SlackBuild script in the view command Updated: - The cli help menu diff --git a/slpkg/view_package.py b/slpkg/view_package.py index 0d9efeea..55fceae1 100644 --- a/slpkg/view_package.py +++ b/slpkg/view_package.py @@ -15,6 +15,7 @@ class ViewPackage: session: str = Session colors: dict = Configs.colour sbo_repo_url: str = Configs.sbo_repo_url + sbo_tar_suffix: str = Configs.sbo_tar_suffix def package(self, packages): http = urllib3.PoolManager() @@ -45,8 +46,9 @@ 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'Download: {BLUE}{info[3]}{ENDC}\n' - f'Download_x86_64: {BLUE}{info[4]}{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' f'Md5sum: {YELLOW}{info[5]}{ENDC}\n' f'Md5sum_x86_64: {YELLOW}{info[6]}{ENDC}\n' f'Files: {GREEN}{info[7]}{ENDC}\n'