mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-24 19:58:31 +01:00
Merge branch 'develop'
This commit is contained in:
commit
dc5c436ae8
21 changed files with 79 additions and 64 deletions
|
@ -1,3 +1,9 @@
|
|||
4.3.2 - 28/11/2022
|
||||
Fixed:
|
||||
- Remove multiple packages with dependencies
|
||||
Updated:
|
||||
- Switch to python toml to load configuration files
|
||||
|
||||
4.3.1 - 26/11/2022
|
||||
Added:
|
||||
- Category in the view command
|
||||
|
|
12
README.rst
12
README.rst
|
@ -20,8 +20,8 @@ Requirements
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
SQLAlchemy>=1.4.36
|
||||
PyYAML>=6.0
|
||||
SQLAlchemy >= 1.4.36
|
||||
toml >= 0.10.2
|
||||
|
||||
Install
|
||||
-------
|
||||
|
@ -30,8 +30,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tar xvf slpkg-4.3.1.tar.gz
|
||||
$ cd slpkg-4.3.1
|
||||
$ tar xvf slpkg-4.3.2.tar.gz
|
||||
$ cd slpkg-4.3.2
|
||||
$ ./install.sh
|
||||
|
||||
|
||||
|
@ -79,10 +79,10 @@ Configuration files
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
/etc/slpkg/slpkg.yml
|
||||
/etc/slpkg/slpkg.toml
|
||||
General configuration of slpkg
|
||||
|
||||
/etc/slpkg/blacklist.yml
|
||||
/etc/slpkg/blacklist.toml
|
||||
Blacklist of packages
|
||||
|
||||
Donate
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
blacklist:
|
||||
[blacklist]
|
||||
|
||||
# Add packages and separate them with commas.
|
||||
packages: ["%README%",]
|
||||
packages = [
|
||||
"%README%"
|
||||
]
|
|
@ -1,52 +1,52 @@
|
|||
configs:
|
||||
[configs]
|
||||
# OS architecture by default.
|
||||
os_arch: x86_64
|
||||
os_archi = "x86_64"
|
||||
|
||||
# Tmp path for slpkg.
|
||||
tmp_slpkg: /tmp/slpkg
|
||||
tmp_slpkg = "/tmp/slpkg"
|
||||
|
||||
# Path for building source and the script
|
||||
build_path: /tmp/slpkg/build
|
||||
build_path = "/tmp/slpkg/build"
|
||||
|
||||
# This path working only with the command download.
|
||||
download_only: /tmp/slpkg
|
||||
download_only = "/tmp/slpkg"
|
||||
|
||||
# The path that the SLACKBUILDS.TXT file downloaded.
|
||||
sbo_repo_path: /var/lib/slpkg/repository
|
||||
sbo_repo_pathi = "/var/lib/slpkg/repository"
|
||||
|
||||
# The name of the database. Default name is 'database.slpkg'.
|
||||
database: database.slpkg
|
||||
database = "database.slpkg"
|
||||
|
||||
# Slackbuilds.org repository url.
|
||||
sbo_repo_url: http://slackbuilds.org/slackbuilds/15.0
|
||||
sbo_repo_url = "http://slackbuilds.org/slackbuilds/15.0"
|
||||
|
||||
# The SLACKBUILDS.TXT repository file.
|
||||
sbo_txt: SLACKBUILDS.TXT
|
||||
sbo_txt = "SLACKBUILDS.TXT"
|
||||
|
||||
# The ChangeLog.txt file.
|
||||
chglog_txt: ChangeLog.txt
|
||||
chglog_txt = "ChangeLog.txt"
|
||||
|
||||
# The sbo tar suffix.
|
||||
sbo_tar_suffix: .tar.gz
|
||||
sbo_tar_suffix = ".tar.gz"
|
||||
|
||||
# The sbo repository tag.
|
||||
sbo_repo_tag: _SBo
|
||||
sbo_repo_tag = "_SBo"
|
||||
|
||||
# Slackware install command. Alternative you can
|
||||
# use 'installpkg', if you want.
|
||||
installpkg: upgradepkg --install-new
|
||||
installpkg = "upgradepkg --install-new"
|
||||
|
||||
# Upgrade or reinstall slackware command.
|
||||
reinstall: upgradepkg --reinstall
|
||||
reinstall = "upgradepkg --reinstall"
|
||||
|
||||
# Slackware command to remove packages.
|
||||
removepkg: removepkg
|
||||
removepkg = "removepkg"
|
||||
|
||||
# Cli menu colors configs. Default is off. [on/off]
|
||||
colors: off
|
||||
colors = "off"
|
||||
|
||||
# Wget downloader options.
|
||||
# -c, --continue: resume getting a partially-downloaded file.
|
||||
# -N, --timestamping: don't re-retrieve files unless newer
|
||||
# than local.
|
||||
wget_options: -c -N
|
||||
wget_options = "-c -N"
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
__version() {
|
||||
# Grab version from __metadata_.py file
|
||||
cat slpkg/version.py | grep "version_info: tuple = (" \
|
||||
cat slpkg/views/version.py | grep "version_info: tuple = (" \
|
||||
| tr -d [[:space:]] | cut -c21-25 | tr , .
|
||||
}
|
||||
|
||||
|
|
|
@ -110,9 +110,9 @@ Print version and exit.
|
|||
.RE
|
||||
.SH CONFIGURATION FILES
|
||||
.P
|
||||
Configuration file in the /etc/slpkg/slpkg.yml file.
|
||||
Configuration file in the /etc/slpkg/slpkg.toml file.
|
||||
.RE
|
||||
Blacklist file in the /etc/slpkg/blacklist.yml file.
|
||||
Blacklist file in the /etc/slpkg/blacklist.toml file.
|
||||
.SH REPORT BUGS
|
||||
.P
|
||||
Please report any found to https://gitlab.com/dslackw/slpkg/-/issues.
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
SQLAlchemy>=1.4.36
|
||||
PyYAML>=6.0
|
||||
toml>=0.10.2
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = slpkg
|
||||
version = 4.3.1
|
||||
version = 4.3.2
|
||||
license_file = LICENSE
|
||||
author = Dimitris Zlatanidis
|
||||
author_email = d.zlatanidis@gmail.com
|
||||
|
@ -39,7 +39,7 @@ packages =
|
|||
python_requires = >=3.7
|
||||
install_requires =
|
||||
SQLAlchemy >= 1.4.36
|
||||
PyYAML >= 6.0
|
||||
toml >= 0.10.2
|
||||
include_package_data = True
|
||||
|
||||
[options.packages.find]
|
||||
|
|
|
@ -8,8 +8,8 @@ config() {
|
|||
fi
|
||||
}
|
||||
|
||||
config etc/slpkg/slpkg.yml.new
|
||||
config etc/slpkg/blacklist.yml.new
|
||||
config etc/slpkg/slpkg.toml.new
|
||||
config etc/slpkg/blacklist.toml.new
|
||||
|
||||
if [ -x /usr/bin/update-desktop-database ]; then
|
||||
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
__version() {
|
||||
# Grab version from __metadata_.py file
|
||||
cat ../slpkg/version.py | grep "version_info: tuple = (" \
|
||||
cat ../slpkg/views/version.py | grep "version_info: tuple = (" \
|
||||
| tr -d [[:space:]] | cut -c21-25 | tr , .
|
||||
}
|
||||
|
||||
|
@ -98,8 +98,8 @@ 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
|
||||
install -D -m0644 configs/slpkg.yml $PKG/etc/slpkg/slpkg.yml.new
|
||||
install -D -m0645 configs/blacklist.yml $PKG/etc/slpkg/blacklist.yml.new
|
||||
install -D -m0644 configs/slpkg.toml $PKG/etc/slpkg/slpkg.toml.new
|
||||
install -D -m0645 configs/blacklist.toml $PKG/etc/slpkg/blacklist.toml.new
|
||||
|
||||
mkdir -p $PKG/usr/man/man1
|
||||
cp man/slpkg.1 $PKG/usr/man/man1
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
|
||||
import os
|
||||
import yaml
|
||||
import tomli
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
@ -15,7 +15,7 @@ class Blacklist:
|
|||
etc_path: str = Configs.etc_path
|
||||
|
||||
def get(self):
|
||||
file = f'{self.etc_path}/blacklist.yml'
|
||||
file = f'{self.etc_path}/blacklist.toml'
|
||||
if os.path.isfile(file):
|
||||
with open(file, 'r') as black:
|
||||
return yaml.safe_load(black)['blacklist']['packages']
|
||||
with open(file, 'rb') as black:
|
||||
return tomli.load(black)['blacklist']['packages']
|
||||
|
|
|
@ -70,7 +70,7 @@ class Check:
|
|||
if packages:
|
||||
raise SystemExit(
|
||||
f'\nThe packages \'{", ".join(packages)}\' is blacklisted.\n'
|
||||
f'Please edit the blacklist.yml file in {self.etc_path} '
|
||||
f'Please edit the blacklist.toml file in {self.etc_path} '
|
||||
'folder.\n')
|
||||
|
||||
def database(self):
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
|
||||
import os
|
||||
import yaml
|
||||
import tomli
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
@ -51,13 +51,12 @@ class Configs:
|
|||
wget_options = '-c -N'
|
||||
|
||||
''' Overwrite with user configuration. '''
|
||||
config_file: str = f'{etc_path}/{prog_name}.yml'
|
||||
config_file: str = f'{etc_path}/{prog_name}.toml'
|
||||
if os.path.isfile(config_file):
|
||||
with open(config_file, 'r') as conf:
|
||||
configs = yaml.safe_load(conf)
|
||||
with open(config_file, 'rb') as conf:
|
||||
configs = tomli.load(conf)
|
||||
|
||||
try:
|
||||
|
||||
config = configs['configs']
|
||||
|
||||
# OS architecture by default
|
||||
|
|
|
@ -7,16 +7,16 @@ from dataclasses import dataclass
|
|||
|
||||
from slpkg.checks import Check
|
||||
from slpkg.upgrade import Upgrade
|
||||
from slpkg.version import Version
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.search import SearchPackage
|
||||
from slpkg.views.cli_menu import usage
|
||||
from slpkg.views.version import Version
|
||||
from slpkg.download_only import Download
|
||||
from slpkg.slackbuild import Slackbuilds
|
||||
from slpkg.view_package import ViewPackage
|
||||
from slpkg.check_updates import CheckUpdates
|
||||
from slpkg.find_installed import FindInstalled
|
||||
from slpkg.views.view_package import ViewPackage
|
||||
from slpkg.remove_packages import RemovePackages
|
||||
from slpkg.clean_logs import CleanLogsDependencies
|
||||
from slpkg.update_repository import UpdateRepository
|
||||
|
|
|
@ -16,6 +16,7 @@ class SearchPackage:
|
|||
color = self.colors()
|
||||
CYAN = color['CYAN']
|
||||
ENDC = color['ENDC']
|
||||
matching = 0
|
||||
|
||||
names = SBoQueries('').names()
|
||||
|
||||
|
@ -25,6 +26,9 @@ class SearchPackage:
|
|||
for name in names:
|
||||
for package in packages:
|
||||
if package in name:
|
||||
matching += 1
|
||||
desc = SBoQueries(name).description().replace(name, '')
|
||||
print(f'{name}-{SBoQueries(name).version()}'
|
||||
f'{CYAN}{desc}{ENDC}')
|
||||
if not matching:
|
||||
print('\nDoes not match any package.\n')
|
||||
|
|
|
@ -39,7 +39,7 @@ def usage(status: int):
|
|||
f' {YELLOW}--skip-installed{ENDC} Skip installed packages.\n',
|
||||
' -h, --help Show this message and exit.',
|
||||
' -v, --version Print version and exit.\n',
|
||||
'Edit the configuration file in the /etc/slpkg/slpkg.yml.',
|
||||
'Edit the configuration file in the /etc/slpkg/slpkg.toml.',
|
||||
'If you need more information try to use slpkg manpage.']
|
||||
|
||||
for opt in args:
|
||||
|
|
|
@ -10,7 +10,7 @@ from slpkg.configs import Configs
|
|||
@dataclass
|
||||
class Version:
|
||||
prog_name: str = Configs.prog_name
|
||||
version_info: tuple = (4, 3, 1)
|
||||
version_info: tuple = (4, 3, 2)
|
||||
version: str = '{0}.{1}.{2}'.format(*version_info)
|
||||
license: str = 'MIT License'
|
||||
author: str = 'dslackw'
|
|
@ -69,21 +69,24 @@ class ViewMessage:
|
|||
self._view_installed_packages(pkg)
|
||||
slackbuilds.append(pkg)
|
||||
|
||||
dependencies.append(self.session.query(
|
||||
requires = self.session.query(
|
||||
LogsDependencies.requires).filter(
|
||||
LogsDependencies.name == pkg).first())
|
||||
LogsDependencies.name == pkg).first()
|
||||
|
||||
if None not in dependencies and '--resolve-off' not in self.flags:
|
||||
if requires:
|
||||
deps.append(requires)
|
||||
|
||||
if deps and '--resolve-off' not in self.flags:
|
||||
print('\nDependencies:')
|
||||
|
||||
for i in range(0, len(dependencies)):
|
||||
for dep in dependencies[i][0].split():
|
||||
for i in range(0, len(deps)):
|
||||
for dep in deps[i][0].split():
|
||||
self._view_installed_packages(dep)
|
||||
deps.append(dep)
|
||||
dependencies.append(dep)
|
||||
|
||||
self._view_total(slackbuilds, deps, option='remove')
|
||||
self._view_total(slackbuilds, dependencies, option='remove')
|
||||
|
||||
return self.installed_packages, deps
|
||||
return self.installed_packages, dependencies
|
||||
|
||||
def _view_download(self, sbo: str, version: str):
|
||||
color = self.colors()
|
||||
|
@ -138,7 +141,8 @@ class ViewMessage:
|
|||
for package in installed:
|
||||
black = package.split('-')[0]
|
||||
if (package.startswith(f'{name}-') and
|
||||
self.sbo_repo_tag in package and black not in self.black.get()):
|
||||
self.sbo_repo_tag in package and
|
||||
black not in self.black.get()):
|
||||
self.installed_packages.append(package)
|
||||
print(f'[{color["RED"]} delete {color["ENDC"]}] -> {package}')
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ class TestBlacklist(unittest.TestCase):
|
|||
|
||||
def test_blacklist(self):
|
||||
black = Blacklist()
|
||||
self.assertListEqual([], black.get())
|
||||
self.assertListEqual(['%README%'], black.get())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -15,16 +15,16 @@ class TestSBoQueries(unittest.TestCase):
|
|||
|
||||
def test_sources(self):
|
||||
self.assertEqual('https://gitlab.com/dslackw/slpkg/-/archive'
|
||||
'/3.9.8/slpkg-3.9.8.tar.gz', self.query.sources())
|
||||
'/4.3.0/slpkg-4.3.0.tar.gz', self.query.sources())
|
||||
|
||||
def test_requires(self):
|
||||
self.assertEqual([], self.query.requires())
|
||||
self.assertEqual(['SQLAlchemy'], self.query.requires())
|
||||
|
||||
def test_version(self):
|
||||
self.assertEqual('3.9.8', self.query.version())
|
||||
self.assertEqual('4.3.0', self.query.version())
|
||||
|
||||
def test_checksum(self):
|
||||
self.assertListEqual(['41b3f4f0f8fb8270e3b03abd2c73be2c'],
|
||||
self.assertListEqual(['ab03d0543b74abfce92287db740394c4'],
|
||||
self.query.checksum())
|
||||
|
||||
def test_files(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue