Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2022-10-11 20:17:29 +03:00
commit 9af2b76630
11 changed files with 47 additions and 27 deletions

View file

@ -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 4.1.7 - 28/9/2022
Bugfixed: Bugfixed:
- Creating /var/lib/slpkg directory - Creating /var/lib/slpkg directory

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.1.7.tar.gz $ tar xvf slpkg-4.1.8.tar.gz
$ cd slpkg-4.1.7 $ cd slpkg-4.1.8
$ ./install.sh $ ./install.sh
@ -63,6 +63,7 @@ Usage
--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 Use this option if you want to upgrade. --reinstall Use this option if you want to upgrade.
--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.
@ -75,10 +76,10 @@ Configuration files
.. code-block:: bash .. code-block:: bash
/etc/slpkg/slpkg.yaml /etc/slpkg/slpkg.yml
General configuration of slpkg General configuration of slpkg
/etc/slpkg/blacklist.yaml /etc/slpkg/blacklist.yml
Blacklist of packages Blacklist of packages
Donate Donate

View file

@ -4,7 +4,7 @@
slpkg - [OPTIONS] [COMMAND] <packages> slpkg - [OPTIONS] [COMMAND] <packages>
.SH SYNAPSES .SH SYNAPSES
.P .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 .SH DESCRIPTION
.P .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. 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. Use this option if you want to upgrade all packages even if the same version is already installed. Do not skip installed packages.
.RE .RE
.P .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 -h | --help
.RS .RS
Show help informatio and exit. Show help informatio and exit.
@ -90,9 +96,9 @@ Print version and exit.
.RE .RE
.SH CONFIGURATION FILES .SH CONFIGURATION FILES
.P .P
Configuration file in the /etc/slpkg/slpkg.yaml file. Configuration file in the /etc/slpkg/slpkg.yml file.
.RE .RE
Blacklist file in the /etc/slpkg/blacklist.yaml file. Blacklist file in the /etc/slpkg/blacklist.yml file.
.SH REPORT BUGS .SH REPORT BUGS
.P .P
Please report any found to https://gitlab.com/dslackw/slpkg/-/issues. Please report any found to https://gitlab.com/dslackw/slpkg/-/issues.

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = slpkg name = slpkg
version = 4.1.7 version = 4.1.8
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

@ -99,7 +99,7 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr
# Install configuration files and creating lib directory # Install configuration files and creating lib directory
mkdir -p $PKG/etc/$PRGNAM $PKG/var/lib/$PRGNAM/database $PKG/var/lib/$PRGNAM/repository 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/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 mkdir -p $PKG/usr/man/man1
cp man/slpkg.1 $PKG/usr/man/man1 cp man/slpkg.1 $PKG/usr/man/man1

View file

@ -45,7 +45,7 @@ class Check:
if sbo + '-' in package and self.repo_tag in package: if sbo + '-' in package and self.repo_tag in package:
return return
raise SystemExit('\nNot found packages for remove.\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 for packages on the blacklist and removing them. '''

View file

@ -36,7 +36,8 @@ class Argparse:
self.options = ['--yes', self.options = ['--yes',
'--jobs', '--jobs',
'--resolve-off', '--resolve-off',
'--reinstall' '--reinstall',
'--skip-installed'
] ]
for option in self.options: for option in self.options:
@ -45,26 +46,26 @@ class Argparse:
self.flags.append(option) self.flags.append(option)
def help(self): def help(self):
if len(self.args) == 1: if len(self.args) == 1 and not self.flags:
usage(0) usage(0)
usage(1) usage(1)
def version(self): def version(self):
if len(self.args) == 1: if len(self.args) == 1 and not self.flags:
version = Version() version = Version()
version.view() version.view()
raise SystemExit() raise SystemExit()
usage(1) usage(1)
def update(self): def update(self):
if len(self.args) == 1: if len(self.args) == 1 and not self.flags:
update = UpdateRepository() update = UpdateRepository()
update.sbo() update.sbo()
raise SystemExit() raise SystemExit()
usage(1) usage(1)
def upgrade(self): def upgrade(self):
if len(self.args) == 1: if len(self.args) == 1 and not self.flags:
upgrade = Upgrade() upgrade = Upgrade()
packages = list(upgrade.packages()) packages = list(upgrade.packages())
@ -117,10 +118,7 @@ class Argparse:
usage(1) usage(1)
def search(self): def search(self):
if [f for f in self.flags if f in self.options]: if len(self.args) >= 2 and not self.flags:
usage(1)
if len(self.args) >= 2:
packages = list(set(self.args[1:])) packages = list(set(self.args[1:]))
packages = self.check.blacklist(packages) packages = self.check.blacklist(packages)
@ -132,10 +130,7 @@ class Argparse:
usage(1) usage(1)
def find(self): def find(self):
if [f for f in self.flags if f in self.options]: if len(self.args) >= 2 and not self.flags:
usage(1)
if len(self.args) >= 2:
packages = list(set(self.args[1:])) packages = list(set(self.args[1:]))
packages = self.check.blacklist(packages) packages = self.check.blacklist(packages)
@ -145,6 +140,9 @@ class Argparse:
usage(1) usage(1)
def clean_logs(self): def clean_logs(self):
if [f for f in self.flags if f in self.options[1:]]:
usage(1)
if len(self.args) == 1: if len(self.args) == 1:
logs = CleanLogsDependencies(self.flags) logs = CleanLogsDependencies(self.flags)
logs.clean() logs.clean()
@ -152,7 +150,7 @@ class Argparse:
usage(1) usage(1)
def clean_tmp(self): def clean_tmp(self):
if len(self.args) == 1: if len(self.args) == 1 and not self.flags:
path = Configs.tmp_path path = Configs.tmp_path
tmp_slpkg = Configs.tmp_slpkg tmp_slpkg = Configs.tmp_slpkg
folder = Configs.prog_name folder = Configs.prog_name

View file

@ -75,8 +75,16 @@ class Slackbuilds:
''' List with the dependencies. ''' ''' List with the dependencies. '''
for deps in self.sbos.values(): for deps in self.sbos.values():
for dep in deps: 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: if dep not in self.slackbuilds:
self.dependencies.append(dep) self.dependencies.append(dep)
# Remove duplicate packages and keeps the order. # Remove duplicate packages and keeps the order.
self.dependencies = list(OrderedDict.fromkeys(self.dependencies)) self.dependencies = list(OrderedDict.fromkeys(self.dependencies))
self.install_order.extend(self.dependencies) self.install_order.extend(self.dependencies)

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, 1, 7) version_info: tuple = (4, 1, 8)
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

@ -32,7 +32,8 @@ def usage(status: int):
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} 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.', ' -h, --help Show this message and exit.',
' -v, --version Print version and exit.\n', ' -v, --version Print version and exit.\n',
'If you need more information try to use slpkg manpage.'] 'If you need more information try to use slpkg manpage.']