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