mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-10 20:01:54 +01:00
Merge branch 'develop'
This commit is contained in:
commit
31f6b4ef44
12 changed files with 95 additions and 44 deletions
|
@ -1,8 +1,12 @@
|
|||
4.1.9 - 14/10/2022
|
||||
Added:
|
||||
- New option --download-only
|
||||
|
||||
4.1.8 - 06/10/2022
|
||||
Updated:
|
||||
- Manpage for .yaml files
|
||||
Added:
|
||||
- New flag --skip-installed
|
||||
- New option --skip-installed
|
||||
|
||||
4.1.7 - 28/9/2022
|
||||
Bugfixed:
|
||||
|
|
|
@ -30,8 +30,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tar xvf slpkg-4.1.8.tar.gz
|
||||
$ cd slpkg-4.1.8
|
||||
$ tar xvf slpkg-4.1.9.tar.gz
|
||||
$ cd slpkg-4.1.9
|
||||
$ ./install.sh
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ configs:
|
|||
tmp_path: /tmp
|
||||
tmp_slpkg: /tmp/slpkg
|
||||
build_path: /tmp/slpkg/build
|
||||
download_only: /tmp/slpkg
|
||||
lib_path: /var/lib/slpkg
|
||||
etc_path: /etc/slpkg
|
||||
db_path: /var/lib/slpkg/database
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.1.0" dslackw
|
||||
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.1.9" dslackw
|
||||
.SH NAME
|
||||
.P
|
||||
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 --skip-installed
|
||||
slpkg [-h|-v] [update] [upgrade] [build] [install] [remove] [find] [search] [clean-logs] [clean-tmp] --yes --jobs --resolve-off --reinstall --skip-installed --download-only
|
||||
.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.
|
||||
|
@ -85,6 +85,11 @@ This a helpful option if you want to avoid building and reinstalling packages.
|
|||
Note: This option affects only the dependencies.
|
||||
.RE
|
||||
.P
|
||||
--download-only
|
||||
.RS
|
||||
Download only the package without building or installing it. Works both with build or install command.
|
||||
.RE
|
||||
.P
|
||||
-h | --help
|
||||
.RS
|
||||
Show help informatio and exit.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = slpkg
|
||||
version = 4.1.8
|
||||
version = 4.1.9
|
||||
license_file = LICENSE
|
||||
author = Dimitris Zlatanidis
|
||||
author_email = d.zlatanidis@gmail.com
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import hashlib
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.views.views import ViewMessage
|
||||
|
||||
|
||||
|
@ -13,10 +12,8 @@ from slpkg.views.views import ViewMessage
|
|||
class Md5sum:
|
||||
''' Checksum the sources. '''
|
||||
flags: str
|
||||
build_path: str = Configs.build_path
|
||||
|
||||
def check(self, source: str, checksum: str, name: str):
|
||||
path = f'{self.build_path}/{name}'
|
||||
def check(self, path: str, source: str, checksum: str, name: str):
|
||||
filename = f'{path}/{source.split("/")[-1]}'
|
||||
|
||||
md5 = self.read_file(filename)
|
||||
|
|
|
@ -22,6 +22,7 @@ class Configs:
|
|||
tmp_path: str = '/tmp'
|
||||
tmp_slpkg: str = f'{tmp_path}/{prog_name}'
|
||||
build_path: str = f'/tmp/{prog_name}/build'
|
||||
download_only: str = f'{tmp_slpkg}/'
|
||||
lib_path: str = f'/var/lib/{prog_name}'
|
||||
etc_path: str = f'/etc/{prog_name}'
|
||||
db_path: str = f'/var/lib/{prog_name}/database'
|
||||
|
@ -58,40 +59,44 @@ class Configs:
|
|||
with open(config_file, 'r') as conf:
|
||||
configs = yaml.safe_load(conf)
|
||||
|
||||
config = configs['configs']
|
||||
try:
|
||||
config = configs['configs']
|
||||
|
||||
# OS architecture by default
|
||||
os_arch: str = config['os_arch']
|
||||
# OS architecture by default
|
||||
os_arch: str = config['os_arch']
|
||||
|
||||
# All necessary paths
|
||||
tmp_path: str = config['tmp_path']
|
||||
tmp_slpkg: str = config['tmp_slpkg']
|
||||
build_path: str = config['build_path']
|
||||
lib_path: str = config['lib_path']
|
||||
etc_path: str = config['etc_path']
|
||||
db_path: str = config['db_path']
|
||||
sbo_repo_path: str = config['sbo_repo_path']
|
||||
log_packages: str = config['log_packages']
|
||||
# All necessary paths
|
||||
tmp_path: str = config['tmp_path']
|
||||
tmp_slpkg: str = config['tmp_slpkg']
|
||||
build_path: str = config['build_path']
|
||||
download_only: str = config['download_only']
|
||||
lib_path: str = config['lib_path']
|
||||
etc_path: str = config['etc_path']
|
||||
db_path: str = config['db_path']
|
||||
sbo_repo_path: str = config['sbo_repo_path']
|
||||
log_packages: str = config['log_packages']
|
||||
|
||||
# Database name
|
||||
database: str = config['database']
|
||||
# Database name
|
||||
database: str = config['database']
|
||||
|
||||
# Repository details
|
||||
repo_version: str = config['repo_version']
|
||||
sbo_url: str = config['sbo_url']
|
||||
sbo_txt: str = config['sbo_txt']
|
||||
tar_suffix: str = config['tar_suffix']
|
||||
pkg_suffix: str = config['pkg_suffix']
|
||||
repo_tag: str = config['repo_tag']
|
||||
# Repository details
|
||||
repo_version: str = config['repo_version']
|
||||
sbo_url: str = config['sbo_url']
|
||||
sbo_txt: str = config['sbo_txt']
|
||||
tar_suffix: str = config['tar_suffix']
|
||||
pkg_suffix: str = config['pkg_suffix']
|
||||
repo_tag: str = config['repo_tag']
|
||||
|
||||
# Slackware commands
|
||||
installpkg: str = config['installpkg']
|
||||
reinstall: str = config['reinstall']
|
||||
removepkg: str = config['removepkg']
|
||||
# Slackware commands
|
||||
installpkg: str = config['installpkg']
|
||||
reinstall: str = config['reinstall']
|
||||
removepkg: str = config['removepkg']
|
||||
|
||||
# Other configs
|
||||
colors: str = config['colors']
|
||||
wget_options: str = config['wget_options']
|
||||
# Other configs
|
||||
colors: str = config['colors']
|
||||
wget_options: str = config['wget_options']
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def colour(cls):
|
||||
|
|
|
@ -37,7 +37,8 @@ class Argparse:
|
|||
'--jobs',
|
||||
'--resolve-off',
|
||||
'--reinstall',
|
||||
'--skip-installed'
|
||||
'--skip-installed',
|
||||
'--download-only'
|
||||
]
|
||||
|
||||
for option in self.options:
|
||||
|
|
|
@ -30,6 +30,7 @@ class Slackbuilds:
|
|||
build_path: str = Configs.build_path
|
||||
sbo_url: str = Configs.sbo_url
|
||||
build_path: str = Configs.build_path
|
||||
download_only: str = Configs.download_only
|
||||
tmp_slpkg: str = Configs.tmp_slpkg
|
||||
tmp_path: str = Configs.tmp_path
|
||||
tar_suffix: str = Configs.tar_suffix
|
||||
|
@ -56,7 +57,9 @@ class Slackbuilds:
|
|||
''' View slackbuilds before proceed. '''
|
||||
view = ViewMessage(self.flags)
|
||||
|
||||
if self.install:
|
||||
if '--download-only' in self.flags:
|
||||
view.download_packages(self.slackbuilds, self.dependencies)
|
||||
elif self.install:
|
||||
view.install_packages(self.slackbuilds, self.dependencies)
|
||||
else:
|
||||
view.build_packages(self.slackbuilds, self.dependencies)
|
||||
|
@ -108,11 +111,16 @@ class Slackbuilds:
|
|||
|
||||
wget.download(self.tmp_slpkg, url)
|
||||
|
||||
self.utils.untar_archive(self.tmp_slpkg, file, self.build_path)
|
||||
if '--download-only' not in self.flags:
|
||||
self.utils.untar_archive(self.tmp_slpkg, file, self.build_path)
|
||||
|
||||
sources = SBoQueries(sbo).sources()
|
||||
self.download_sources(sbo, sources)
|
||||
|
||||
# Skip building or installing the package
|
||||
if '--download-only' in self.flags:
|
||||
continue
|
||||
|
||||
self.build_the_script(self.build_path, sbo)
|
||||
|
||||
if self.install:
|
||||
|
@ -148,6 +156,7 @@ class Slackbuilds:
|
|||
if ('--reinstall' in self.flags and
|
||||
self.utils.is_installed(package[:-4])):
|
||||
execute = self.reinstall
|
||||
|
||||
command = f'{execute} {self.tmp_path}/{package}'
|
||||
subprocess.call(command, shell=True)
|
||||
|
||||
|
@ -176,6 +185,7 @@ class Slackbuilds:
|
|||
self.set_makeflags()
|
||||
|
||||
stdout = subprocess.call(execute)
|
||||
|
||||
if stdout > 0:
|
||||
raise SystemExit(stdout)
|
||||
|
||||
|
@ -187,10 +197,14 @@ class Slackbuilds:
|
|||
def download_sources(self, name: str, sources: str):
|
||||
''' Download the sources. '''
|
||||
wget = Wget()
|
||||
|
||||
path = f'{self.build_path}/{name}'
|
||||
if '--download-only' in self.flags:
|
||||
path = self.download_only
|
||||
|
||||
checksums = SBoQueries(name).checksum()
|
||||
|
||||
for source, checksum in zip(sources.split(), checksums[0].split()):
|
||||
wget.download(path, source)
|
||||
md5sum = Md5sum(self.flags)
|
||||
md5sum.check(source, checksum, name)
|
||||
md5sum.check(path, source, checksum, name)
|
||||
|
|
|
@ -10,7 +10,7 @@ from slpkg.configs import Configs
|
|||
@dataclass
|
||||
class Version:
|
||||
prog_name: str = Configs.prog_name
|
||||
version_info: tuple = (4, 1, 8)
|
||||
version_info: tuple = (4, 1, 9)
|
||||
version: str = '{0}.{1}.{2}'.format(*version_info)
|
||||
license: str = 'MIT License'
|
||||
author: str = 'dslackw'
|
||||
|
|
|
@ -33,7 +33,8 @@ def usage(status: int):
|
|||
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.',
|
||||
f' {YELLOW}--skip-installed{ENDC} Skip installed packages.\n',
|
||||
f' {YELLOW}--skip-installed{ENDC} Skip installed packages.',
|
||||
f' {YELLOW}--download-only{ENDC} Download only the 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.']
|
||||
|
|
|
@ -53,6 +53,19 @@ class ViewMessage:
|
|||
|
||||
self._view_total(slackbuilds, dependencies, option='install')
|
||||
|
||||
def download_packages(self, slackbuilds: list, dependencies: list):
|
||||
print('The following packages will be downloaded:\n')
|
||||
|
||||
for sbo in slackbuilds:
|
||||
version = SBoQueries(sbo).version()
|
||||
self._view_download(sbo, version)
|
||||
|
||||
if dependencies:
|
||||
print('\nDependencies:')
|
||||
for sbo in dependencies:
|
||||
version = SBoQueries(sbo).version()
|
||||
self._view_download(sbo, version)
|
||||
|
||||
def remove_packages(self, packages: list):
|
||||
print('The following packages will be removed:\n')
|
||||
self.installed_packages = []
|
||||
|
@ -76,6 +89,16 @@ class ViewMessage:
|
|||
|
||||
return self.installed_packages, self.dependencies
|
||||
|
||||
def _view_download(self, sbo: str, version: str):
|
||||
color = self.colors()
|
||||
|
||||
if self.utils.is_installed(f'{sbo}-'):
|
||||
print(f'[{color["YELLOW"]} download {color["ENDC"]}] -> '
|
||||
f'{sbo}-{version}')
|
||||
else:
|
||||
print(f'[{color["CYAN"]} download {color["ENDC"]}] -> '
|
||||
f'{sbo}-{version}')
|
||||
|
||||
def _view_build(self, sbo: str, version: str):
|
||||
color = self.colors()
|
||||
|
||||
|
|
Loading…
Reference in a new issue