mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Merge branch 'develop'
This commit is contained in:
commit
d23587fcee
14 changed files with 218 additions and 142 deletions
|
@ -3,6 +3,8 @@ Added:
|
||||||
- Finished report to download only
|
- Finished report to download only
|
||||||
- The French manpage (Thanks to marav)
|
- The French manpage (Thanks to marav)
|
||||||
- Check if the file dowwnload
|
- Check if the file dowwnload
|
||||||
|
Updated:
|
||||||
|
- os.istdir method with pathlib module
|
||||||
|
|
||||||
4.4.6 - 06/01/2023
|
4.4.6 - 06/01/2023
|
||||||
Updated:
|
Updated:
|
||||||
|
|
|
@ -31,8 +31,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ tar xvf slpkg-4.4.6.tar.gz
|
$ tar xvf slpkg-4.4.7.tar.gz
|
||||||
$ cd slpkg-4.4.6
|
$ cd slpkg-4.4.7
|
||||||
$ ./install.sh
|
$ ./install.sh
|
||||||
|
|
||||||
Screenshots
|
Screenshots
|
||||||
|
|
33
completion/slpkg
Normal file
33
completion/slpkg
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
_slpkg_module()
|
||||||
|
{
|
||||||
|
local cur prev OPTS
|
||||||
|
COMPREPLY=()
|
||||||
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case $cur in
|
||||||
|
-*)
|
||||||
|
OPTS="
|
||||||
|
--help
|
||||||
|
--version
|
||||||
|
update
|
||||||
|
upgrade
|
||||||
|
check-updates
|
||||||
|
configs
|
||||||
|
clean-logs
|
||||||
|
clean-tmp
|
||||||
|
build
|
||||||
|
install
|
||||||
|
download
|
||||||
|
remove
|
||||||
|
find
|
||||||
|
view
|
||||||
|
search
|
||||||
|
dependees
|
||||||
|
tracking
|
||||||
|
"
|
||||||
|
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
complete -F _slpkg_module slpkg
|
|
@ -1,7 +1,7 @@
|
||||||
.TH slpkg 1 "Orestiada, Grèce" "slpkg 4.4.0" dslackw
|
.TH slpkg 1 "Orestiada, Grèce" "slpkg 4.4.7" dslackw
|
||||||
.SH NOM
|
.SH NOM
|
||||||
.P
|
.P
|
||||||
slpkg - [OPTIONS] [COMMANDE] <packages>.
|
.B slpkg - [OPTIONS] [COMMANDE] <packages>.
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.P
|
.P
|
||||||
slpkg [-h|-v] [update] [upgrade] [check-updates] [configs] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download]
|
slpkg [-h|-v] [update] [upgrade] [check-updates] [configs] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download]
|
||||||
|
@ -17,78 +17,78 @@ Il calcule automatiquement \fBles dépendances\fP et détermine comment doit se
|
||||||
Il utilise également les instructions de \fBSlackware Linux\fP pour l'installation, la mise à jour ou la suppression des paquets.
|
Il utilise également les instructions de \fBSlackware Linux\fP pour l'installation, la mise à jour ou la suppression des paquets.
|
||||||
.SH COMMANDES
|
.SH COMMANDES
|
||||||
.P
|
.P
|
||||||
update
|
.B update --yes
|
||||||
.RS
|
.RS
|
||||||
Met à jour la liste des paquets et la base de données.
|
Met à jour la liste des paquets et la base de données.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
upgrade
|
.B upgrade --yes, --jobs, --resolve-off, --reinstall
|
||||||
.RS
|
.RS
|
||||||
Met à niveau tous les paquets installés si une version plus récente existe dans le référentiel.
|
Met à niveau tous les paquets installés si une version plus récente existe dans le référentiel.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
check-updates
|
.B check-updates
|
||||||
.RS
|
.RS
|
||||||
Vérifie si le fichier \fBChangeLog.txt\fP du SlackBuild contient des mises à jour.
|
Vérifie si le fichier \fBChangeLog.txt\fP du SlackBuild contient des mises à jour.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
configs
|
.B configs
|
||||||
.RS
|
.RS
|
||||||
Modifier le fichier de configuration \fB/etc/slpkg/slpkg.toml\fP.
|
Modifier le fichier de configuration \fB/etc/slpkg/slpkg.toml\fP.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
clean-logs
|
.B clean-logs --yes
|
||||||
.RS
|
.RS
|
||||||
Nettoie les journaux de suivi de dépendances. \fBAttention\fP, après cette procédure vous devrez supprimer les dépendances à la main.
|
Nettoie les journaux de suivi de dépendances. \fBAttention\fP, après cette procédure vous devrez supprimer les dépendances à la main.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
clean-tmp
|
.B clean-tmp
|
||||||
.RS
|
.RS
|
||||||
Supprime tous les scripts et sources des SlackBuilds téléchargés.
|
Supprime tous les scripts et sources des SlackBuilds téléchargés.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-b, build
|
.B -b, build --yes, --jobs, --resolve-off, --search
|
||||||
.RS
|
.RS
|
||||||
Construit les scripts des Slackbuilds et les ajoute au répertoire \fB/tmp\fP.
|
Construit les scripts des Slackbuilds et les ajoute au répertoire \fB/tmp\fP.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-i, install
|
.B -i, install --yes, --jobs, --resolve-off, --reinstall, --skip-installed, --search
|
||||||
.RS
|
.RS
|
||||||
Construit et installe les paquets dans l'ordre adéquat et enregistre également les paquets avec les dépendances à utiliser pour la suppression.
|
Construit et installe les paquets dans l'ordre adéquat et enregistre également les paquets avec les dépendances à utiliser pour la suppression.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-d, download
|
.B -d, download --yes, --search
|
||||||
.RS
|
.RS
|
||||||
Télécharger les scripts et les sources des SlackBuilds sans les construire ni les installer.
|
Télécharger les scripts et les sources des SlackBuilds sans les construire ni les installer.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-r, remove
|
.B -r, remove --yes, resolve-off, --search
|
||||||
.RS
|
.RS
|
||||||
Supprime les paquets avec leurs dépendances s'ils ont été installés avec la méthode \fB'slpkg install'\fP.
|
Supprime les paquets avec leurs dépendances s'ils ont été installés avec la méthode \fB'slpkg install'\fP.
|
||||||
Slpkg examine la configuration \fB'sbo_repo_tag'\fP pour trouver les paquets à supprimer.
|
Slpkg examine la configuration \fB'sbo_repo_tag'\fP pour trouver les paquets à supprimer.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-f, find
|
.B -f, find --search
|
||||||
.RS
|
.RS
|
||||||
Trouver les paquets installés par \fBSBo\fP (taggés _SBo) sur votre distribution.
|
Trouver les paquets installés par \fBSBo\fP (taggés _SBo) sur votre distribution.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-w, view
|
.B -w, view --search
|
||||||
.RS
|
.RS
|
||||||
Voir les paquets du dépôt et obtenir toutes les informations dans le terminal.
|
Voir les paquets du dépôt et obtenir toutes les informations dans le terminal.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-s, search
|
.B -s, search --search
|
||||||
.RS
|
.RS
|
||||||
Rechercher les paquets.
|
Rechercher les paquets.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-e, dependees
|
.B -e, dependees --full-reverse, --search
|
||||||
.RS
|
.RS
|
||||||
Montre les dépendances du paquet.
|
Montre les dépendances du paquet.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-t, tracking
|
.B -t, tracking --search
|
||||||
.RS
|
.RS
|
||||||
Suivi des dépendances des paquets.
|
Suivi des dépendances des paquets.
|
||||||
.RE
|
.RE
|
||||||
|
|
36
man/slpkg.1
36
man/slpkg.1
|
@ -1,7 +1,7 @@
|
||||||
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.4.0" dslackw
|
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.4.7" dslackw
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.P
|
.P
|
||||||
slpkg - [OPTIONS] [COMMAND] <packages>
|
.B slpkg - [OPTIONS] [COMMAND] <packages>
|
||||||
.SH SYNAPSES
|
.SH SYNAPSES
|
||||||
.P
|
.P
|
||||||
slpkg [-h|-v] [update] [upgrade] [check-updates] [configs] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download]
|
slpkg [-h|-v] [update] [upgrade] [check-updates] [configs] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download]
|
||||||
|
@ -17,78 +17,78 @@ Slpkg works in accordance with the standards of the organization SlackBuilds.org
|
||||||
Also uses the Slackware Linux instructions for installation, upgrading or removing packages.
|
Also uses the Slackware Linux instructions for installation, upgrading or removing packages.
|
||||||
.SH COMMANDS
|
.SH COMMANDS
|
||||||
.P
|
.P
|
||||||
update
|
.B update --yes
|
||||||
.RS
|
.RS
|
||||||
Updates the package list and the database.
|
Updates the package list and the database.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
upgrade
|
.B upgrade --yes, --jobs, --resolve-off, --reinstall
|
||||||
.RS
|
.RS
|
||||||
Upgrade all the installed packages if the newer version exists in the repository.
|
Upgrade all the installed packages if the newer version exists in the repository.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
check-updates
|
.B check-updates
|
||||||
.RS
|
.RS
|
||||||
Check if there is any news on the SlackBuild's ChangeLog.txt file.
|
Check if there is any news on the SlackBuild's ChangeLog.txt file.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
configs
|
.B configs
|
||||||
.RS
|
.RS
|
||||||
Edit the configuration /etc/slpkg/slpkg.toml file.
|
Edit the configuration /etc/slpkg/slpkg.toml file.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
clean-logs
|
.B clean-logs --yes
|
||||||
.RS
|
.RS
|
||||||
Cleans dependencies log tracking. After that procedure you should remove dependencies by hand.
|
Cleans dependencies log tracking. After that procedure you should remove dependencies by hand.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
clean-tmp
|
.B clean-tmp
|
||||||
.RS
|
.RS
|
||||||
Deletes all the downloaded SlackBuilds scripts and sources.
|
Deletes all the downloaded SlackBuilds scripts and sources.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-b, build
|
.B -b, build --yes, --jobs, --resolve-off, --search
|
||||||
.RS
|
.RS
|
||||||
Builds the Slackbuilds scripts and adds them to the /tmp directory.
|
Builds the Slackbuilds scripts and adds them to the /tmp directory.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-i, install
|
.B -i, install --yes, --jobs, --resolve-off, --reinstall, --skip-installed, --search
|
||||||
.RS
|
.RS
|
||||||
Builds and installs the packages in the correct order and also logs the packages with dependencies to use for removal.
|
Builds and installs the packages in the correct order and also logs the packages with dependencies to use for removal.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-d, download
|
.B -d, download --yes, --search
|
||||||
.RS
|
.RS
|
||||||
Download the SlackBuilds scripts and the sources without building or installing it.
|
Download the SlackBuilds scripts and the sources without building or installing it.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-r, remove
|
.B -r, remove --yes, resolve-off, --search
|
||||||
.RS
|
.RS
|
||||||
Removes packages with dependencies if the packages was installed with 'slpkg install' method.
|
Removes packages with dependencies if the packages was installed with 'slpkg install' method.
|
||||||
Slpkg looks at the 'sbo_repo_tag' configuration to find packages for removal.
|
Slpkg looks at the 'sbo_repo_tag' configuration to find packages for removal.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-f, find
|
.B -f, find --search
|
||||||
.RS
|
.RS
|
||||||
Find sbo installed packages on your distribution.
|
Find sbo installed packages on your distribution.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-w, view
|
.B -w, view --search
|
||||||
.RS
|
.RS
|
||||||
View packages from the repository and get everything in your terminal.
|
View packages from the repository and get everything in your terminal.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-s, search
|
.B -s, search --search
|
||||||
.RS
|
.RS
|
||||||
Search and match packages from the repository.
|
Search and match packages from the repository.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-e, dependees
|
.B -e, dependees --full-reverse, --search
|
||||||
.RS
|
.RS
|
||||||
Show which SlackBuilds depend on.
|
Show which SlackBuilds depend on.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
-t, tracking
|
.B -t, tracking --search
|
||||||
.RS
|
.RS
|
||||||
Tracking the packages dependencies.
|
Tracking the packages dependencies.
|
||||||
.RE
|
.RE
|
||||||
|
@ -150,7 +150,7 @@ Configuration file in the /etc/slpkg/slpkg.toml file.
|
||||||
Blacklist file in the /etc/slpkg/blacklist.toml file.
|
Blacklist file in the /etc/slpkg/blacklist.toml file.
|
||||||
.SH REPORT BUGS
|
.SH REPORT BUGS
|
||||||
.P
|
.P
|
||||||
Please report any found to https://gitlab.com/dslackw/slpkg/-/issues.
|
Please report any found to: https://gitlab.com/dslackw/slpkg/-/issues.
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
.P
|
.P
|
||||||
Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = slpkg
|
name = slpkg
|
||||||
version = 4.4.6
|
version = 4.4.7
|
||||||
license_file = LICENSE
|
license_file = LICENSE
|
||||||
author = Dimitris Zlatanidis
|
author = Dimitris Zlatanidis
|
||||||
author_email = d.zlatanidis@gmail.com
|
author_email = d.zlatanidis@gmail.com
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
|
from slpkg.utilities import Utilities
|
||||||
|
|
||||||
|
|
||||||
class FindInstalled:
|
class FindInstalled:
|
||||||
|
@ -13,17 +12,19 @@ class FindInstalled:
|
||||||
self.configs = Configs
|
self.configs = Configs
|
||||||
colors = self.configs.colour
|
colors = self.configs.colour
|
||||||
self.color = colors()
|
self.color = colors()
|
||||||
|
self.utils = Utilities()
|
||||||
|
|
||||||
def find(self, packages: list):
|
def find(self, packages: list):
|
||||||
""" Find the packages. """
|
""" Find the packages. """
|
||||||
matching = []
|
matching = []
|
||||||
|
installed = self.utils.all_installed()
|
||||||
|
|
||||||
print(f'The list below shows the installed packages '
|
print(f'The list below shows the installed packages '
|
||||||
f'that contains \'{", ".join([p for p in packages])}\' files:\n')
|
f'that contains \'{", ".join([p for p in packages])}\' files:\n')
|
||||||
|
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
for package in os.listdir(self.configs.log_packages):
|
for package in installed:
|
||||||
if pkg in package and self.configs.sbo_repo_tag in package:
|
if pkg in package:
|
||||||
matching.append(package)
|
matching.append(package)
|
||||||
self.matched(matching)
|
self.matched(matching)
|
||||||
|
|
||||||
|
|
191
slpkg/main.py
191
slpkg/main.py
|
@ -51,7 +51,7 @@ class Argparse:
|
||||||
self.flag_full_reverse = '--full-reverse'
|
self.flag_full_reverse = '--full-reverse'
|
||||||
self.flag_search = '--search'
|
self.flag_search = '--search'
|
||||||
|
|
||||||
self.dialog_is_enabled()
|
self.is_dialog_enabled()
|
||||||
|
|
||||||
self.options = [self.flag_yes,
|
self.options = [self.flag_yes,
|
||||||
self.flag_jobs,
|
self.flag_jobs,
|
||||||
|
@ -61,7 +61,6 @@ class Argparse:
|
||||||
self.flag_full_reverse,
|
self.flag_full_reverse,
|
||||||
self.flag_search]
|
self.flag_search]
|
||||||
|
|
||||||
self.check_for_flags()
|
|
||||||
self.remove_flags()
|
self.remove_flags()
|
||||||
|
|
||||||
def remove_flags(self):
|
def remove_flags(self):
|
||||||
|
@ -71,20 +70,80 @@ class Argparse:
|
||||||
self.args.remove(opt)
|
self.args.remove(opt)
|
||||||
self.flags.append(opt)
|
self.flags.append(opt)
|
||||||
|
|
||||||
def dialog_is_enabled(self):
|
def is_dialog_enabled(self):
|
||||||
""" Checking if the dialog box is enabled. """
|
""" Checking if the dialog box is enabled. """
|
||||||
if (not self.configs.dialog and self.flag_search in self.args or
|
if (not self.configs.dialog and self.flag_search in self.args or
|
||||||
not self.configs.dialog and 'configs' in self.args):
|
not self.configs.dialog and 'configs' in self.args):
|
||||||
print("Error: You should enable the dialog "
|
raise SystemExit("\nError: You should enable the dialog "
|
||||||
"in the '/etc/slpkg/' folder.\n")
|
"in the '/etc/slpkg/' folder.\n")
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
def check_for_flags(self):
|
def check_for_flags(self, command):
|
||||||
""" Check for correct flag. """
|
""" Check for correct flag. """
|
||||||
for opt in self.args:
|
|
||||||
if opt.startswith('--'):
|
commands = {
|
||||||
if opt not in self.options and opt not in ['--help', '--version']:
|
'--help': [],
|
||||||
raise SystemExit(f"\nError: flag '{opt}' does not exist.\n")
|
'--version': [],
|
||||||
|
'update': [self.flag_yes],
|
||||||
|
'upgrade': [
|
||||||
|
self.flag_yes,
|
||||||
|
self.flag_jobs,
|
||||||
|
self.flag_resolve_off,
|
||||||
|
self.flag_reinstall
|
||||||
|
],
|
||||||
|
'check-updates': [],
|
||||||
|
'configs': [],
|
||||||
|
'clean-logs': [self.flag_yes],
|
||||||
|
'clean-tmp': [],
|
||||||
|
'build': [
|
||||||
|
self.flag_yes,
|
||||||
|
self.flag_jobs,
|
||||||
|
self.flag_resolve_off,
|
||||||
|
self.flag_search
|
||||||
|
],
|
||||||
|
'install': [
|
||||||
|
self.flag_yes,
|
||||||
|
self.flag_jobs,
|
||||||
|
self.flag_resolve_off,
|
||||||
|
self.flag_reinstall,
|
||||||
|
self.flag_skip_installed,
|
||||||
|
self.flag_search
|
||||||
|
],
|
||||||
|
'download': [
|
||||||
|
self.flag_yes,
|
||||||
|
self.flag_search
|
||||||
|
],
|
||||||
|
'remove': [
|
||||||
|
self.flag_yes,
|
||||||
|
self.flag_resolve_off,
|
||||||
|
self.flag_search
|
||||||
|
],
|
||||||
|
'find': [self.flag_search],
|
||||||
|
'view': [self.flag_search],
|
||||||
|
'search': [self.flag_search],
|
||||||
|
'dependees': [
|
||||||
|
self.flag_full_reverse,
|
||||||
|
self.flag_search
|
||||||
|
],
|
||||||
|
'tracking': [self.flag_search]
|
||||||
|
}
|
||||||
|
|
||||||
|
commands['-h'] = commands['--help']
|
||||||
|
commands['-v'] = commands['--version']
|
||||||
|
commands['-b'] = commands['build']
|
||||||
|
commands['-i'] = commands['install']
|
||||||
|
commands['-d'] = commands['download']
|
||||||
|
commands['-r'] = commands['remove']
|
||||||
|
commands['-f'] = commands['find']
|
||||||
|
commands['-w'] = commands['view']
|
||||||
|
commands['-s'] = commands['search']
|
||||||
|
commands['-e'] = commands['dependees']
|
||||||
|
commands['-t'] = commands['tracking']
|
||||||
|
|
||||||
|
flags = commands[command]
|
||||||
|
|
||||||
|
for opt in self.flags:
|
||||||
|
if opt not in flags and opt not in ['--help', '--version']:
|
||||||
|
self.usage.error_for_options(flags)
|
||||||
|
|
||||||
def choose_packages(self, packages, method):
|
def choose_packages(self, packages, method):
|
||||||
""" Choose packages with dialog utility and --search flag. """
|
""" Choose packages with dialog utility and --search flag. """
|
||||||
|
@ -96,7 +155,7 @@ class Argparse:
|
||||||
repo_packages = SBoQueries('').sbos()
|
repo_packages = SBoQueries('').sbos()
|
||||||
|
|
||||||
# Grab all the installed packages
|
# Grab all the installed packages
|
||||||
installed = os.listdir(self.configs.log_packages)
|
installed = self.utils.all_installed()
|
||||||
|
|
||||||
if method in ['remove', 'find']:
|
if method in ['remove', 'find']:
|
||||||
|
|
||||||
|
@ -104,10 +163,9 @@ class Argparse:
|
||||||
name = self.utils.split_installed_pkg(package)[0]
|
name = self.utils.split_installed_pkg(package)[0]
|
||||||
version = self.utils.split_installed_pkg(package)[1]
|
version = self.utils.split_installed_pkg(package)[1]
|
||||||
|
|
||||||
if package.endswith(self.configs.sbo_repo_tag):
|
for pkg in packages:
|
||||||
for pkg in packages:
|
if pkg in name:
|
||||||
if pkg in name:
|
choices += [(name, version, False)]
|
||||||
choices += [(name, version, False)]
|
|
||||||
else:
|
else:
|
||||||
for package in repo_packages:
|
for package in repo_packages:
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
|
@ -141,21 +199,18 @@ class Argparse:
|
||||||
return tags
|
return tags
|
||||||
|
|
||||||
def help(self):
|
def help(self):
|
||||||
if len(self.args) == 1 and not self.flags:
|
if len(self.args) == 1:
|
||||||
self.usage.help(0)
|
self.usage.help(0)
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def version(self):
|
def version(self):
|
||||||
if len(self.args) == 1 and not self.flags:
|
if len(self.args) == 1:
|
||||||
version = Version()
|
version = Version()
|
||||||
version.view()
|
version.view()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_yes]]:
|
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) == 1:
|
if len(self.args) == 1:
|
||||||
update = UpdateRepository(self.flags)
|
update = UpdateRepository(self.flags)
|
||||||
update.repository()
|
update.repository()
|
||||||
|
@ -163,11 +218,7 @@ class Argparse:
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def upgrade(self):
|
def upgrade(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_yes,
|
command = Argparse.upgrade.__name__
|
||||||
self.flag_jobs,
|
|
||||||
self.flag_resolve_off,
|
|
||||||
self.flag_reinstall]]:
|
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) == 1:
|
if len(self.args) == 1:
|
||||||
self.check.database()
|
self.check.database()
|
||||||
|
@ -175,21 +226,19 @@ class Argparse:
|
||||||
upgrade = Upgrade()
|
upgrade = Upgrade()
|
||||||
packages = list(upgrade.packages())
|
packages = list(upgrade.packages())
|
||||||
|
|
||||||
packages = self.choose_packages(packages,
|
packages = self.choose_packages(packages, command)
|
||||||
Argparse.upgrade.__name__)
|
|
||||||
|
|
||||||
if not packages:
|
if not packages:
|
||||||
print('\nEverything is up-to-date.\n')
|
print('\nEverything is up-to-date.\n')
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
||||||
install = Slackbuilds(packages, self.flags,
|
install = Slackbuilds(packages, self.flags, mode=command)
|
||||||
mode=Argparse.upgrade.__name__)
|
|
||||||
install.execute()
|
install.execute()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def check_updates(self):
|
def check_updates(self):
|
||||||
if len(self.args) == 1 and not self.flags:
|
if len(self.args) == 1:
|
||||||
self.check.database()
|
self.check.database()
|
||||||
|
|
||||||
check = CheckUpdates()
|
check = CheckUpdates()
|
||||||
|
@ -198,15 +247,12 @@ class Argparse:
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def edit_configs(self):
|
def edit_configs(self):
|
||||||
if len(self.args) == 1 and not self.flags:
|
if len(self.args) == 1:
|
||||||
self.form_configs.edit()
|
self.form_configs.edit()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def clean_logs(self):
|
def clean_logs(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_yes]]:
|
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) == 1:
|
if len(self.args) == 1:
|
||||||
self.check.database()
|
self.check.database()
|
||||||
|
|
||||||
|
@ -216,7 +262,7 @@ class Argparse:
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def clean_tmp(self):
|
def clean_tmp(self):
|
||||||
if len(self.args) == 1 and not self.flags:
|
if len(self.args) == 1:
|
||||||
path = self.configs.tmp_path
|
path = self.configs.tmp_path
|
||||||
tmp_slpkg = self.configs.tmp_slpkg
|
tmp_slpkg = self.configs.tmp_slpkg
|
||||||
folder = self.configs.prog_name
|
folder = self.configs.prog_name
|
||||||
|
@ -227,66 +273,49 @@ class Argparse:
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_yes,
|
command = Argparse.build.__name__
|
||||||
self.flag_jobs,
|
|
||||||
self.flag_resolve_off,
|
|
||||||
self.flag_search]]:
|
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) >= 2:
|
if len(self.args) >= 2:
|
||||||
packages = list(set(self.args[1:]))
|
packages = list(set(self.args[1:]))
|
||||||
|
|
||||||
if '--search' in self.flags:
|
if '--search' in self.flags:
|
||||||
packages = self.choose_packages(packages,
|
packages = self.choose_packages(packages, command)
|
||||||
Argparse.build.__name__)
|
|
||||||
|
|
||||||
self.check.database()
|
self.check.database()
|
||||||
self.check.exists(packages)
|
self.check.exists(packages)
|
||||||
self.check.unsupported(packages)
|
self.check.unsupported(packages)
|
||||||
|
|
||||||
build = Slackbuilds(packages, self.flags,
|
build = Slackbuilds(packages, self.flags, mode=command)
|
||||||
mode=Argparse.build.__name__)
|
|
||||||
build.execute()
|
build.execute()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_yes,
|
command = Argparse.install.__name__
|
||||||
self.flag_jobs,
|
|
||||||
self.flag_resolve_off,
|
|
||||||
self.flag_reinstall,
|
|
||||||
self.flag_skip_installed,
|
|
||||||
self.flag_search]]:
|
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) >= 2:
|
if len(self.args) >= 2:
|
||||||
packages = list(set(self.args[1:]))
|
packages = list(set(self.args[1:]))
|
||||||
|
|
||||||
if '--search' in self.flags:
|
if '--search' in self.flags:
|
||||||
packages = self.choose_packages(packages,
|
packages = self.choose_packages(packages, command)
|
||||||
Argparse.install.__name__)
|
|
||||||
|
|
||||||
self.check.database()
|
self.check.database()
|
||||||
self.check.exists(packages)
|
self.check.exists(packages)
|
||||||
self.check.unsupported(packages)
|
self.check.unsupported(packages)
|
||||||
|
|
||||||
install = Slackbuilds(packages, self.flags,
|
install = Slackbuilds(packages, self.flags, mode=command)
|
||||||
mode=Argparse.install.__name__)
|
|
||||||
install.execute()
|
install.execute()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def download(self):
|
def download(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_yes,
|
command = Argparse.download.__name__
|
||||||
self.flag_search]]:
|
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) >= 2:
|
if len(self.args) >= 2:
|
||||||
packages = list(set(self.args[1:]))
|
packages = list(set(self.args[1:]))
|
||||||
|
|
||||||
if '--search' in self.flags:
|
if '--search' in self.flags:
|
||||||
packages = self.choose_packages(packages,
|
packages = self.choose_packages(packages, command)
|
||||||
Argparse.download.__name__)
|
|
||||||
|
|
||||||
self.check.database()
|
self.check.database()
|
||||||
self.check.exists(packages)
|
self.check.exists(packages)
|
||||||
|
@ -296,17 +325,13 @@ class Argparse:
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def remove(self):
|
def remove(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_yes,
|
command = Argparse.remove.__name__
|
||||||
self.flag_resolve_off,
|
|
||||||
self.flag_search]]:
|
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) >= 2:
|
if len(self.args) >= 2:
|
||||||
packages = list(set(self.args[1:]))
|
packages = list(set(self.args[1:]))
|
||||||
|
|
||||||
if '--search' in self.flags:
|
if '--search' in self.flags:
|
||||||
packages = self.choose_packages(packages,
|
packages = self.choose_packages(packages, command)
|
||||||
Argparse.remove.__name__)
|
|
||||||
|
|
||||||
self.check.database()
|
self.check.database()
|
||||||
packages = self.check.installed(packages)
|
packages = self.check.installed(packages)
|
||||||
|
@ -317,15 +342,13 @@ class Argparse:
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def find(self):
|
def find(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_search]]:
|
command = Argparse.find.__name__
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) >= 2:
|
if len(self.args) >= 2:
|
||||||
packages = list(set(self.args[1:]))
|
packages = list(set(self.args[1:]))
|
||||||
|
|
||||||
if '--search' in self.flags:
|
if '--search' in self.flags:
|
||||||
packages = self.choose_packages(packages,
|
packages = self.choose_packages(packages, command)
|
||||||
Argparse.find.__name__)
|
|
||||||
|
|
||||||
self.check.database()
|
self.check.database()
|
||||||
|
|
||||||
|
@ -335,15 +358,13 @@ class Argparse:
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_search]]:
|
command = Argparse.view.__name__
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) >= 2:
|
if len(self.args) >= 2:
|
||||||
packages = list(set(self.args[1:]))
|
packages = list(set(self.args[1:]))
|
||||||
|
|
||||||
if '--search' in self.flags:
|
if '--search' in self.flags:
|
||||||
packages = self.choose_packages(packages,
|
packages = self.choose_packages(packages, command)
|
||||||
Argparse.view.__name__)
|
|
||||||
|
|
||||||
self.check.database()
|
self.check.database()
|
||||||
self.check.exists(packages)
|
self.check.exists(packages)
|
||||||
|
@ -354,15 +375,13 @@ class Argparse:
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def search(self):
|
def search(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_search]]:
|
command = Argparse.search.__name__
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) >= 2:
|
if len(self.args) >= 2:
|
||||||
packages = list(set(self.args[1:]))
|
packages = list(set(self.args[1:]))
|
||||||
|
|
||||||
if '--search' in self.flags:
|
if '--search' in self.flags:
|
||||||
packages = self.choose_packages(packages,
|
packages = self.choose_packages(packages, command)
|
||||||
Argparse.search.__name__)
|
|
||||||
|
|
||||||
self.check.database()
|
self.check.database()
|
||||||
|
|
||||||
|
@ -372,16 +391,13 @@ class Argparse:
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def dependees(self):
|
def dependees(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_full_reverse,
|
command = Argparse.dependees.__name__
|
||||||
self.flag_search]]:
|
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) >= 2:
|
if len(self.args) >= 2:
|
||||||
packages = list(set(self.args[1:]))
|
packages = list(set(self.args[1:]))
|
||||||
|
|
||||||
if '--search' in self.flags:
|
if '--search' in self.flags:
|
||||||
packages = self.choose_packages(packages,
|
packages = self.choose_packages(packages, command)
|
||||||
Argparse.dependees.__name__)
|
|
||||||
|
|
||||||
self.check.database()
|
self.check.database()
|
||||||
self.check.exists(packages)
|
self.check.exists(packages)
|
||||||
|
@ -392,15 +408,13 @@ class Argparse:
|
||||||
self.usage.help(1)
|
self.usage.help(1)
|
||||||
|
|
||||||
def tracking(self):
|
def tracking(self):
|
||||||
if [f for f in self.flags if f not in [self.flag_search]]:
|
command = Argparse.tracking.__name__
|
||||||
self.usage.help(1)
|
|
||||||
|
|
||||||
if len(self.args) >= 2:
|
if len(self.args) >= 2:
|
||||||
packages = list(set(self.args[1:]))
|
packages = list(set(self.args[1:]))
|
||||||
|
|
||||||
if '--search' in self.flags:
|
if '--search' in self.flags:
|
||||||
packages = self.choose_packages(packages,
|
packages = self.choose_packages(packages, command)
|
||||||
Argparse.tracking.__name__)
|
|
||||||
|
|
||||||
self.check.database()
|
self.check.database()
|
||||||
self.check.exists(packages)
|
self.check.exists(packages)
|
||||||
|
@ -449,6 +463,7 @@ def main():
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
argparse.check_for_flags(args[0])
|
||||||
arguments[args[0]]()
|
arguments[args[0]]()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
Usage().help(1)
|
Usage().help(1)
|
||||||
|
|
|
@ -249,12 +249,10 @@ class Slackbuilds:
|
||||||
installation. """
|
installation. """
|
||||||
version = SBoQueries(name).version()
|
version = SBoQueries(name).version()
|
||||||
|
|
||||||
packages = []
|
pattern = f'{name}-{version}-*{self.configs.sbo_repo_tag}*'
|
||||||
pkg = f'{name}-{version}'
|
|
||||||
|
|
||||||
for package in os.listdir(self.configs.tmp_path):
|
tmp = Path(self.configs.tmp_path)
|
||||||
if pkg in package and self.configs.sbo_repo_tag in package:
|
packages = [file.name for file in tmp.glob(pattern)]
|
||||||
packages.append(package)
|
|
||||||
|
|
||||||
return max(packages)
|
return max(packages)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
@ -27,7 +26,9 @@ class Upgrade:
|
||||||
black = Blacklist().get()
|
black = Blacklist().get()
|
||||||
upgrade, requires = [], []
|
upgrade, requires = [], []
|
||||||
|
|
||||||
for pkg in os.listdir(self.configs.log_packages):
|
installed = self.utils.all_installed()
|
||||||
|
|
||||||
|
for pkg in installed:
|
||||||
inst_pkg_name = self.utils.split_installed_pkg(pkg)[0]
|
inst_pkg_name = self.utils.split_installed_pkg(pkg)[0]
|
||||||
|
|
||||||
if (pkg.endswith(self.configs.sbo_repo_tag)
|
if (pkg.endswith(self.configs.sbo_repo_tag)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
|
||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
import tarfile
|
import tarfile
|
||||||
|
@ -24,12 +23,26 @@ class Utilities:
|
||||||
|
|
||||||
def is_installed(self, name: str) -> str:
|
def is_installed(self, name: str) -> str:
|
||||||
""" Returns the installed package name. """
|
""" Returns the installed package name. """
|
||||||
for package in os.listdir(self.configs.log_packages):
|
pattern = f'*{self.configs.sbo_repo_tag}'
|
||||||
|
|
||||||
|
var_log_packages = Path(self.configs.log_packages)
|
||||||
|
packages = [file.name for file in var_log_packages.glob(pattern)]
|
||||||
|
|
||||||
|
for package in packages:
|
||||||
pkg = self.split_installed_pkg(package)[0]
|
pkg = self.split_installed_pkg(package)[0]
|
||||||
if pkg == name and self.configs.sbo_repo_tag in package and pkg not in self.black.get():
|
|
||||||
|
if pkg == name and pkg not in self.black.get():
|
||||||
return package
|
return package
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
def all_installed(self):
|
||||||
|
""" Return all installed SBo packages from /val/log/packages folder. """
|
||||||
|
pattern = f'*{self.configs.sbo_repo_tag}'
|
||||||
|
var_log_packages = Path(self.configs.log_packages)
|
||||||
|
installed = [file.name for file in var_log_packages.glob(pattern)]
|
||||||
|
|
||||||
|
return installed
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def untar_archive(path: str, archive: str, ext_path: str):
|
def untar_archive(path: str, archive: str, ext_path: str):
|
||||||
""" Untar the file to the build folder. """
|
""" Untar the file to the build folder. """
|
||||||
|
|
|
@ -70,3 +70,15 @@ class Usage:
|
||||||
|
|
||||||
print(args)
|
print(args)
|
||||||
raise SystemExit(status)
|
raise SystemExit(status)
|
||||||
|
|
||||||
|
def error_for_options(self, flags):
|
||||||
|
""" Error messages for flags. """
|
||||||
|
print(f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] '
|
||||||
|
f'[{self.cyan}COMMAND{self.endc}] <packages>')
|
||||||
|
print("Try 'slpkg --help' for help.\n")
|
||||||
|
if flags:
|
||||||
|
raise SystemExit(f"{self.red}Error:{self.endc} Got an unexpected extra option, "
|
||||||
|
f"please use: \n{self.yellow}'{', '.join(flags)}'{self.endc}")
|
||||||
|
|
||||||
|
raise SystemExit(f"{self.red}Error:{self.endc} Got an unexpected extra option.")
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Version:
|
||||||
""" Print the version. """
|
""" Print the version. """
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.version_info = (4, 4, 6)
|
self.version_info = (4, 4, 7)
|
||||||
self.version = '{0}.{1}.{2}'.format(*self.version_info)
|
self.version = '{0}.{1}.{2}'.format(*self.version_info)
|
||||||
self.license = 'MIT License'
|
self.license = 'MIT License'
|
||||||
self.author = 'Dimitris Zlatanidis (dslackw)'
|
self.author = 'Dimitris Zlatanidis (dslackw)'
|
||||||
|
|
|
@ -91,6 +91,7 @@ class ViewMessage:
|
||||||
print(f'{self.bold}{self.green}{self.llc}' + f'{self.hl}' * (self.columns - 2) + f'{self.lrc}{self.endc}')
|
print(f'{self.bold}{self.green}{self.llc}' + f'{self.hl}' * (self.columns - 2) + f'{self.lrc}{self.endc}')
|
||||||
|
|
||||||
def view_skipping_packages(self, sbo, version):
|
def view_skipping_packages(self, sbo, version):
|
||||||
|
""" Print the skipping packages. """
|
||||||
print(f'[{self.yellow}Skipping{self.endc}] {sbo}-{version} {self.red}(already installed){self.endc}')
|
print(f'[{self.yellow}Skipping{self.endc}] {sbo}-{version} {self.red}(already installed){self.endc}')
|
||||||
|
|
||||||
def build_packages(self, slackbuilds: list, dependencies: list):
|
def build_packages(self, slackbuilds: list, dependencies: list):
|
||||||
|
@ -179,7 +180,7 @@ class ViewMessage:
|
||||||
|
|
||||||
def _view_removed(self, name: str):
|
def _view_removed(self, name: str):
|
||||||
""" View and creates list with packages for remove. """
|
""" View and creates list with packages for remove. """
|
||||||
installed = os.listdir(self.configs.log_packages)
|
installed = self.utils.all_installed()
|
||||||
|
|
||||||
if self.utils.is_installed(name):
|
if self.utils.is_installed(name):
|
||||||
for package in installed:
|
for package in installed:
|
||||||
|
|
Loading…
Add table
Reference in a new issue