diff --git a/ChangeLog.txt b/ChangeLog.txt index 47a67e48..56acdfc0 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,9 @@ +4.1.8 - 06/10/2022 +Updated: +- Manpage for .yaml files +Added: +- New flag --skip-installed + 4.1.7 - 28/9/2022 Bugfixed: - Creating /var/lib/slpkg directory diff --git a/README.rst b/README.rst index 6f34ffa8..49d629a9 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,12 @@ 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. +Note: This option affects only the dependencies. +.RE +.P -h | --help .RS Show help informatio and exit. @@ -90,9 +96,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/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 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 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. ''' diff --git a/slpkg/main.py b/slpkg/main.py index 7730df76..a9a0e40d 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: @@ -45,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()) @@ -117,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) @@ -132,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) @@ -145,6 +140,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() @@ -152,7 +150,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 diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 46387001..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) 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.'] 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: