Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2022-09-08 20:07:12 +03:00
commit fd8773ec1f
11 changed files with 106 additions and 51 deletions

View file

@ -1,3 +1,8 @@
4.1.4 - 17/07/2022
-Added
- setup.cfg file
- Option to upgrade sbo packages
4.1.3 - 26/06/2022
Bugfixed:
- /tmp permissions after installation

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.3.tar.gz
$ cd slpkg-4.1.3
$ tar xvf slpkg-4.1.4.tar.gz
$ cd slpkg-4.1.4
$ ./install.sh
@ -49,6 +49,7 @@ Usage
COMMANDS:
update Update the package lists.
upgrade Upgrade all the packages.
build <packages> Build only the packages.
install <packages> Build and install the packages.
remove <packages> Remove installed packages.

View file

@ -4,7 +4,7 @@
slpkg - [OPTIONS] [COMMAND] <packages>
.SH SYNAPSES
.P
slpkg [-h|-v] [update] [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
.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.
@ -17,6 +17,11 @@ update
Updates the package list and the database.
.RE
.P
upgrade
.RS
Upgrade all the installed packages.
.RE
.P
build
.RS
Builds the scripts and puts them in the /tmp directory.

46
setup.cfg Normal file
View file

@ -0,0 +1,46 @@
[metadata]
name = slpkg
version = 4.1.4
license_file = LICENSE
author = Dimitris Zlatanidis
author_email = d.zlatanidis@gmail.com
description = Packaging tool that interacts with the SBo repository
long_description = file:README.rst
url = https://dslackw.gitlab.io/slpkg/
project_urls =
Source = https://dslackw.gitlab.io/slpkg/
Documentation = https://dslackw.gitlab.io/slpkg/
classifiers =
License :: OSI Approved :: MIT License
Natural Language :: English
Operating System :: POSIX
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Unix Shell
Topic :: Utilities
Topic :: Software Development :: Build Tools
Topic :: System :: Archiving :: Packaging
Topic :: System :: Software Distribution
Topic :: System :: Installation/Setup
Topic :: System :: Systems Administration
Topic :: System :: Software Distribution
[options]
packages =
slpkg
slpkg.models
slpkg.views
python_requires = >=3.7
install_requires =
SQLAlchemy >= 1.4.36
PyYAML >= 6.0
include_package_data = True
[options.packages.find]
where = .

View file

@ -1,47 +1,5 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from setuptools import setup
from slpkg.version import Version
install_requires = ['SQLAlchemy>=1.4.36',
'PyYAML>=6.0']
setup(
name='slpkg',
packages=['slpkg', 'slpkg/models', 'slpkg/views'],
scripts=['bin/slpkg'],
version=Version.version,
description='Packaging tool that interacts with the SBo repository',
long_description=open('README.rst').read(),
keywords=['slackware', 'slpkg', 'update', 'build', 'install', 'remove',
'slackpkg', 'tool'],
author='dslackw',
url='https://dslackw.gitlab.io/slpkg/',
package_data={'': ['LICENSE.txt', 'README.rst', 'ChangeLog.txt']},
data_files=[('/etc/slpkg', ['configs/slpkg.yaml']),
('/etc/slpkg', ['configs/blacklist.yaml']),
('/var/lib/slpkg/database', []),
('/var/lib/slpkg/repository', [])],
install_requires=install_requires,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Unix Shell',
'Topic :: Software Development :: Build Tools',
'Topic :: System :: Archiving :: Packaging',
'Topic :: System :: Software Distribution',
'Topic :: System :: Installation/Setup',
'Topic :: System :: Systems Administration',
'Topic :: System :: Software Distribution',
'Topic :: Utilities'],
python_requires='>=3.9'
)
if __name__ == '__main__':
setup()

View file

@ -108,7 +108,7 @@ find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README.rst ChangeLog.txt LICENSE.txt requirements.txt $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README.rst ChangeLog.txt LICENSE requirements.txt $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install

View file

@ -7,6 +7,7 @@ from dataclasses import dataclass
from slpkg.checks import Check
from slpkg.search import Search
from slpkg.upgrade import Upgrade
from slpkg.version import Version
from slpkg.configs import Configs
from slpkg.utilities import Utilities
@ -62,6 +63,16 @@ class Argparse:
raise SystemExit()
usage(1)
def upgrade(self):
if len(self.args) == 1:
upgrade = Upgrade()
packages = list(upgrade.packages())
install = Slackbuilds(packages, self.flags, install=True)
install.execute()
raise SystemExit()
usage(1)
def build(self):
if len(self.args) >= 2 and '--reinstall' not in self.flags:
packages = list(set(self.args[1:]))
@ -69,7 +80,7 @@ class Argparse:
self.check.exists(packages)
self.check.unsupported(packages)
build = Slackbuilds(packages, self.flags, False)
build = Slackbuilds(packages, self.flags, install=False)
build.execute()
raise SystemExit()
usage(1)
@ -81,7 +92,7 @@ class Argparse:
self.check.exists(packages)
self.check.unsupported(packages)
install = Slackbuilds(packages, self.flags, True)
install = Slackbuilds(packages, self.flags, install=True)
install.execute()
raise SystemExit()
usage(1)
@ -141,6 +152,7 @@ class Argparse:
path = Configs.tmp_path
tmp_slpkg = Configs.tmp_slpkg
folder = Configs.prog_name
utils = Utilities()
utils.remove_folder_if_exists(path, folder)
utils.create_folder(tmp_slpkg, 'build')
@ -160,6 +172,7 @@ def main():
'-v': argparse.version,
'--version': argparse.version,
'update': argparse.update,
'upgrade': argparse.upgrade,
'build': argparse.build,
'install': argparse.install,
'remove': argparse.remove,

26
slpkg/upgrade.py Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
from dataclasses import dataclass
from distutils.version import LooseVersion
from slpkg.configs import Configs
from slpkg.queries import SBoQueries
@dataclass
class Upgrade:
log_packages: str = Configs.log_packages
repo_tag: str = Configs.repo_tag
def packages(self):
''' Compares version of packages and returns the maximum. '''
for pkg in os.listdir(self.log_packages):
if pkg.endswith(self.repo_tag):
name = '-'.join(pkg.split('-')[:-3])
installed_ver = pkg.replace(name + '-', '').split('-')[0]
repo_ver = SBoQueries(name).version()
if LooseVersion(repo_ver) > LooseVersion(installed_ver):
yield name

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, 3)
version_info: tuple = (4, 1, 4)
version: str = '{0}.{1}.{2}'.format(*version_info)
license: str = 'MIT License'
author: str = 'dslackw'

View file

@ -20,6 +20,7 @@ def usage(status: int):
' Packaging tool that interacts with the SBo repository.\n',
f'{BOLD}COMMANDS:{ENDC}',
f' {RED}update{ENDC} Update the package lists.',
f' {CYAN}upgrade{ENDC} Upgrade all the packages.',
f' {CYAN}build{ENDC} <packages> Build only the packages.',
f' {CYAN}install{ENDC} <packages> Build and install the packages.',
f' {CYAN}remove{ENDC} <packages> Remove installed packages.',