Added option --repo-version

This commit is contained in:
Dimitris Zlatanidis 2023-01-17 21:03:01 +02:00
parent 9f4df08ba0
commit 26ebca4589
8 changed files with 68 additions and 18 deletions

View file

@ -1,6 +1,7 @@
4.5.1 - 16/01/2023
Added:
- Option --directory=PATH for download command
- Option --repo-version for print repository version
4.5.0 - 14/01/2023
Updated:

View file

@ -89,6 +89,7 @@ Usage
--search Search packages from the repository.
--no-silent Disable silent mode.
--directory=PATH Download files to a specific path.
--repo-version Print the repository package version.
-h, --help Show this message and exit.
-v, --version Print version and exit.

View file

@ -6,7 +6,7 @@
.P
slpkg [-h|-v] [update] [upgrade] [check-updates] [configs] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download]
[-r, remove] [-f, find] [-w, view] [-s, search] [-e, dependees] [-t, tracking] --yes, --jobs, --resolve-off,
--reinstall, --skip-installed, --full-reverse, --search, --no-silent, --directory=PATH
--reinstall, --skip-installed, --full-reverse, --search, --no-silent, --directory=PATH, --repo-version
.SH DESCRIPTION
.P
\fBSlpkg\fP est un gestionnaire de paquets logiciels qui \fBinstalle\fP, \fBmet à jour\fP et \fBsupprime\fP les paquets pour les systèmes basés sur \fBSlackware\fP.
@ -83,12 +83,12 @@ Voir les paquets du dépôt et obtenir toutes les informations dans le terminal.
Rechercher les paquets.
.RE
.P
.B -e, dependees --full-reverse, --search
.B -e, dependees --full-reverse, --search, --repo-version
.RS
Montre les dépendances du paquet.
.RE
.P
.B -t, tracking --search
.B -t, tracking --search, --repo-version
.RS
Suivi des dépendances des paquets.
.RE
@ -144,6 +144,11 @@ Désactive le mode silencieux s'il est activé dans le fichier de configuration.
Le répertoire est le chemin où les fichiers seront enregistrés.
.RE
.P
--repo-version
.RS
Imprimez la version du package du référentiel.
.RE
.P
-h | --help
.RS
Affiche l'aide.

View file

@ -6,7 +6,7 @@
.P
slpkg [-h|-v] [update] [upgrade] [check-updates] [configs] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download]
[-r, remove] [-f, find] [-w, view] [-s, search] [-e, dependees] [-t, tracking] --yes, --jobs, --resolve-off,
--reinstall, --skip-installed, --full-reverse, --search, --no-silent, --directory=PATH
--reinstall, --skip-installed, --full-reverse, --search, --no-silent, --directory=PATH, --repo-version
.SH DESCRIPTION
.P
Slpkg is a software package manager that installs, updates, and removes packages on Slackware based systems.
@ -83,12 +83,12 @@ View packages from the repository and get everything in your terminal.
Search and match packages from the repository.
.RE
.P
.B -e, dependees --full-reverse, --search
.B -e, dependees --full-reverse, --search, --repo-version
.RS
Show which SlackBuilds depend on.
.RE
.P
.B -t, tracking --search
.B -t, tracking --search, --repo-version
.RS
Tracking the packages dependencies.
.RE
@ -144,6 +144,11 @@ Disable silent mode if it is enabled in the configuration file.
The directory is the path where the files will be saved.
.RE
.P
--repo-version
.RS
Print the repository package version.
.RE
.P
-h | --help
.RS
Show help information and exit.

View file

@ -3,6 +3,7 @@
from slpkg.configs import Configs
from slpkg.views.ascii import Ascii
from slpkg.queries import SBoQueries
from slpkg.models.models import SBoTable
from slpkg.models.models import session as Session
@ -14,6 +15,7 @@ class Dependees:
self.packages = packages
self.flags = flags
self.flag_full_reverse = '--full-reverse'
self.flag_repo_version = '--repo-version'
self.configs = Configs
self.session = Session
self.ascii = Ascii()
@ -37,23 +39,38 @@ class Dependees:
for pkg in self.packages:
dependees = list(self.find_requires(pkg))
print(f'{self.byellow}{pkg}{self.endc}')
package = f'{self.byellow}{pkg}{self.endc}'
if self.flag_repo_version in self.flags:
package = f'{self.byellow}{pkg}-{SBoQueries(pkg).version()}{self.endc}'
print(package)
print(f' {self.llc}{self.hl}', end='')
if not dependees:
print(f'{self.cyan} No dependees{self.endc}')
sp = ' ' * 4
for i, dep in enumerate(dependees, start=1):
dependency = f'{self.cyan}{dep[0]}{self.endc}'
if self.flag_repo_version in self.flags:
dependency = (f'{self.cyan}{dep[0]}{self.endc}-{self.yellow}'
f'{SBoQueries(dep[0]).version()}{self.endc}')
if i == 1:
print(f' {self.cyan}{dep[0]}{self.endc}')
print(f' {dependency}')
else:
print(f'{sp}{self.cyan}{dep[0]}{self.endc}')
print(f'{sp}{dependency}')
if self.flag_full_reverse in self.flags:
if i == len(dependees):
print(" " * 4 + f' {self.llc}{self.hl} {self.violet}{dep[1]}{self.endc}')
else:
print(" " * 4 + f' {self.var}{self.hl} {self.violet}{dep[1]}{self.endc}')
print(f'\n{self.grey}{len(dependees)} dependees for {pkg}{self.endc}\n')
def find_requires(self, sbo):

