mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-17 07:48:18 +01:00
Updated tracking for binaries
This commit is contained in:
parent
6bbe312433
commit
2fc87a3a1d
4 changed files with 39 additions and 15 deletions
|
@ -52,14 +52,11 @@ class Packages(Configs):
|
|||
self.packages_requires: list = []
|
||||
self.install_order: list = []
|
||||
self.binary_packages: list = []
|
||||
self.flag_binary: list = ['-B', '--binary']
|
||||
self.flag_reinstall: list = ['-r', '--reinstall']
|
||||
self.flag_skip_installed: list = ['-k', '--skip-installed']
|
||||
self.flag_no_silent: list = ['-n', '--no-silent']
|
||||
self.flag_resolve_off: list = ['-o', '--resolve-off']
|
||||
|
||||
self.repo_package_names: list = BinQueries('', self.repo).all_package_names()
|
||||
|
||||
def execute(self) -> None:
|
||||
self.dependencies()
|
||||
|
||||
|
@ -85,7 +82,7 @@ class Packages(Configs):
|
|||
|
||||
# Clean dependencies from the dependencies list if already added with main packages.
|
||||
for req in self.packages_requires:
|
||||
if req not in self.packages and req in self.repo_package_names:
|
||||
if req not in self.packages:
|
||||
requires.append(req)
|
||||
|
||||
requires = list(set(requires))
|
||||
|
|
|
@ -11,16 +11,24 @@ class Required:
|
|||
def __init__(self, name: str, repo: str):
|
||||
self.name: str = name
|
||||
self.repo: str = repo
|
||||
self.repo_package_names: list = BinQueries(name, self.repo).all_package_names()
|
||||
|
||||
def resolve(self) -> list:
|
||||
""" Resolve the dependencies. """
|
||||
requires: list[str] = BinQueries(self.name, self.repo).required()
|
||||
|
||||
for req in requires:
|
||||
if req:
|
||||
sub: list[str] = BinQueries(req, self.repo).required()
|
||||
|
||||
for s in sub:
|
||||
requires.append(s)
|
||||
|
||||
# Clean for dependencies not in the repository.
|
||||
for dep in requires:
|
||||
if dep not in self.repo_package_names:
|
||||
requires.remove(dep)
|
||||
|
||||
requires.reverse()
|
||||
|
||||
return list(dict.fromkeys(requires))
|
||||
|
|
|
@ -242,7 +242,9 @@ class Argparse(Configs):
|
|||
self.flag_search,
|
||||
self.flag_short_search,
|
||||
self.flag_pkg_version,
|
||||
self.flag_short_pkg_version
|
||||
self.flag_short_pkg_version,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -721,7 +723,7 @@ class Argparse(Configs):
|
|||
self.check.exists_in_the_database(packages)
|
||||
|
||||
tracking = Tracking(self.flags)
|
||||
tracking.packages(packages)
|
||||
tracking.packages(packages, self.binary_repo)
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
|
|
@ -3,21 +3,23 @@
|
|||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.views.ascii import Ascii
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.sbos.dependencies import Requires
|
||||
from slpkg.binaries.required import Required
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
class Tracking(Configs, Utilities):
|
||||
class Tracking(Configs):
|
||||
""" Tracking of the package dependencies. """
|
||||
|
||||
def __init__(self, flags: list):
|
||||
super(Configs, self).__init__()
|
||||
super(Utilities, self).__init__()
|
||||
self.flags: list = flags
|
||||
|
||||
self.ascii = Ascii()
|
||||
self.color = self.colour()
|
||||
self.utils = Utilities()
|
||||
|
||||
self.llc: str = self.ascii.lower_left_corner
|
||||
self.hl: str = self.ascii.horizontal_line
|
||||
|
@ -27,8 +29,9 @@ class Tracking(Configs, Utilities):
|
|||
self.yellow: str = self.color['yellow']
|
||||
self.endc: str = self.color['endc']
|
||||
self.flag_pkg_version: list = ['-p', '--pkg-version']
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
def packages(self, packages: list) -> None:
|
||||
def packages(self, packages: list, repo: str) -> None:
|
||||
""" Prints the packages dependencies. """
|
||||
print(f"The list below shows the packages with dependencies:\n")
|
||||
|
||||
|
@ -37,10 +40,19 @@ class Tracking(Configs, Utilities):
|
|||
for package in packages:
|
||||
pkg = f'{self.yellow}{package}{self.endc}'
|
||||
|
||||
if self.is_option(self.flag_pkg_version, self.flags):
|
||||
pkg = f'{self.yellow}{package}-{SBoQueries(package).version()}{self.endc}'
|
||||
if self.utils.is_option(self.flag_pkg_version, self.flags):
|
||||
version: str = SBoQueries(package).version()
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
version: str = BinQueries(package, repo).version()
|
||||
|
||||
pkg = f'{self.yellow}{package}-{version}{self.endc}'
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
requires: list = Required(package, repo).resolve()
|
||||
else:
|
||||
requires: list = Requires(package).resolve()
|
||||
|
||||
requires: list = Requires(package).resolve()
|
||||
how_many: int = len(requires)
|
||||
|
||||
if not requires:
|
||||
|
@ -51,8 +63,13 @@ class Tracking(Configs, Utilities):
|
|||
for i, req in enumerate(requires, start=1):
|
||||
require: str = f'{self.cyan}{req}{self.endc}'
|
||||
|
||||
if self.is_option(self.flag_pkg_version, self.flags):
|
||||
require: str = f'{self.cyan}{req}{self.endc}-{self.yellow}{SBoQueries(req).version()}{self.endc}'
|
||||
if self.utils.is_option(self.flag_pkg_version, self.flags):
|
||||
version: str = SBoQueries(req).version()
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
version: str = BinQueries(req, repo).version()
|
||||
|
||||
require: str = f'{self.cyan}{req}{self.endc}-{self.yellow}{version}{self.endc}'
|
||||
|
||||
if i == 1:
|
||||
print(f' {require}')
|
||||
|
|
Loading…
Reference in a new issue