mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-20 10:26:44 +01:00
Updated for repo
This commit is contained in:
parent
c57bb73a67
commit
951d98640c
9 changed files with 40 additions and 43 deletions
|
@ -13,18 +13,12 @@ from slpkg.models.models import session as Session
|
|||
class BinQueries(Configs):
|
||||
""" Queries class for the sbo repository. """
|
||||
|
||||
def __init__(self, name: str, repo='*'):
|
||||
def __init__(self, name: str, repo: str):
|
||||
super(Configs, self).__init__()
|
||||
self.name: str = name
|
||||
self.repo: str = repo
|
||||
self.session = Session
|
||||
self.repos = Repositories()
|
||||
self.bin_repo: list = []
|
||||
|
||||
self.bin_repo: list = self.repos.bin_enabled_repositories
|
||||
|
||||
if self.repo != '*' and self.repo in self.repos.bin_enabled_repositories:
|
||||
self.bin_repo: list = [self.repo]
|
||||
|
||||
self.black = Blacklist()
|
||||
if self.name in self.black.packages():
|
||||
|
@ -34,7 +28,7 @@ class BinQueries(Configs):
|
|||
""" Returns all the names of the binaries packages. """
|
||||
pkgs: tuple = self.session.query(
|
||||
BinariesTable.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).all()
|
||||
BinariesTable.repo == self.repo).all()
|
||||
|
||||
return [pkg[0] for pkg in pkgs]
|
||||
|
||||
|
@ -42,7 +36,7 @@ class BinQueries(Configs):
|
|||
""" Returns all the binaries packages. """
|
||||
pkgs: tuple = self.session.query(
|
||||
BinariesTable.package).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).all()
|
||||
BinariesTable.repo == self.repo).all()
|
||||
|
||||
return [pkg[0] for pkg in pkgs]
|
||||
|
||||
|
@ -50,7 +44,7 @@ class BinQueries(Configs):
|
|||
""" Returns the package name with the repo. """
|
||||
pkgs: tuple = self.session.query(
|
||||
BinariesTable.name, BinariesTable.repo).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).all()
|
||||
BinariesTable.repo == self.repo).all()
|
||||
|
||||
if pkgs:
|
||||
return pkgs
|
||||
|
@ -62,7 +56,7 @@ class BinQueries(Configs):
|
|||
repository: tuple = self.session.query(
|
||||
BinariesTable.repo).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if repository:
|
||||
return repository[0]
|
||||
|
@ -73,7 +67,7 @@ class BinQueries(Configs):
|
|||
pkg: tuple = self.session.query(
|
||||
BinariesTable.name).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if pkg:
|
||||
return pkg[0]
|
||||
|
@ -84,7 +78,7 @@ class BinQueries(Configs):
|
|||
pkg: tuple = self.session.query(
|
||||
BinariesTable.package).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if pkg:
|
||||
return pkg[0]
|
||||
|
@ -95,7 +89,7 @@ class BinQueries(Configs):
|
|||
md5: tuple = self.session.query(
|
||||
BinariesTable.checksum).filter(
|
||||
BinariesTable.package == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if md5:
|
||||
return md5[0]
|
||||
|
@ -106,7 +100,7 @@ class BinQueries(Configs):
|
|||
pkg: tuple = self.session.query(
|
||||
BinariesTable.version).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if pkg:
|
||||
return pkg[0]
|
||||
|
@ -117,7 +111,7 @@ class BinQueries(Configs):
|
|||
mir: tuple = self.session.query(
|
||||
BinariesTable.mirror).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if mir:
|
||||
return mir[0]
|
||||
|
@ -128,7 +122,7 @@ class BinQueries(Configs):
|
|||
loc: tuple = self.session.query(
|
||||
BinariesTable.location).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if loc:
|
||||
return loc[0]
|
||||
|
@ -139,7 +133,7 @@ class BinQueries(Configs):
|
|||
size: tuple = self.session.query(
|
||||
BinariesTable.size_comp).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if size:
|
||||
return size[0]
|
||||
|
@ -150,7 +144,7 @@ class BinQueries(Configs):
|
|||
size: tuple = self.session.query(
|
||||
BinariesTable.unsize_comp).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if size:
|
||||
return size[0]
|
||||
|
@ -161,7 +155,7 @@ class BinQueries(Configs):
|
|||
requires: tuple = self.session.query(
|
||||
BinariesTable.required).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if requires and not requires[0] is None:
|
||||
requires: list = requires[0].split()
|
||||
|
@ -176,7 +170,7 @@ class BinQueries(Configs):
|
|||
con: tuple = self.session.query(
|
||||
BinariesTable.conflicts).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if con:
|
||||
return con[0]
|
||||
|
@ -187,7 +181,7 @@ class BinQueries(Configs):
|
|||
sug: tuple = self.session.query(
|
||||
BinariesTable.suggests).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if sug:
|
||||
return sug[0]
|
||||
|
@ -198,7 +192,7 @@ class BinQueries(Configs):
|
|||
desc: tuple = self.session.query(
|
||||
BinariesTable.description).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).first()
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if desc:
|
||||
return desc[0]
|
||||
|
@ -208,6 +202,6 @@ class BinQueries(Configs):
|
|||
""" Returns all package with the dependencies. """
|
||||
required: list = self.session.query(
|
||||
BinariesTable.name, BinariesTable.required).where(
|
||||
BinariesTable.repo.in_(self.bin_repo)).all()
|
||||
BinariesTable.repo == self.repo).all()
|
||||
|
||||
return required
|
||||
|
|
|
@ -34,7 +34,7 @@ class Check(Configs):
|
|||
if self.repos.ponce_repo:
|
||||
self.repo_table = PonceTable
|
||||
|
||||
def exists_in_the_database(self, packages: list, repo='*') -> None:
|
||||
def exists_in_the_database(self, packages: list, repo=None) -> None:
|
||||
""" Checking if the slackbuild exists in the database. """
|
||||
not_packages: list = []
|
||||
for pkg in packages:
|
||||
|
|
|
@ -30,7 +30,7 @@ class Download(Configs):
|
|||
self.flag_directory: list = ['-z=', '--directory=']
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
def packages(self, packages: list, repo='*') -> None:
|
||||
def packages(self, packages: list, repo=None) -> None:
|
||||
""" Download the package only. """
|
||||
view = ViewMessage(self.flags, repo)
|
||||
view.download_packages(packages, self.directory)
|
||||
|
|
|
@ -287,8 +287,7 @@ class Argparse(Configs):
|
|||
and not self.utils.is_option(self.flag_binaries, self.flags)):
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid options '{', '.join(self.flags)}'")
|
||||
|
||||
if (self.binary_repo and self.binary_repo not in self.repos.binaries_repositories_dict.keys()
|
||||
and self.binary_repo != '*' or self.binary_repo == ''):
|
||||
if self.binary_repo not in self.repos.binaries_repositories_dict.keys():
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.binary_repo}'")
|
||||
|
||||
def invalid_options(self) -> None:
|
||||
|
@ -439,9 +438,14 @@ class Argparse(Configs):
|
|||
for pkg in packages:
|
||||
for package in repo_packages:
|
||||
if pkg in package:
|
||||
repo_ver: str = SBoQueries(package).version()
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
repo_ver: str = BinQueries(package, self.binary_repo).version()
|
||||
repo: str = BinQueries(package, self.binary_repo).repository()
|
||||
else:
|
||||
repo_ver: str = SBoQueries(package).version()
|
||||
repo: str = self.repos.sbo_enabled_repository
|
||||
choices += [(package, repo_ver, False, f'Package: {package}-{repo_ver} '
|
||||
f'> {self.repos.sbo_enabled_repository}')]
|
||||
f'> {repo}')]
|
||||
|
||||
if not choices:
|
||||
return packages
|
||||
|
|
|
@ -140,7 +140,8 @@ class Slackbuilds(Configs):
|
|||
""" Condition to check if slackbuild is for skipped. """
|
||||
return (not self.utils.is_package_installed(sbo) or
|
||||
self.upgrade.is_package_upgradeable(sbo) or
|
||||
self.mode == 'build' or self.utils.is_option(self.flag_reinstall, self.flags))
|
||||
self.mode == 'build' or
|
||||
self.utils.is_option(self.flag_reinstall, self.flags))
|
||||
|
||||
def prepare_slackbuilds_for_build(self) -> None:
|
||||
""" Downloads files and sources. """
|
||||
|
|
|
@ -27,7 +27,7 @@ class SearchPackage(Configs):
|
|||
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
def package(self, packages: list, repo='*') -> None:
|
||||
def package(self, packages: list, repo=None) -> None:
|
||||
""" Searching and print the matched slackbuilds. """
|
||||
matching: int = 0
|
||||
repository: str = ''
|
||||
|
|
|
@ -24,7 +24,7 @@ class UpdateRepository(Configs):
|
|||
def __init__(self, flags: list, repo: str):
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.bin_repo: str = repo
|
||||
self.repo: str = repo
|
||||
self.session = Session
|
||||
self.view = ViewMessage(self.flags)
|
||||
|
||||
|
@ -47,22 +47,22 @@ class UpdateRepository(Configs):
|
|||
|
||||
def update_the_repositories(self) -> None:
|
||||
""" Updated the sbo repository. """
|
||||
if not self.repos_for_update.values() or self.bin_repo not in self.repos_for_update.keys():
|
||||
if not self.repos_for_update.values() or self.repo not in self.repos_for_update.keys():
|
||||
self.view.question()
|
||||
else:
|
||||
print()
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
if self.bin_repo == self.repos.alien_repo_name or self.bin_repo == '*':
|
||||
if self.repo == self.repos.alien_repo_name or self.repo == '*':
|
||||
self.alien_repository()
|
||||
|
||||
if self.bin_repo == self.repos.gnome_repo_name or self.bin_repo == '*':
|
||||
if self.repo == self.repos.gnome_repo_name or self.repo == '*':
|
||||
self.gnome_repository()
|
||||
|
||||
if self.bin_repo == self.repos.conraid_repo_name or self.bin_repo == '*':
|
||||
if self.repo == self.repos.conraid_repo_name or self.repo == '*':
|
||||
self.conraid_repository()
|
||||
|
||||
if self.bin_repo == self.repos.slackonly_repo_name or self.bin_repo == '*':
|
||||
if self.repo == self.repos.slackonly_repo_name or self.repo == '*':
|
||||
self.slackonly_repository()
|
||||
else:
|
||||
self.slackbuild_repositories()
|
||||
|
@ -220,7 +220,7 @@ class UpdateRepository(Configs):
|
|||
os.makedirs(path)
|
||||
|
||||
def check(self, queue) -> None:
|
||||
check_updates = CheckUpdates(self.flags, self.bin_repo)
|
||||
check_updates = CheckUpdates(self.flags, self.repo)
|
||||
compare = check_updates.check()
|
||||
is_update: dict = {}
|
||||
|
||||
|
|
|
@ -7,15 +7,13 @@ from packaging.version import parse
|
|||
from slpkg.configs import Configs
|
||||
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 Upgrade(Configs):
|
||||
""" Upgrade the installed packages. """
|
||||
|
||||
def __init__(self, flags: list, repo='*'):
|
||||
def __init__(self, flags: list, repo=None):
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.repo: str = repo
|
||||
|
|
|
@ -20,7 +20,7 @@ from slpkg.models.models import session as Session
|
|||
class ViewMessage(Configs):
|
||||
""" Print some messages before. """
|
||||
|
||||
def __init__(self, flags: list, repo='*'):
|
||||
def __init__(self, flags: list, repo=None):
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.repo: str = repo
|
||||
|
|
Loading…
Reference in a new issue