From e1271271f3523a090a901b6576f97c88ad482f22 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 6 Oct 2022 20:45:46 +0300 Subject: [PATCH 01/13] Fixed manpage for yaml files Signed-off-by: Dimitris Zlatanidis --- man/slpkg.1 | 4 ++-- slackbuild/slpkg.SlackBuild | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/man/slpkg.1 b/man/slpkg.1 index 01b91762..a248e6a0 100644 --- a/man/slpkg.1 +++ b/man/slpkg.1 @@ -90,9 +90,9 @@ Print version and exit. .RE .SH CONFIGURATION FILES .P -Configuration file in the /etc/slpkg/slpkg.yaml file. +Configuration file in the /etc/slpkg/slpkg.yml file. .RE -Blacklist file in the /etc/slpkg/blacklist.yaml file. +Blacklist file in the /etc/slpkg/blacklist.yml file. .SH REPORT BUGS .P Please report any found to https://gitlab.com/dslackw/slpkg/-/issues. diff --git a/slackbuild/slpkg.SlackBuild b/slackbuild/slpkg.SlackBuild index 33145cc8..2475de78 100755 --- a/slackbuild/slpkg.SlackBuild +++ b/slackbuild/slpkg.SlackBuild @@ -99,7 +99,7 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr # Install configuration files and creating lib directory mkdir -p $PKG/etc/$PRGNAM $PKG/var/lib/$PRGNAM/database $PKG/var/lib/$PRGNAM/repository install -D -m0644 configs/slpkg.yml $PKG/etc/slpkg/slpkg.yml.new -install -D -m0644 configs/blacklist.yml $PKG/etc/slpkg/blacklist.yml.new +install -D -m0645 configs/blacklist.yml $PKG/etc/slpkg/blacklist.yml.new mkdir -p $PKG/usr/man/man1 cp man/slpkg.1 $PKG/usr/man/man1 From 30235f48b29c667401afda12504c26b4c5eba2f3 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 6 Oct 2022 20:47:41 +0300 Subject: [PATCH 02/13] Updated ChangeLog.txt Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 47a67e48..002ab3f4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.1.8 - 06/10/2022 +Updated: +- Manpage for .yaml files + 4.1.7 - 28/9/2022 Bugfixed: - Creating /var/lib/slpkg directory From 406348162450fad4dc38a57b1969d752b05ffcbd Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 8 Oct 2022 15:48:17 +0300 Subject: [PATCH 03/13] Updated error message --- slpkg/checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/checks.py b/slpkg/checks.py index 14ace112..53b95a5f 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -45,7 +45,7 @@ class Check: if sbo + '-' in package and self.repo_tag in package: return - raise SystemExit('\nNot found packages for remove.\n') + raise SystemExit('\nNot found installed packages.\n') def blacklist(self, slackbuilds: list): ''' Checking for packages on the blacklist and removing them. ''' From 059080269547d15da44db5922bf2ad6546497bb3 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 8 Oct 2022 20:40:01 +0300 Subject: [PATCH 04/13] Updated for version 4.1.8 Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 2 ++ README.rst | 5 +++-- man/slpkg.1 | 7 ++++++- slpkg/main.py | 3 ++- slpkg/slackbuild.py | 7 +++++++ slpkg/version.py | 2 +- slpkg/views/cli_menu.py | 3 ++- 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 002ab3f4..56acdfc0 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,8 @@ 4.1.8 - 06/10/2022 Updated: - Manpage for .yaml files +Added: +- New flag --skip-installed 4.1.7 - 28/9/2022 Bugfixed: diff --git a/README.rst b/README.rst index 6f34ffa8..06da5e84 100644 --- a/README.rst +++ b/README.rst @@ -30,8 +30,8 @@ Install from the official third-party `SBo repository .SH SYNAPSES .P -slpkg [-h|-v] [update] [upgrade] [build] [install] [remove] [find] [search] [clean-logs] [clean-tmp] --yes --resolve-off --reinstall +slpkg [-h|-v] [update] [upgrade] [build] [install] [remove] [find] [search] [clean-logs] [clean-tmp] --yes --resolve-off --reinstall --skip-installed .SH DESCRIPTION .P Slpkg is a software package manager that installs, updates, and removes packages on Slackware based systems. It automatically computes dependencies and figures out what things should occur to install packages. Slpkg makes it easier to maintain groups of machines without having to manually update. @@ -79,6 +79,11 @@ Turns off dependency resolving. Use this option if you want to upgrade all packages even if the same version is already installed. Do not skip installed packages. .RE .P +--skip-installed +.RS +This a helpful option if you want to avoid building and reinstalling packages. +.RE +.P -h | --help .RS Show help informatio and exit. diff --git a/slpkg/main.py b/slpkg/main.py index 7730df76..07ba6497 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -36,7 +36,8 @@ class Argparse: self.options = ['--yes', '--jobs', '--resolve-off', - '--reinstall' + '--reinstall', + '--skip-installed' ] for option in self.options: diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 46387001..a75dd349 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -90,6 +90,13 @@ class Slackbuilds: wget = Wget() for sbo in self.install_order: + pkg = f'{sbo}-{SBoQueries(sbo).version()}' + + if ('--skip-installed' in self.flags and + self.utils.is_installed(f'{pkg}-')): + print(f'Package {pkg} skipped.') + continue + file = f'{sbo}{self.tar_suffix}' self.utils.remove_file_if_exists(self.tmp_slpkg, file) diff --git a/slpkg/version.py b/slpkg/version.py index ac50dedd..2f3320b5 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, 1, 7) + version_info: tuple = (4, 1, 8) version: str = '{0}.{1}.{2}'.format(*version_info) license: str = 'MIT License' author: str = 'dslackw' diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index b0a822db..ad677822 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -32,7 +32,8 @@ 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.\n', + f' {YELLOW}--reinstall{ENDC} Use this option if you want to upgrade.', + f' {YELLOW}--skip-installed{ENDC} Skip installed packages.\n', ' -h, --help Show this message and exit.', ' -v, --version Print version and exit.\n', 'If you need more information try to use slpkg manpage.'] From 3a148432617ba2b5a91bef85742c900287bcb40f Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 8 Oct 2022 20:41:37 +0300 Subject: [PATCH 05/13] Fixed warning message for logs Signed-off-by: Dimitris Zlatanidis --- slpkg/views/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/views/views.py b/slpkg/views/views.py index 4797b7d2..33c3d943 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -151,7 +151,7 @@ class ViewMessage: print(f'{color["CYAN"]}{dep[0]}{color["ENDC"]}') print('Dependencies:') print(f'{color["CYAN"]} {dep[1]}{color["ENDC"]}\n') - print('Note: After cleaning you should remove them one by one.') + print('Note: After cleaning you should remove them one by one.') def question(self): if '--yes' not in self.flags: From e3f8102014779a126d8de6a8d8085cb3dd0d29c0 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 8 Oct 2022 20:46:04 +0300 Subject: [PATCH 06/13] Added comments Signed-off-by: Dimitris Zlatanidis --- slpkg/slackbuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index a75dd349..a1b18f95 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -90,8 +90,8 @@ class Slackbuilds: wget = Wget() for sbo in self.install_order: + # Checks if the package installed was and skipped. pkg = f'{sbo}-{SBoQueries(sbo).version()}' - if ('--skip-installed' in self.flags and self.utils.is_installed(f'{pkg}-')): print(f'Package {pkg} skipped.') From 45fd7547869903bdcaaea50f5f75b61774bd5802 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 8 Oct 2022 20:46:41 +0300 Subject: [PATCH 07/13] Fixed typo Signed-off-by: Dimitris Zlatanidis --- slpkg/slackbuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index a1b18f95..872928c9 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -90,7 +90,7 @@ class Slackbuilds: wget = Wget() for sbo in self.install_order: - # Checks if the package installed was and skipped. + # Checks if the package was installed and skipped. pkg = f'{sbo}-{SBoQueries(sbo).version()}' if ('--skip-installed' in self.flags and self.utils.is_installed(f'{pkg}-')): From 671f171ee2c33e16cdf4ed38f4c7369b7f0026e6 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 9 Oct 2022 20:25:07 +0300 Subject: [PATCH 08/13] Updated for skip installed option Signed-off-by: Dimitris Zlatanidis --- slpkg/slackbuild.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 872928c9..0e9f7c9c 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -75,8 +75,16 @@ class Slackbuilds: ''' List with the dependencies. ''' for deps in self.sbos.values(): for dep in deps: + + # Checks if the package was installed and skipped. + pkg = f'{dep}-{SBoQueries(dep).version()}' + if ('--skip-installed' in self.flags and + self.utils.is_installed(f'{pkg}-')): + continue + if dep not in self.slackbuilds: self.dependencies.append(dep) + # Remove duplicate packages and keeps the order. self.dependencies = list(OrderedDict.fromkeys(self.dependencies)) self.install_order.extend(self.dependencies) @@ -90,13 +98,6 @@ class Slackbuilds: wget = Wget() for sbo in self.install_order: - # Checks if the package was installed and skipped. - pkg = f'{sbo}-{SBoQueries(sbo).version()}' - if ('--skip-installed' in self.flags and - self.utils.is_installed(f'{pkg}-')): - print(f'Package {pkg} skipped.') - continue - file = f'{sbo}{self.tar_suffix}' self.utils.remove_file_if_exists(self.tmp_slpkg, file) From 0c5c215b5f519f677a77424ef8a95efa1c6e8f14 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 10 Oct 2022 21:17:08 +0300 Subject: [PATCH 09/13] Updated cli flags Signed-off-by: Dimitris Zlatanidis --- slpkg/main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index 07ba6497..b80e8c26 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -46,26 +46,26 @@ class Argparse: self.flags.append(option) def help(self): - if len(self.args) == 1: + if len(self.args) == 1 and not self.flags: usage(0) usage(1) def version(self): - if len(self.args) == 1: + if len(self.args) == 1 and not self.flags: version = Version() version.view() raise SystemExit() usage(1) def update(self): - if len(self.args) == 1: + if len(self.args) == 1 and not self.flags: update = UpdateRepository() update.sbo() raise SystemExit() usage(1) def upgrade(self): - if len(self.args) == 1: + if len(self.args) == 1 and not self.flags: upgrade = Upgrade() packages = list(upgrade.packages()) @@ -146,6 +146,9 @@ class Argparse: usage(1) def clean_logs(self): + if [f for f in self.flags if f in self.options[1:]]: + usage(1) + if len(self.args) == 1: logs = CleanLogsDependencies(self.flags) logs.clean() @@ -153,7 +156,7 @@ class Argparse: usage(1) def clean_tmp(self): - if len(self.args) == 1: + if len(self.args) == 1 and not self.flags: path = Configs.tmp_path tmp_slpkg = Configs.tmp_slpkg folder = Configs.prog_name From 80f6aa78a25835b7c65f845ac73f1afd82471756 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 10 Oct 2022 21:20:34 +0300 Subject: [PATCH 10/13] Updated man page Signed-off-by: Dimitris Zlatanidis --- man/slpkg.1 | 1 + 1 file changed, 1 insertion(+) diff --git a/man/slpkg.1 b/man/slpkg.1 index 3e1a7870..229a6080 100644 --- a/man/slpkg.1 +++ b/man/slpkg.1 @@ -82,6 +82,7 @@ Use this option if you want to upgrade all packages even if the same version is --skip-installed .RS This a helpful option if you want to avoid building and reinstalling packages. +Note: This option affects only the dependencies. .RE .P -h | --help From 4c926dd5b5cab046bf006cf43b030b98bf5b1991 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 10 Oct 2022 21:38:23 +0300 Subject: [PATCH 11/13] Updated readme Signed-off-by: Dimitris Zlatanidis --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 06da5e84..49d629a9 100644 --- a/README.rst +++ b/README.rst @@ -76,10 +76,10 @@ Configuration files .. code-block:: bash - /etc/slpkg/slpkg.yaml + /etc/slpkg/slpkg.yml General configuration of slpkg - /etc/slpkg/blacklist.yaml + /etc/slpkg/blacklist.yml Blacklist of packages Donate From 621a40b5e9bb89027b3f6ece256d8f17b575d678 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 11 Oct 2022 20:08:41 +0300 Subject: [PATCH 12/13] Updated setup version Signed-off-by: Dimitris Zlatanidis --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index d8fa7a65..26381ddf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = slpkg -version = 4.1.7 +version = 4.1.8 license_file = LICENSE author = Dimitris Zlatanidis author_email = d.zlatanidis@gmail.com From 2b7cb195c13e44367f6a71c1ac97544bb3369293 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 11 Oct 2022 20:15:14 +0300 Subject: [PATCH 13/13] Updated for not flags Signed-off-by: Dimitris Zlatanidis --- slpkg/main.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index b80e8c26..a9a0e40d 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -118,10 +118,7 @@ class Argparse: usage(1) def search(self): - if [f for f in self.flags if f in self.options]: - usage(1) - - if len(self.args) >= 2: + if len(self.args) >= 2 and not self.flags: packages = list(set(self.args[1:])) packages = self.check.blacklist(packages) @@ -133,10 +130,7 @@ class Argparse: usage(1) def find(self): - if [f for f in self.flags if f in self.options]: - usage(1) - - if len(self.args) >= 2: + if len(self.args) >= 2 and not self.flags: packages = list(set(self.args[1:])) packages = self.check.blacklist(packages)