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
Bugfixed:
- 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
$ tar xvf slpkg-4.1.7.tar.gz
$ cd slpkg-4.1.7
$ tar xvf slpkg-4.1.8.tar.gz
$ cd slpkg-4.1.8
$ ./install.sh
@ -63,6 +63,7 @@ Usage
--jobs Set it for multicore systems.
--resolve-off Turns off dependency resolving.
--reinstall Use this option if you want to upgrade.
--skip-installed Skip installed packages.
-h, --help Show this message and exit.
-v, --version Print version and exit.
@ -75,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

View file

@ -4,7 +4,7 @@
slpkg - [OPTIONS] [COMMAND] <packages>
.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.

View file

@ -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

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
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

View file

@ -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. '''

View file

@ -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

View file

@ -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)

View file

@ -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'

View file

@ -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.']