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
452e809fd3
11 changed files with 71 additions and 22 deletions
|
@ -1,3 +1,11 @@
|
|||
4.2.3 - 28/10/2022
|
||||
Updated:
|
||||
- Creating all necessary paths from the config file
|
||||
- Logs cleaning view dependencies
|
||||
Added:
|
||||
- Check if database file exists
|
||||
- Check if the package exists in the database before upgrade
|
||||
|
||||
4.2.2 - 20/10/2022
|
||||
Updated:
|
||||
- Removed version for skip installed option
|
||||
|
|
|
@ -30,8 +30,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tar xvf slpkg-4.2.2.tar.gz
|
||||
$ cd slpkg-4.2.2
|
||||
$ tar xvf slpkg-4.2.3.tar.gz
|
||||
$ cd slpkg-4.2.3
|
||||
$ ./install.sh
|
||||
|
||||
|
||||
|
@ -96,6 +96,6 @@ If you feel satisfied with this project and want to thanks me make a donation.
|
|||
Copyright
|
||||
---------
|
||||
|
||||
- Copyright 2014-2022 © Dimitris Zlatanidis.
|
||||
- Copyright 2014.2.32 © Dimitris Zlatanidis.
|
||||
- Slackware® is a Registered Trademark of Patrick Volkerding.
|
||||
- Linux is a Registered Trademark of Linus Torvalds.
|
||||
|
|
|
@ -39,8 +39,8 @@ configs:
|
|||
# Slackware command fro remove packages.
|
||||
removepkg: removepkg
|
||||
|
||||
# Cli menu colors configs. Default is on. [on/off]
|
||||
colors: on
|
||||
# Cli menu colors configs. Default is off. [on/off]
|
||||
colors: off
|
||||
|
||||
# Wget downloader options.
|
||||
# -c, --continue: resume getting a partially-downloaded file.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = slpkg
|
||||
version = 4.2.2
|
||||
version = 4.2.3
|
||||
license_file = LICENSE
|
||||
author = Dimitris Zlatanidis
|
||||
author_email = d.zlatanidis@gmail.com
|
||||
|
|
|
@ -97,7 +97,7 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr
|
|||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
# 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
|
||||
install -D -m0644 configs/slpkg.yml $PKG/etc/slpkg/slpkg.yml.new
|
||||
install -D -m0645 configs/blacklist.yml $PKG/etc/slpkg/blacklist.yml.new
|
||||
|
||||
|
|
|
@ -14,10 +14,11 @@ class Check:
|
|||
''' Some checks before proceed. '''
|
||||
log_packages: str = Configs.log_packages
|
||||
sbo_repo_tag: str = Configs.sbo_repo_tag
|
||||
db_path: str = Configs.db_path
|
||||
database_name: str = Configs.database
|
||||
|
||||
def exists(self, slackbuilds: list):
|
||||
''' Checking if the slackbuild exists in the repository. '''
|
||||
self.database()
|
||||
packages = []
|
||||
|
||||
for sbo in slackbuilds:
|
||||
|
@ -59,6 +60,7 @@ class Check:
|
|||
|
||||
def database(self):
|
||||
''' Checking for empty table '''
|
||||
if not SBoQueries('').names():
|
||||
db = f'{self.db_path}/{self.database_name}'
|
||||
if not SBoQueries('').names() or not os.path.isfile(db):
|
||||
raise SystemExit('\nYou need to update the package lists first.\n'
|
||||
'Please run slpkg update.\n')
|
||||
|
|
|
@ -44,15 +44,11 @@ class Configs:
|
|||
removepkg: str = 'removepkg'
|
||||
|
||||
# Cli menu colors configs
|
||||
colors: str = 'on'
|
||||
colors: str = 'off'
|
||||
|
||||
# Wget options
|
||||
wget_options = '-c -N'
|
||||
|
||||
# Creating the build path
|
||||
if not os.path.isdir(build_path):
|
||||
os.makedirs(build_path)
|
||||
|
||||
''' Overwrite with user configuration. '''
|
||||
config_file: str = f'{etc_path}/{prog_name}.yml'
|
||||
if os.path.isfile(config_file):
|
||||
|
@ -95,6 +91,19 @@ class Configs:
|
|||
except KeyError:
|
||||
pass
|
||||
|
||||
# Creating the paths if they doesn't exists
|
||||
paths = [tmp_slpkg,
|
||||
build_path,
|
||||
download_only,
|
||||
sbo_repo_path,
|
||||
lib_path,
|
||||
etc_path,
|
||||
db_path]
|
||||
|
||||
for path in paths:
|
||||
if not os.path.isdir(path):
|
||||
os.makedirs(path)
|
||||
|
||||
@classmethod
|
||||
def colour(cls):
|
||||
color = {
|
||||
|
|
|
@ -67,6 +67,8 @@ class Argparse:
|
|||
|
||||
def upgrade(self):
|
||||
if len(self.args) == 1:
|
||||
self.check.database()
|
||||
|
||||
upgrade = Upgrade()
|
||||
packages = list(upgrade.packages())
|
||||
|
||||
|
@ -83,6 +85,7 @@ class Argparse:
|
|||
if len(self.args) >= 2 and '--reinstall' not in self.flags:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
self.check.exists(packages)
|
||||
self.check.unsupported(packages)
|
||||
|
||||
|
@ -95,6 +98,7 @@ class Argparse:
|
|||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
self.check.exists(packages)
|
||||
self.check.unsupported(packages)
|
||||
|
||||
|
@ -110,6 +114,7 @@ class Argparse:
|
|||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
self.check.exists(packages)
|
||||
download = Download(self.flags)
|
||||
download.packages(packages)
|
||||
|
@ -123,6 +128,9 @@ class Argparse:
|
|||
|
||||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
self.check.installed(packages)
|
||||
|
@ -135,6 +143,9 @@ class Argparse:
|
|||
def view(self):
|
||||
if len(self.args) >= 2 and not self.flags:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
self.check.exists(packages)
|
||||
|
@ -147,6 +158,9 @@ class Argparse:
|
|||
def search(self):
|
||||
if len(self.args) >= 2 and not self.flags:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
search = SearchPackage()
|
||||
|
@ -157,6 +171,9 @@ class Argparse:
|
|||
def find(self):
|
||||
if len(self.args) >= 2 and not self.flags:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
find = FindInstalled()
|
||||
|
@ -169,6 +186,8 @@ class Argparse:
|
|||
usage(1)
|
||||
|
||||
if len(self.args) == 1:
|
||||
self.check.database()
|
||||
|
||||
logs = CleanLogsDependencies(self.flags)
|
||||
logs.clean()
|
||||
raise SystemExit()
|
||||
|
|
|
@ -16,11 +16,18 @@ class Upgrade:
|
|||
|
||||
def packages(self):
|
||||
''' Compares version of packages and returns the maximum. '''
|
||||
print("Do not forget to run 'slpkg update' before.")
|
||||
|
||||
repo_packages = SBoQueries('').names()
|
||||
|
||||
for pkg in os.listdir(self.log_packages):
|
||||
if pkg.endswith(self.sbo_repo_tag):
|
||||
name = '-'.join(pkg.split('-')[:-3])
|
||||
installed_ver = pkg.replace(name + '-', '').split('-')[0]
|
||||
repo_ver = SBoQueries(name).version()
|
||||
inst_pkg_name = '-'.join(pkg.split('-')[:-3])
|
||||
|
||||
if LooseVersion(repo_ver) > LooseVersion(installed_ver):
|
||||
yield name
|
||||
if inst_pkg_name in repo_packages:
|
||||
installed_ver = pkg.replace(
|
||||
inst_pkg_name + '-', '').split('-')[0]
|
||||
repo_ver = SBoQueries(inst_pkg_name).version()
|
||||
|
||||
if LooseVersion(repo_ver) > LooseVersion(installed_ver):
|
||||
yield inst_pkg_name
|
||||
|
|
|
@ -10,7 +10,7 @@ from slpkg.configs import Configs
|
|||
@dataclass
|
||||
class Version:
|
||||
prog_name: str = Configs.prog_name
|
||||
version_info: tuple = (4, 2, 2)
|
||||
version_info: tuple = (4, 2, 3)
|
||||
version: str = '{0}.{1}.{2}'.format(*version_info)
|
||||
license: str = 'MIT License'
|
||||
author: str = 'dslackw'
|
||||
|
|
|
@ -116,6 +116,10 @@ class ViewMessage:
|
|||
self.arch = 'noarch'
|
||||
|
||||
if installed:
|
||||
|
||||
if '--reinstall' not in self.flags:
|
||||
install = 'installed'
|
||||
|
||||
print(f'[{set_color} {install} {color["ENDC"]}] -> '
|
||||
f'{sbo}-{version} {set_color}'
|
||||
f'({installed.split(self.arch)[0][:-1].split("-")[-1]})'
|
||||
|
@ -166,8 +170,8 @@ class ViewMessage:
|
|||
|
||||
for dep in dependencies:
|
||||
print(f'{color["CYAN"]}{dep[0]}{color["ENDC"]}')
|
||||
print('Dependencies:')
|
||||
print(f'{color["CYAN"]} {dep[1]}{color["ENDC"]}\n')
|
||||
print(' |')
|
||||
print(f' +->{color["CYAN"]} {dep[1]}{color["ENDC"]}\n')
|
||||
print('Note: After cleaning you should remove them one by one.')
|
||||
|
||||
def question(self):
|
||||
|
|
Loading…
Reference in a new issue