View file

@ -52,6 +52,7 @@ class Argparse(Configs):
self.flag_search = '--search'
self.flag_no_silent = '--no-silent'
self.flag_directory = '--directory='
self.flag_repo_version = '--repo-version'
self.is_dialog_enabled()
@ -63,7 +64,8 @@ class Argparse(Configs):
self.flag_full_reverse,
self.flag_search,
self.flag_no_silent,
self.flag_directory]
self.flag_directory,
self.flag_repo_version]
self.remove_flags()
@ -140,9 +142,13 @@ class Argparse(Configs):
'search': [self.flag_search],
'dependees': [
self.flag_full_reverse,
self.flag_search
self.flag_search,
self.flag_repo_version
],
'tracking': [self.flag_search]
'tracking': [
self.flag_search,
self.flag_repo_version
]
}
commands['-h'] = commands['--help']
@ -437,7 +443,7 @@ class Argparse(Configs):
self.check.database()
self.check.exists(packages)
tracking = Tracking()
tracking = Tracking(self.flags)
tracking.packages(packages)
raise SystemExit()
self.usage.help(1)

View file

@ -3,14 +3,17 @@
from slpkg.configs import Configs
from slpkg.views.ascii import Ascii
from slpkg.queries import SBoQueries
from slpkg.dependencies import Requires
class Tracking(Configs):
""" Tracking of the package dependencies. """
def __init__(self):
def __init__(self, flags: list):
super(Configs, self).__init__()
self.flags = flags
self.flag_repo_version = '--repo-version'
self.ascii = Ascii()
self.llc = self.ascii.lower_left_corner
self.hl = self.ascii.horizontal_line
@ -28,17 +31,28 @@ class Tracking(Configs):
char = f' {self.llc}{self.hl}'
sp = ' ' * 4
for package in packages:
pkg = f'{self.yellow}{package}{self.endc}'
if self.flag_repo_version in self.flags:
pkg = f'{self.yellow}{package}-{SBoQueries(package).version()}{self.endc}'
requires = Requires(package).resolve()
how_many = len(requires)
if not requires:
requires = ['No dependencies']
print(f'{self.yellow}{package}{self.endc}')
print(pkg)
print(char, end='')
for i, req in enumerate(requires, start=1):
require = f'{self.cyan}{req}{self.endc}'
if self.flag_repo_version in self.flags:
require = f'{self.cyan}{req}{self.endc}-{self.yellow}{SBoQueries(req).version()}{self.endc}'
if i == 1:
print(f' {self.cyan}{req}{self.endc}')
print(f' {require}')
else:
print(f'{sp}{self.cyan}{req}{self.endc}')
print(f'{sp}{require}')
print(f'\n{self.grey}{how_many} dependencies for {package}{self.endc}\n')

View file

@ -27,7 +27,7 @@ class Usage(Configs):
f' slpkg [{self.cyan}COMMAND{self.endc}] [-t, tracking] <packages>\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [--yes, --jobs, --resolve-off, --reinstall]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [--skip-installed, --full-reverse, --search]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [--no-silent, --directory=PATH]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [--no-silent, --directory=PATH, --repo-version]\n'
" \nIf you need more information please try 'slpkg --help'.")
print(args)
@ -65,6 +65,7 @@ class Usage(Configs):
f' {self.yellow}--search{self.endc} Search packages from the repository.\n'
f' {self.yellow}--no-silent{self.endc} Disable silent mode.\n'
f' {self.yellow}--directory={self.endc}PATH Download files to a specific path.\n'
f' {self.yellow}--repo-version{self.endc} Print the repository package version.\n'
'\n -h, --help Show this message and exit.\n'
' -v, --version Print version and exit.\n'
'\nEdit the configuration file in the /etc/slpkg/slpkg.toml \n'