mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Updated for data
This commit is contained in:
parent
a6b161e4ee
commit
27d9009b44
3 changed files with 12 additions and 20 deletions
|
@ -37,7 +37,7 @@ class Packages(Configs):
|
|||
self.repos = Repositories()
|
||||
self.dialogbox = DialogBox()
|
||||
self.upgrade = Upgrade(self.flags, self.data, self.repo)
|
||||
self.view_message = ViewMessage(self.flags, self.repo)
|
||||
self.view_message = ViewMessage(self.flags, self.data, self.repo)
|
||||
self.session = Session
|
||||
|
||||
self.output: int = 0
|
||||
|
@ -60,7 +60,7 @@ class Packages(Configs):
|
|||
self.flag_no_silent: list = ['-n', '--no-silent']
|
||||
self.flag_resolve_off: list = ['-o', '--resolve-off']
|
||||
|
||||
self.packages: list = self.utils.apply_package_pattern(self.flags, self.packages, self.repo)
|
||||
self.packages: list = self.utils.apply_package_pattern(self.data, self.packages)
|
||||
|
||||
def execute(self) -> None:
|
||||
self.dependencies()
|
||||
|
@ -89,7 +89,7 @@ class Packages(Configs):
|
|||
self.utils.is_package_installed(pkg)):
|
||||
continue
|
||||
|
||||
self.packages_requires += Required(pkg, self.repo).resolve()
|
||||
self.packages_requires += Required(self.data, pkg, self.repo).resolve()
|
||||
|
||||
# Clean dependencies from the dependencies list if already added with main packages.
|
||||
for req in self.packages_requires:
|
||||
|
@ -176,7 +176,7 @@ class Packages(Configs):
|
|||
exist = self.session.query(LogsDependencies.name).filter(
|
||||
LogsDependencies.name == name).first()
|
||||
|
||||
requires: list = Required(name, self.repo).resolve()
|
||||
requires: list = Required(self.data, name, self.repo).resolve()
|
||||
|
||||
# Update the dependencies if exist else create it.
|
||||
if exist:
|
||||
|
|
|
@ -2,19 +2,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
class Required:
|
||||
""" Creates a list of dependencies with
|
||||
the right order to install. """
|
||||
|
||||
def __init__(self, name: str, repo: str):
|
||||
__slots__ = 'name,' 'repo'
|
||||
def __init__(self, data: dict, name: str, repo: str):
|
||||
__slots__ = 'data', 'name,' 'repo'
|
||||
self.data: dict = data
|
||||
self.name: str = name
|
||||
self.repo: str = repo
|
||||
self.repos = Repositories()
|
||||
self.bin_repo_dict: dict = BinQueries(self.repo).repository_data()
|
||||
|
||||
self.special_repos: list = [
|
||||
self.repos.salixos_repo_name,
|
||||
|
@ -25,13 +24,13 @@ class Required:
|
|||
|
||||
def resolve(self) -> list:
|
||||
""" Resolve the dependencies. """
|
||||
required: list[str] = self.bin_repo_dict[self.name][6].split()
|
||||
required: list[str] = self.data[self.name][6].split()
|
||||
|
||||
# Resolve dependencies for some special repos.
|
||||
if self.repo in self.special_repos:
|
||||
requires: list = []
|
||||
for req in required:
|
||||
if req in list(self.bin_repo_dict.keys()):
|
||||
if req in list(self.data.keys()):
|
||||
requires.append(req)
|
||||
return requires
|
||||
|
||||
|
@ -39,12 +38,12 @@ class Required:
|
|||
|
||||
# Remove requirements that are included as dependencies,
|
||||
# but are not included in the repository.
|
||||
if req not in list(self.bin_repo_dict.keys()):
|
||||
if req not in list(self.data.keys()):
|
||||
required.remove(req)
|
||||
|
||||
if req:
|
||||
try:
|
||||
sub_required: list[str] = self.bin_repo_dict[req][6].split()
|
||||
sub_required: list[str] = self.data[req][6].split()
|
||||
except KeyError:
|
||||
sub_required: list[str] = []
|
||||
|
||||
|
@ -53,7 +52,7 @@ class Required:
|
|||
|
||||
# Clean for dependencies not in the repository.
|
||||
for dep in required:
|
||||
if dep not in list(self.bin_repo_dict.keys()):
|
||||
if dep not in list(self.data.keys()):
|
||||
required.remove(dep)
|
||||
|
||||
required.reverse()
|
||||
|
|
|
@ -196,11 +196,4 @@ class Utilities:
|
|||
packages.remove(pkg)
|
||||
packages += data.keys()
|
||||
|
||||
# if self.is_option(self.flag_bin_repository, flags):
|
||||
# bin_repo_dict: dict = BinQueries(repo).repository_data()
|
||||
# packages += list(bin_repo_dict.keys())
|
||||
# else:
|
||||
# sbo_repo_dict: dict = SBoQueries().repository_data()
|
||||
# packages += list(sbo_repo_dict.keys())
|
||||
|
||||
return packages
|
||||
|
|
Loading…
Add table
Reference in a new issue