mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Renamed the --bin-repo
This commit is contained in:
parent
c71c83960a
commit
60f08b4c35
18 changed files with 199 additions and 223 deletions
|
@ -34,15 +34,18 @@
|
|||
|
||||
[REPOSITORIES]
|
||||
|
||||
DEFAULT_REPOSITORY = "sbo"
|
||||
|
||||
# SBo Repository for Slackware 15.0 stable.
|
||||
SBO_REPO = true
|
||||
SBO_REPO_NAME = "sbo"
|
||||
SBO_REPO_LOCAL = [""]
|
||||
SBO_REPO_MIRROR = ["https://slackbuilds.org/slackbuilds/15.0/"]
|
||||
SBO_REPO_SLACKBUILDS = "SLACKBUILDS.TXT"
|
||||
SBO_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
SBO_REPO_TAR_SUFFIX = ".tar.gz"
|
||||
SBO_REPO_TAG = "_SBo" # Default repo TAG.
|
||||
SBO_REPO_PATCH_TAG = "" # Patch the TAG.
|
||||
SBO_REPO_TAR_SUFFIX = ".tar.gz"
|
||||
|
||||
# Ponce Repository for Slackware -current.
|
||||
PONCE_REPO = false
|
||||
|
|
|
@ -24,8 +24,8 @@ from slpkg.models.models import session as Session
|
|||
|
||||
class Packages(Configs):
|
||||
|
||||
def __init__(self, data: dict, packages: list, flags: list, mode: str):
|
||||
__slots__ = 'data', 'packages', 'flags', 'mode'
|
||||
def __init__(self, repository: str, data: dict, packages: list, flags: list, mode: str):
|
||||
__slots__ = 'repository', 'data', 'packages', 'flags', 'mode'
|
||||
super(Configs, self).__init__()
|
||||
self.data: dict = data
|
||||
self.packages: list = packages
|
||||
|
@ -36,9 +36,9 @@ class Packages(Configs):
|
|||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
self.dialogbox = DialogBox()
|
||||
self.logs_deps = LoggingDeps(flags, data)
|
||||
self.upgrade = Upgrade(flags, data)
|
||||
self.view_message = ViewMessage(flags, data)
|
||||
self.logs_deps = LoggingDeps(repository, data)
|
||||
self.upgrade = Upgrade(repository, data)
|
||||
self.view_message = ViewMessage(flags, repository, data)
|
||||
self.session = Session
|
||||
|
||||
self.stderr = None
|
||||
|
@ -56,7 +56,7 @@ class Packages(Configs):
|
|||
['-k', '--skip-installed'], flags)
|
||||
|
||||
self.option_for_resolve_off: bool = self.utils.is_option(
|
||||
['-o', '--resolve-off'], flags)
|
||||
['-O', '--resolve-off'], flags)
|
||||
|
||||
self.option_for_no_silent: bool = self.utils.is_option(
|
||||
['-n', '--no-silent'], flags)
|
||||
|
|
|
@ -8,7 +8,6 @@ from multiprocessing import Process
|
|||
from urllib3 import PoolManager, ProxyManager, make_headers
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.progress_bar import ProgressBar
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.logging_config import LoggingConfig
|
||||
|
@ -17,43 +16,30 @@ from slpkg.logging_config import LoggingConfig
|
|||
class CheckUpdates(Configs):
|
||||
""" Check for changes in the ChangeLog file. """
|
||||
|
||||
def __init__(self, flags: list, repo: str):
|
||||
__slots__ = 'flags', 'repo'
|
||||
def __init__(self):
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.repo: str = repo
|
||||
|
||||
self.utils = Utilities()
|
||||
self.progress = ProgressBar()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.compare: dict = {}
|
||||
|
||||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], flags)
|
||||
|
||||
logging.basicConfig(filename=LoggingConfig.log_file,
|
||||
filemode=LoggingConfig.filemode,
|
||||
encoding=LoggingConfig.encoding,
|
||||
level=LoggingConfig.level)
|
||||
|
||||
def check(self) -> dict:
|
||||
if self.option_for_binaries:
|
||||
|
||||
for repo in list(self.repos.repositories.keys())[2:]:
|
||||
for repo in list(self.repos.repositories.keys())[2:]:
|
||||
|
||||
if self.repos.repositories[repo][0] and repo == self.repo:
|
||||
self.binary_repository(repo)
|
||||
break
|
||||
if self.repos.repositories[repo][0]:
|
||||
self.binary_repository(repo)
|
||||
|
||||
if self.repos.repositories[repo][0] and self.repo == '*':
|
||||
self.binary_repository(repo)
|
||||
if self.repos.ponce_repo:
|
||||
self.ponce_repository()
|
||||
else:
|
||||
|
||||
if self.repos.ponce_repo:
|
||||
self.ponce_repository()
|
||||
else:
|
||||
self.sbo_repository()
|
||||
self.sbo_repository()
|
||||
|
||||
return self.compare
|
||||
|
||||
|
|
|
@ -15,10 +15,9 @@ from slpkg.models.models import SBoTable, PonceTable, BinariesTable
|
|||
class Check(Configs):
|
||||
""" Some checks before proceed. """
|
||||
|
||||
def __init__(self, flags: list, data: dict):
|
||||
__slots__ = 'flags', 'data'
|
||||
def __init__(self, repository: str, data: dict):
|
||||
__slots__ = 'repository', 'data'
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.data: dict = data
|
||||
|
||||
self.errors = Errors()
|
||||
|
@ -27,10 +26,9 @@ class Check(Configs):
|
|||
|
||||
self.session = Session
|
||||
|
||||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], flags)
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
self.repo_table = BinariesTable
|
||||
else:
|
||||
self.repo_table = SBoTable
|
||||
|
@ -43,7 +41,7 @@ class Check(Configs):
|
|||
|
||||
for pkg in packages:
|
||||
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
if not self.data.get(pkg) and pkg != '*':
|
||||
not_packages.append(pkg)
|
||||
else:
|
||||
|
@ -83,7 +81,7 @@ class Check(Configs):
|
|||
""" Checking for empty table and database file. """
|
||||
db = Path(self.db_path, self.database_name)
|
||||
|
||||
if self.option_for_binaries and repo != '*':
|
||||
if self.is_binary and repo != '*':
|
||||
count: int = self.session.query(self.repo_table.id).where(self.repo_table.repo == repo).count()
|
||||
else:
|
||||
count: int = self.session.query(self.repo_table.id).count()
|
||||
|
|
|
@ -11,7 +11,7 @@ from slpkg.repositories import Repositories
|
|||
class Dependees(Configs):
|
||||
""" Show which packages depend. """
|
||||
|
||||
def __init__(self, data: dict, packages: list, flags: list):
|
||||
def __init__(self, data: dict, packages: list, flags: list, repository: str):
|
||||
__slots__ = 'data', 'packages', 'flags'
|
||||
super(Configs, self).__init__()
|
||||
self.data: dict = data
|
||||
|
@ -26,15 +26,14 @@ class Dependees(Configs):
|
|||
self.hl: str = self.ascii.horizontal_line
|
||||
self.var: str = self.ascii.vertical_and_right
|
||||
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
self.option_for_full_reverse: bool = self.utils.is_option(
|
||||
['-E', '--full-reverse'], flags)
|
||||
|
||||
self.option_for_pkg_version: bool = self.utils.is_option(
|
||||
['-p', '--pkg-version'], flags)
|
||||
|
||||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], flags)
|
||||
|
||||
def find(self) -> None:
|
||||
""" Collecting the dependees. """
|
||||
print(f"The list below shows the "
|
||||
|
@ -48,7 +47,7 @@ class Dependees(Configs):
|
|||
package: str = f'{self.byellow}{pkg}{self.endc}'
|
||||
|
||||
if self.option_for_pkg_version:
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
version: str = self.data[pkg][0]
|
||||
else:
|
||||
version: str = self.data[pkg][2]
|
||||
|
@ -68,7 +67,7 @@ class Dependees(Configs):
|
|||
|
||||
if self.option_for_pkg_version:
|
||||
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
version: str = self.data[name][0]
|
||||
else:
|
||||
version: str = self.data[name][2]
|
||||
|
@ -91,7 +90,7 @@ class Dependees(Configs):
|
|||
|
||||
def find_requires(self, pkg: str) -> Generator:
|
||||
""" Find requires that package dependees. """
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
|
||||
for name, data in self.data.items():
|
||||
if pkg in data[6].split():
|
||||
|
|
|
@ -16,22 +16,21 @@ from slpkg.models.models import session as Session
|
|||
class Download(Configs):
|
||||
""" Download the slackbuilds with the sources only. """
|
||||
|
||||
def __init__(self, directory: Path, flags: list):
|
||||
def __init__(self, directory: Path, flags: list, repository: str):
|
||||
__slots__ = 'directory', 'flags'
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.directory: Path = directory
|
||||
self.flags: list = flags
|
||||
|
||||
self.repos = Repositories()
|
||||
self.utils = Utilities()
|
||||
self.session = Session
|
||||
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
self.option_for_directory: bool = self.utils.is_option(
|
||||
['-z', '--directory='], flags)
|
||||
|
||||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], flags)
|
||||
|
||||
def packages(self, data: dict, packages: list) -> None:
|
||||
""" Download the package only. """
|
||||
packages: list = self.utils.apply_package_pattern(data, packages)
|
||||
|
@ -48,7 +47,7 @@ class Download(Configs):
|
|||
urls: list = []
|
||||
for pkg in packages:
|
||||
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
package: str = data[pkg][1]
|
||||
mirror: str = data[pkg][2]
|
||||
location: str = data[pkg][3]
|
||||
|
|
|
@ -11,22 +11,20 @@ from slpkg.models.models import session as Session
|
|||
class LoggingDeps:
|
||||
""" Logging installed dependencies. """
|
||||
|
||||
def __init__(self, flags: list, data: dict):
|
||||
__slots__ = 'flags', 'data'
|
||||
self.flags: list = flags
|
||||
def __init__(self, repository: str, data: dict):
|
||||
__slots__ = 'repository', 'data'
|
||||
self.data: dict = data
|
||||
|
||||
self.utils = Utilities()
|
||||
self.session = Session
|
||||
|
||||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], flags)
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
def logging(self, name: str) -> None:
|
||||
exist = self.session.query(LogsDependencies.name).filter(
|
||||
LogsDependencies.name == name).first()
|
||||
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
requires: list = Required(self.data, name).resolve()
|
||||
else:
|
||||
requires: list = Requires(self.data, name).resolve()
|
||||
|
|
153
slpkg/main.py
153
slpkg/main.py
|
@ -41,8 +41,7 @@ class Argparse(Configs):
|
|||
super(Configs).__init__()
|
||||
self.args: list = args
|
||||
self.flags: list = []
|
||||
self.binary_repo: str = ''
|
||||
self.directory = self.tmp_slpkg
|
||||
self.directory: Path = self.tmp_slpkg
|
||||
|
||||
self.dialogbox = DialogBox()
|
||||
self.utils = Utilities()
|
||||
|
@ -50,7 +49,7 @@ class Argparse(Configs):
|
|||
self.form_configs = FormConfigs()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.binary_repo: str = ''
|
||||
self.repository: str = self.repos.default_repository
|
||||
|
||||
if len(args) == 0 or '' in args:
|
||||
self.usage.help_short(1)
|
||||
|
@ -61,7 +60,7 @@ class Argparse(Configs):
|
|||
self.flag_jobs: str = '--jobs'
|
||||
self.flag_short_jobs: str = '-j'
|
||||
self.flag_resolve_off: str = '--resolve-off'
|
||||
self.flag_short_resolve_off: str = '-o'
|
||||
self.flag_short_resolve_off: str = '-O'
|
||||
self.flag_reinstall: str = '--reinstall'
|
||||
self.flag_short_reinstall: str = '-r'
|
||||
self.flag_skip_installed: str = '--skip-installed'
|
||||
|
@ -78,13 +77,13 @@ class Argparse(Configs):
|
|||
self.flag_short_pkg_version: str = '-p'
|
||||
self.flag_parallel: str = '--parallel'
|
||||
self.flag_short_parallel: str = '-P'
|
||||
self.flag_bin_repository: str = '--bin-repo='
|
||||
self.flag_short_bin_repository: str = '-B'
|
||||
self.flag_repository: str = '--repository='
|
||||
self.flag_short_repository: str = '-o'
|
||||
self.flag_directory: str = '--directory='
|
||||
self.flag_short_directory: str = '-z'
|
||||
|
||||
self.flag_searches: list = [self.flag_short_search, self.flag_search]
|
||||
self.flag_binaries: list = [self.flag_short_bin_repository, self.flag_bin_repository]
|
||||
# self.flag_binaries: list = [self.flag_short_repository, self.flag_repository]
|
||||
|
||||
self.options: list = [
|
||||
self.flag_yes,
|
||||
|
@ -109,8 +108,8 @@ class Argparse(Configs):
|
|||
self.flag_short_pkg_version,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_repository,
|
||||
self.flag_short_repository,
|
||||
self.flag_directory,
|
||||
self.flag_short_directory,
|
||||
]
|
||||
|
@ -124,8 +123,8 @@ class Argparse(Configs):
|
|||
self.flag_short_yes,
|
||||
self.flag_install_data,
|
||||
self.flag_short_install_data,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_repository,
|
||||
self.flag_short_repository,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel
|
||||
],
|
||||
|
@ -140,14 +139,14 @@ class Argparse(Configs):
|
|||
self.flag_short_reinstall,
|
||||
self.flag_no_silent,
|
||||
self.flag_short_no_silent,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_repository,
|
||||
self.flag_short_repository,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel
|
||||
],
|
||||
'check-updates': [
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository
|
||||
self.flag_repository,
|
||||
self.flag_short_repository
|
||||
],
|
||||
'repo-info': [],
|
||||
'configs': [],
|
||||
|
@ -189,8 +188,8 @@ class Argparse(Configs):
|
|||
self.flag_short_search,
|
||||
self.flag_no_silent,
|
||||
self.flag_short_no_silent,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_repository,
|
||||
self.flag_short_repository,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel
|
||||
],
|
||||
|
@ -201,8 +200,8 @@ class Argparse(Configs):
|
|||
self.flag_short_search,
|
||||
self.flag_directory,
|
||||
self.flag_short_directory,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_repository,
|
||||
self.flag_short_repository,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel
|
||||
],
|
||||
|
@ -223,24 +222,24 @@ class Argparse(Configs):
|
|||
'view': [
|
||||
self.flag_search,
|
||||
self.flag_short_search,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_repository,
|
||||
self.flag_short_repository,
|
||||
self.flag_pkg_version,
|
||||
self.flag_short_pkg_version
|
||||
],
|
||||
'search': [
|
||||
self.flag_search,
|
||||
self.flag_short_search,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository
|
||||
self.flag_repository,
|
||||
self.flag_short_repository
|
||||
],
|
||||
'dependees': [
|
||||
self.flag_full_reverse,
|
||||
self.flag_short_full_reverse,
|
||||
self.flag_search,
|
||||
self.flag_short_search,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_repository,
|
||||
self.flag_short_repository,
|
||||
self.flag_pkg_version,
|
||||
self.flag_short_pkg_version
|
||||
],
|
||||
|
@ -249,8 +248,8 @@ class Argparse(Configs):
|
|||
self.flag_short_search,
|
||||
self.flag_pkg_version,
|
||||
self.flag_short_pkg_version,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository
|
||||
self.flag_repository,
|
||||
self.flag_short_repository
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -280,12 +279,12 @@ class Argparse(Configs):
|
|||
self.invalid_options()
|
||||
self.check_for_bin_repositories()
|
||||
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
self.data: dict = BinQueries(self.binary_repo).repository_data()
|
||||
if self.utils.is_binary_repo(self.repository): # is_option(self.flag_binaries, self.flags):
|
||||
self.data: dict = BinQueries(self.repository).repository_data()
|
||||
else:
|
||||
self.data: dict = SBoQueries().repository_data()
|
||||
|
||||
self.check = Check(self.flags, self.data)
|
||||
self.check = Check(self.repository, self.data)
|
||||
|
||||
logging.basicConfig(filename=LoggingConfig.log_file,
|
||||
filemode=LoggingConfig.filemode,
|
||||
|
@ -295,11 +294,11 @@ class Argparse(Configs):
|
|||
logger = logging.getLogger(LoggingConfig.date)
|
||||
logger.info(f'{self.__class__.__name__}: '
|
||||
f'{self.__class__.__init__.__name__}: '
|
||||
f'{args=}, {self.flags=}, {self.binary_repo=}')
|
||||
f'{args=}, {self.flags=}, {self.repository=}')
|
||||
|
||||
def check_for_bin_repositories(self) -> None:
|
||||
""" Checks combination for binaries use repositories only and if repository exists. """
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
if self.utils.is_binary_repo(self.repository): # is_option(self.flag_binaries, self.flags):
|
||||
|
||||
except_options: list = [
|
||||
'-s', 'search',
|
||||
|
@ -307,15 +306,15 @@ class Argparse(Configs):
|
|||
'-c', 'check-updates',
|
||||
]
|
||||
|
||||
if (self.binary_repo in list(self.repos.repositories.keys())[2:]
|
||||
and not self.repos.repositories[self.binary_repo][0]):
|
||||
self.usage.help_minimal(f"{self.prog_name}: repository '{self.binary_repo}' is disabled")
|
||||
if (self.repository in list(self.repos.repositories.keys())[2:]
|
||||
and not self.repos.repositories[self.repository][0]):
|
||||
self.usage.help_minimal(f"{self.prog_name}: repository '{self.repository}' is disabled")
|
||||
|
||||
elif self.binary_repo == '*' and not self.utils.is_option(except_options, self.args):
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.binary_repo}'")
|
||||
elif self.repository == '*' and not self.utils.is_option(except_options, self.args):
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.repository}'")
|
||||
|
||||
elif self.binary_repo not in list(self.repos.repositories.keys())[2:] and self.binary_repo != '*':
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.binary_repo}'")
|
||||
elif self.repository not in list(self.repos.repositories.keys())[2:] and self.repository != '*':
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.repository}'")
|
||||
|
||||
def invalid_options(self) -> None:
|
||||
""" Checks for invalid options. """
|
||||
|
@ -398,23 +397,23 @@ class Argparse(Configs):
|
|||
else:
|
||||
self.args.remove(self.directory)
|
||||
|
||||
if arg.startswith(self.flag_bin_repository):
|
||||
self.binary_repo: str = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_bin_repository
|
||||
if arg.startswith(self.flag_repository):
|
||||
self.repository: str = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_repository
|
||||
|
||||
if arg.startswith(self.flag_short_bin_repository) and len(self.args) > 2:
|
||||
if arg.startswith(self.flag_short_repository) and len(self.args) > 2:
|
||||
try:
|
||||
self.binary_repo: str = self.args[self.args.index(arg) + 1]
|
||||
self.repository: str = self.args[self.args.index(arg) + 1]
|
||||
except IndexError:
|
||||
logger = logging.getLogger(LoggingConfig.date)
|
||||
logger.exception(f'{self.__class__.__name__}: '
|
||||
f'{self.__class__.split_options_from_args.__name__}')
|
||||
self.binary_repo = ''
|
||||
self.repository = ''
|
||||
else:
|
||||
self.args.remove(self.binary_repo)
|
||||
self.args.remove(self.repository)
|
||||
|
||||
if self.binary_repo in self.options:
|
||||
self.binary_repo: str = ''
|
||||
if self.repository in self.options:
|
||||
self.repository: str = ''
|
||||
|
||||
def move_options(self) -> None:
|
||||
""" Move options to the flags and removes from the arguments. """
|
||||
|
@ -468,7 +467,7 @@ class Argparse(Configs):
|
|||
inst_pkg: str = self.utils.is_package_installed(package)
|
||||
split_inst_pkg: list = self.utils.split_binary_pkg(inst_pkg)
|
||||
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
if self.utils.is_binary_repo(self.repository): # is_option(self.flag_binaries, self.flags):
|
||||
repo_ver: str = self.data[package][0]
|
||||
bin_pkg: str = self.data[package][1]
|
||||
repo_build_tag: str = self.utils.split_binary_pkg(bin_pkg[:-4])[3]
|
||||
|
@ -485,9 +484,9 @@ class Argparse(Configs):
|
|||
for package in repo_packages:
|
||||
|
||||
if pkg in package or pkg == '*':
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
if self.utils.is_binary_repo(self.repository):
|
||||
repo_ver: str = self.data[package][0]
|
||||
repo: str = self.binary_repo
|
||||
repo: str = self.repository
|
||||
else:
|
||||
repo_ver: str = self.data[package][2]
|
||||
repo: str = self.repos.sbo_enabled_repo_name
|
||||
|
@ -526,7 +525,7 @@ class Argparse(Configs):
|
|||
|
||||
def update(self) -> None:
|
||||
if len(self.args) == 1:
|
||||
update = UpdateRepository(self.flags, self.binary_repo)
|
||||
update = UpdateRepository(self.flags, self.repository)
|
||||
update.repositories()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
@ -535,9 +534,9 @@ class Argparse(Configs):
|
|||
command = Argparse.upgrade.__name__
|
||||
|
||||
if len(self.args) == 1:
|
||||
self.check.is_empty_database(self.binary_repo)
|
||||
self.check.is_empty_database(self.repository)
|
||||
|
||||
upgrade = Upgrade(self.flags, self.data)
|
||||
upgrade = Upgrade(self.repository, self.data)
|
||||
packages: list = list(upgrade.packages())
|
||||
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
@ -546,18 +545,18 @@ class Argparse(Configs):
|
|||
print('\nEverything is up-to-date!\n')
|
||||
raise SystemExit()
|
||||
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
install = Packages(self.data, packages, self.flags, mode=command)
|
||||
if self.utils.is_binary_repo(self.repository):
|
||||
install = Packages(self.repository, self.data, packages, self.flags, mode=command)
|
||||
install.execute()
|
||||
else:
|
||||
install = Slackbuilds(self.data, packages, self.flags, mode=command)
|
||||
install = Slackbuilds(self.repository, self.data, packages, self.flags, mode=command)
|
||||
install.execute()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
def check_updates(self) -> None:
|
||||
if len(self.args) == 1:
|
||||
check = CheckUpdates(self.flags, self.binary_repo)
|
||||
check = CheckUpdates()
|
||||
check.updates()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
@ -601,7 +600,7 @@ class Argparse(Configs):
|
|||
|
||||
if len(self.args) >= 2:
|
||||
|
||||
self.check.is_empty_database(self.binary_repo)
|
||||
self.check.is_empty_database(self.repository)
|
||||
packages: list = self.is_file_list_packages()
|
||||
|
||||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
|
@ -610,7 +609,7 @@ class Argparse(Configs):
|
|||
self.check.exists_in_the_database(packages)
|
||||
self.check.is_package_unsupported(packages)
|
||||
|
||||
build = Slackbuilds(self.data, packages, self.flags, mode=command)
|
||||
build = Slackbuilds(self.repository, self.data, packages, self.flags, mode=command)
|
||||
build.execute()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
@ -620,22 +619,22 @@ class Argparse(Configs):
|
|||
|
||||
if len(self.args) >= 2:
|
||||
|
||||
self.check.is_empty_database(self.binary_repo)
|
||||
self.check.is_empty_database(self.repository)
|
||||
packages: list = self.is_file_list_packages()
|
||||
|
||||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
if self.utils.is_binary_repo(self.repository):
|
||||
self.check.exists_in_the_database(packages)
|
||||
|
||||
install = Packages(self.data, packages, self.flags, mode=command)
|
||||
install = Packages(self.repository, self.data, packages, self.flags, mode=command)
|
||||
install.execute()
|
||||
else:
|
||||
self.check.exists_in_the_database(packages)
|
||||
self.check.is_package_unsupported(packages)
|
||||
|
||||
install = Slackbuilds(self.data, packages, self.flags, mode=command)
|
||||
install = Slackbuilds(self.repository, self.data, packages, self.flags, mode=command)
|
||||
install.execute()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
@ -645,14 +644,14 @@ class Argparse(Configs):
|
|||
|
||||
if len(self.args) >= 2:
|
||||
|
||||
self.check.is_empty_database(self.binary_repo)
|
||||
self.check.is_empty_database(self.repository)
|
||||
packages: list = self.is_file_list_packages()
|
||||
|
||||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.exists_in_the_database(packages)
|
||||
download = Download(self.directory, self.flags)
|
||||
download = Download(self.directory, self.flags, self.repository)
|
||||
download.packages(self.data, packages)
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
@ -679,7 +678,7 @@ class Argparse(Configs):
|
|||
|
||||
if len(self.args) >= 2:
|
||||
|
||||
self.check.is_empty_database(self.binary_repo)
|
||||
self.check.is_empty_database(self.repository)
|
||||
packages: list = self.is_file_list_packages()
|
||||
|
||||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
|
@ -695,7 +694,7 @@ class Argparse(Configs):
|
|||
|
||||
if len(self.args) >= 2:
|
||||
|
||||
self.check.is_empty_database(self.binary_repo)
|
||||
self.check.is_empty_database(self.repository)
|
||||
packages: list = self.is_file_list_packages()
|
||||
|
||||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
|
@ -705,8 +704,8 @@ class Argparse(Configs):
|
|||
|
||||
view = ViewPackage(self.flags)
|
||||
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
view.package(self.data, packages, self.binary_repo)
|
||||
if self.utils.is_binary_repo(self.repository):
|
||||
view.package(self.data, packages, self.repository)
|
||||
else:
|
||||
view.slackbuild(self.data, packages)
|
||||
raise SystemExit()
|
||||
|
@ -717,14 +716,14 @@ class Argparse(Configs):
|
|||
|
||||
if len(self.args) >= 2:
|
||||
|
||||
self.check.is_empty_database(self.binary_repo)
|
||||
self.check.is_empty_database(self.repository)
|
||||
packages: list = self.is_file_list_packages()
|
||||
|
||||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
search = SearchPackage(self.flags)
|
||||
search.package(self.data, packages, self.binary_repo)
|
||||
search = SearchPackage(self.repository)
|
||||
search.package(self.data, packages, self.repository)
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
@ -733,7 +732,7 @@ class Argparse(Configs):
|
|||
|
||||
if len(self.args) >= 2:
|
||||
|
||||
self.check.is_empty_database(self.binary_repo)
|
||||
self.check.is_empty_database(self.repository)
|
||||
packages: list = self.is_file_list_packages()
|
||||
|
||||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
|
@ -741,7 +740,7 @@ class Argparse(Configs):
|
|||
|
||||
self.check.exists_in_the_database(packages)
|
||||
|
||||
dependees = Dependees(self.data, packages, self.flags)
|
||||
dependees = Dependees(self.data, packages, self.flags, self.repository)
|
||||
dependees.find()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
@ -751,7 +750,7 @@ class Argparse(Configs):
|
|||
|
||||
if len(self.args) >= 2:
|
||||
|
||||
self.check.is_empty_database(self.binary_repo)
|
||||
self.check.is_empty_database(self.repository)
|
||||
packages: list = self.is_file_list_packages()
|
||||
|
||||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
|
@ -759,7 +758,7 @@ class Argparse(Configs):
|
|||
|
||||
self.check.exists_in_the_database(packages)
|
||||
|
||||
tracking = Tracking(self.flags)
|
||||
tracking = Tracking(self.flags, self.repository)
|
||||
tracking.packages(self.data, packages)
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
|
|
@ -34,7 +34,7 @@ class RemovePackages(Configs):
|
|||
self.stdout = None
|
||||
|
||||
self.option_resolve_off: bool = self.utils.is_option(
|
||||
['-o', '--resolve-off'], flags)
|
||||
['-O', '--resolve-off'], flags)
|
||||
|
||||
self.option_for_no_silent: bool = self.utils.is_option(
|
||||
['-n', '--no-silent'], flags)
|
||||
|
|
|
@ -21,6 +21,8 @@ class Repositories:
|
|||
repos_config = {}
|
||||
repositories = {}
|
||||
|
||||
default_repository: str = 'sbo'
|
||||
|
||||
sbo_repo: bool = True
|
||||
sbo_repo_name: str = 'sbo'
|
||||
sbo_repo_path: Path = Path(repositories_path, sbo_repo_name)
|
||||
|
@ -28,9 +30,9 @@ class Repositories:
|
|||
sbo_repo_mirror = ['https://slackbuilds.org/slackbuilds/15.0/']
|
||||
sbo_repo_slackbuilds: str = 'SLACKBUILDS.TXT'
|
||||
sbo_repo_changelog: str = 'ChangeLog.txt'
|
||||
sbo_repo_tar_suffix: str = '.tar.gz'
|
||||
sbo_repo_tag: str = '_SBo'
|
||||
sbo_repo_patch_tag: str = ''
|
||||
sbo_repo_tar_suffix: str = '.tar.gz'
|
||||
|
||||
ponce_repo: bool = False
|
||||
ponce_repo_name: str = 'ponce'
|
||||
|
@ -207,14 +209,16 @@ class Repositories:
|
|||
with open(repositories_toml_file, 'rb') as repo:
|
||||
repos_config = tomli.load(repo)['REPOSITORIES']
|
||||
|
||||
default_repository: str = repos_config['DEFAULT_REPOSITORY']
|
||||
|
||||
sbo_repo_name: str = repos_config['SBO_REPO_NAME']
|
||||
sbo_repo_local = repos_config['SBO_REPO_LOCAL']
|
||||
sbo_repo_mirror = repos_config['SBO_REPO_MIRROR']
|
||||
sbo_repo_slackbuilds: str = repos_config['SBO_REPO_SLACKBUILDS']
|
||||
sbo_repo_changelog: str = repos_config['SBO_REPO_CHANGELOG']
|
||||
sbo_repo_tar_suffix: str = repos_config['SBO_REPO_TAR_SUFFIX']
|
||||
sbo_repo_tag: str = repos_config['SBO_REPO_TAG']
|
||||
sbo_repo_patch_tag: str = repos_config['SBO_REPO_PATCH_TAG']
|
||||
sbo_repo_tar_suffix: str = repos_config['SBO_REPO_TAR_SUFFIX']
|
||||
try:
|
||||
if sbo_repo_local[0].startswith('file'):
|
||||
sbo_repo_path: Path = Path(
|
||||
|
@ -515,7 +519,6 @@ class Repositories:
|
|||
sbo_repo_mirror,
|
||||
sbo_repo_slackbuilds,
|
||||
sbo_repo_changelog,
|
||||
sbo_repo_tar_suffix,
|
||||
sbo_repo_tag,
|
||||
sbo_repo_patch_tag],
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ from slpkg.models.models import session as Session
|
|||
class Slackbuilds(Configs):
|
||||
""" Download build and install the SlackBuilds. """
|
||||
|
||||
def __init__(self, data: dict, slackbuilds: list, flags: list, mode: str):
|
||||
__slots__ = 'data', 'slackbuilds', 'flags', 'mode'
|
||||
def __init__(self, repository: str, data: dict, slackbuilds: list, flags: list, mode: str):
|
||||
__slots__ = 'repository', 'data', 'slackbuilds', 'flags', 'mode'
|
||||
super(Configs, self).__init__()
|
||||
self.data = data
|
||||
self.slackbuilds: list = slackbuilds
|
||||
|
@ -44,9 +44,9 @@ class Slackbuilds(Configs):
|
|||
self.utils = Utilities()
|
||||
self.progress = ProgressBar()
|
||||
self.dialogbox = DialogBox()
|
||||
self.logs_deps = LoggingDeps(flags, data)
|
||||
self.upgrade = Upgrade(flags, data)
|
||||
self.view_message = ViewMessage(flags, data)
|
||||
self.logs_deps = LoggingDeps(repository, data)
|
||||
self.upgrade = Upgrade(repository, data)
|
||||
self.view_message = ViewMessage(flags, repository, data)
|
||||
|
||||
self.stderr = None
|
||||
self.stdout = None
|
||||
|
@ -62,7 +62,7 @@ class Slackbuilds(Configs):
|
|||
['-k', '--skip-installed'], flags)
|
||||
|
||||
self.option_for_resolve_off: bool = self.utils.is_option(
|
||||
['-o', '--resolve-off'], flags)
|
||||
['-O', '--resolve-off'], flags)
|
||||
|
||||
self.option_for_jobs: bool = self.utils.is_option(
|
||||
['-j', '--jobs'], flags)
|
||||
|
|
|
@ -10,16 +10,14 @@ from slpkg.binaries.queries import BinQueries
|
|||
class SearchPackage(Configs):
|
||||
""" Search packages from the repositories. """
|
||||
|
||||
def __init__(self, flags=None):
|
||||
__slots__ = 'flags'
|
||||
def __init__(self, repository: str):
|
||||
__slots__ = 'repository'
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
|
||||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], flags)
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
def package(self, data: dict, packages: list, repo: str) -> None:
|
||||
""" Searching and print the matched packages. """
|
||||
|
@ -29,7 +27,7 @@ class SearchPackage(Configs):
|
|||
matching: int = 0
|
||||
|
||||
# Searching for binaries.
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
|
||||
if repo == '*':
|
||||
data: dict = BinQueries('').repositories_data()
|
||||
|
|
|
@ -9,8 +9,8 @@ from slpkg.utilities import Utilities
|
|||
class Tracking(Configs):
|
||||
""" Tracking of the package dependencies. """
|
||||
|
||||
def __init__(self, flags: list):
|
||||
__slots__ = 'flags'
|
||||
def __init__(self, flags: list, repository: str):
|
||||
__slots__ = 'flags', 'repository'
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
|
||||
|
@ -21,12 +21,11 @@ class Tracking(Configs):
|
|||
self.hl: str = self.ascii.horizontal_line
|
||||
self.vl: str = self.ascii.vertical_line
|
||||
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
self.option_for_pkg_version: bool = self.utils.is_option(
|
||||
['-p', '--pkg-version'], flags)
|
||||
|
||||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], flags)
|
||||
|
||||
def packages(self, data: dict, packages: list) -> None:
|
||||
""" Prints the packages dependencies. """
|
||||
print(f"The list below shows the packages '{', '.join([p for p in packages])}' with dependencies:\n")
|
||||
|
@ -42,14 +41,14 @@ class Tracking(Configs):
|
|||
|
||||
if self.option_for_pkg_version:
|
||||
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
version: str = data[package][0]
|
||||
else:
|
||||
version: str = data[package][2]
|
||||
|
||||
pkg = f'{self.yellow}{package} {version}{self.endc}'
|
||||
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
requires: list = data[package][6].split()
|
||||
else:
|
||||
requires: list = data[package][7].split()
|
||||
|
@ -68,7 +67,7 @@ class Tracking(Configs):
|
|||
|
||||
if self.option_for_pkg_version:
|
||||
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
version: str = ' (not included)'
|
||||
if data.get(req):
|
||||
version: str = f' {self.yellow}{data[req][0]}{self.endc}'
|
||||
|
|
|
@ -33,7 +33,7 @@ class UpdateRepository(Configs):
|
|||
self.utils = Utilities()
|
||||
self.data = InstallData()
|
||||
|
||||
self.check_updates = CheckUpdates(flags, repo)
|
||||
self.check_updates = CheckUpdates()
|
||||
|
||||
self.repos_for_update: dict = {}
|
||||
|
||||
|
@ -47,12 +47,14 @@ class UpdateRepository(Configs):
|
|||
['-B', '--bin-repo='], flags)
|
||||
|
||||
def update_the_repositories(self) -> None:
|
||||
if not any(list(self.repos_for_update.values())) or self.repo == '*':
|
||||
if not any(list(self.repos_for_update.values())):
|
||||
self.view.question()
|
||||
else:
|
||||
print()
|
||||
|
||||
bin_repositories: dict = {
|
||||
repositories: dict = {
|
||||
self.repos.sbo_repo_name: self.sbo_repository,
|
||||
self.repos.ponce_repo_name: self.ponce_repository,
|
||||
self.repos.slack_repo_name: self.slack_repository,
|
||||
self.repos.slack_extra_repo_name: self.slack_extra_repository,
|
||||
self.repos.slack_patches_repo_name: self.slack_patches_repository,
|
||||
|
@ -71,19 +73,9 @@ class UpdateRepository(Configs):
|
|||
self.repos.slint_repo_name: self.slint_repository
|
||||
}
|
||||
|
||||
if self.option_for_binaries:
|
||||
|
||||
for repo in bin_repositories.keys():
|
||||
if self.repos.repositories[repo][0]:
|
||||
|
||||
if repo == self.repo:
|
||||
bin_repositories[repo]()
|
||||
break
|
||||
|
||||
if self.repo == '*':
|
||||
bin_repositories[repo]()
|
||||
else:
|
||||
self.slackbuild_repositories()
|
||||
for repo, value in self.repos_for_update.items():
|
||||
if value:
|
||||
repositories[repo]()
|
||||
print()
|
||||
|
||||
def slack_repository(self):
|
||||
|
@ -618,48 +610,48 @@ class UpdateRepository(Configs):
|
|||
self.data.install_slint_data()
|
||||
print()
|
||||
|
||||
def slackbuild_repositories(self) -> None:
|
||||
def ponce_repository(self) -> None:
|
||||
""" Update the slackbuild repositories. """
|
||||
if self.repos.ponce_repo:
|
||||
if not self.option_for_install_data:
|
||||
print(f"Downloading the '{self.green}{self.repos.ponce_repo_name}{self.endc}' repository "
|
||||
f"in the '{self.repos.ponce_repo_path}' folder, please wait...\n")
|
||||
if not self.option_for_install_data:
|
||||
print(f"Downloading the '{self.green}{self.repos.ponce_repo_name}{self.endc}' repository "
|
||||
f"in the '{self.repos.ponce_repo_path}' folder, please wait...\n")
|
||||
|
||||
self.utils.create_directory(self.repos.ponce_repo_path)
|
||||
self.utils.remove_file_if_exists(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
|
||||
self.utils.create_directory(self.repos.ponce_repo_path)
|
||||
self.utils.remove_file_if_exists(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
|
||||
|
||||
lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.ponce_repo_mirror[0]} '
|
||||
f'{self.repos.ponce_repo_path}')
|
||||
lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.ponce_repo_mirror[0]} '
|
||||
f'{self.repos.ponce_repo_path}')
|
||||
|
||||
self.utils.process(lftp_command)
|
||||
self.utils.process(lftp_command)
|
||||
|
||||
# It checks if there is the SLACKBUILDS.TXT file, otherwise going to create it.
|
||||
if not Path(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds).is_file():
|
||||
self.generate_sbo(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
|
||||
# It checks if there is the SLACKBUILDS.TXT file, otherwise going to create it.
|
||||
if not Path(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds).is_file():
|
||||
self.generate_sbo(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
|
||||
|
||||
self.delete_last_updated(self.repos.ponce_repo_name)
|
||||
self.delete_last_updated(self.repos.ponce_repo_name)
|
||||
self.delete_sbo_database_data()
|
||||
self.data.install_sbos_data()
|
||||
|
||||
else:
|
||||
if not self.option_for_install_data:
|
||||
print(f"Downloading the '{self.green}{self.repos.sbo_repo_name}{self.endc}' repository "
|
||||
f"in the '{self.repos.sbo_repo_path}' folder, please wait...\n")
|
||||
def sbo_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
print(f"Downloading the '{self.green}{self.repos.sbo_repo_name}{self.endc}' repository "
|
||||
f"in the '{self.repos.sbo_repo_path}' folder, please wait...\n")
|
||||
|
||||
self.utils.create_directory(self.repos.sbo_repo_path)
|
||||
self.utils.create_directory(self.repos.sbo_repo_path)
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds)
|
||||
self.utils.remove_file_if_exists(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds)
|
||||
self.utils.remove_file_if_exists(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog)
|
||||
|
||||
lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.sbo_repo_mirror[0]} '
|
||||
f'{self.repos.sbo_repo_path}')
|
||||
lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.sbo_repo_mirror[0]} '
|
||||
f'{self.repos.sbo_repo_path}')
|
||||
|
||||
self.utils.process(lftp_command)
|
||||
self.utils.process(lftp_command)
|
||||
|
||||
# It checks if there is the SLACKBUILDS.TXT file, otherwise going to create it.
|
||||
if not Path(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds).is_file():
|
||||
self.generate_sbo(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds)
|
||||
|
||||
self.delete_last_updated(self.repos.sbo_repo_name)
|
||||
# It checks if there is the SLACKBUILDS.TXT file, otherwise going to create it.
|
||||
if not Path(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds).is_file():
|
||||
self.generate_sbo(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds)
|
||||
|
||||
self.delete_last_updated(self.repos.sbo_repo_name)
|
||||
self.delete_sbo_database_data()
|
||||
self.data.install_sbos_data()
|
||||
|
||||
|
|
|
@ -14,17 +14,15 @@ from slpkg.logging_config import LoggingConfig
|
|||
class Upgrade(Configs):
|
||||
""" Upgrade the installed packages. """
|
||||
|
||||
def __init__(self, flags: list, data: dict):
|
||||
__slots__ = 'flags', 'data'
|
||||
def __init__(self, repository: str, data: dict):
|
||||
__slots__ = 'repository', 'data'
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.data: dict = data
|
||||
|
||||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], flags)
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
logging.basicConfig(filename=LoggingConfig.log_file,
|
||||
filemode=LoggingConfig.filemode,
|
||||
|
@ -48,14 +46,14 @@ class Upgrade(Configs):
|
|||
inst_package: str = self.utils.is_package_installed(name)
|
||||
|
||||
repo_tag: str = self.repos.repo_tag
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
repo_tag: str = self.repos.repositories[self.data[name][11]][6]
|
||||
|
||||
if inst_package and inst_package.endswith(repo_tag):
|
||||
inst_version: str = self.utils.split_binary_pkg(inst_package)[1]
|
||||
inst_build: str = self.utils.split_binary_pkg(inst_package)[3]
|
||||
|
||||
if self.option_for_binaries and self.data.get(name):
|
||||
if self.is_binary and self.data.get(name):
|
||||
repo_version: str = self.data[name][0]
|
||||
repo_package: str = self.data[name][1]
|
||||
repo_build: str = self.utils.split_binary_pkg(repo_package)[3]
|
||||
|
|
|
@ -104,7 +104,6 @@ class Utilities(Configs):
|
|||
for f in flag:
|
||||
if f in flags:
|
||||
return True
|
||||
return False
|
||||
|
||||
def read_packages_from_file(self, file: Path) -> Generator:
|
||||
""" Reads packages from file and split these to list. """
|
||||
|
@ -190,3 +189,8 @@ class Utilities(Configs):
|
|||
repo: str = self.repos.sbo_enabled_repo_name
|
||||
|
||||
return repo
|
||||
|
||||
def is_binary_repo(self, repo: str) -> bool:
|
||||
""" Checks if the repository is binary. """
|
||||
if repo in list(self.repos.repositories.keys())[2:]:
|
||||
return True
|
||||
|
|
|
@ -32,11 +32,11 @@ class Usage(Configs):
|
|||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-b, build, -i, install, -R, remove [packages...]]\n'
|
||||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-d, download, -f, find, -w, view [packages...]]\n'
|
||||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-s, search, -e, dependees, -t, tracking [packages...]]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-y, --yes, -j, --jobs, -o, --resolve-off, -r, --reinstall]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-y, --yes, -j, --jobs, -O, --resolve-off, -r, --reinstall]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-k, --skip-installed, -a, --install-data]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-E, --full-reverse, -S, --search, -n, --no-silent]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-p, --pkg-version, -P, --parallel]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-B, --bin-repo=[REPO]-z, --directory=[PATH]]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-o, --repository=[REPO]-z, --directory=[PATH]]\n'
|
||||
" \nIf you need more information please try 'slpkg --help'.")
|
||||
|
||||
print(args)
|
||||
|
@ -70,7 +70,7 @@ class Usage(Configs):
|
|||
f'\n{self.bold}OPTIONS:{self.endc}\n'
|
||||
f' {self.yellow}-y, --yes{self.endc} Answer Yes to all questions.\n'
|
||||
f' {self.yellow}-j, --jobs{self.endc} Set it for multicore systems.\n'
|
||||
f' {self.yellow}-o, --resolve-off{self.endc} Turns off dependency resolving.\n'
|
||||
f' {self.yellow}-O, --resolve-off{self.endc} Turns off dependency resolving.\n'
|
||||
f' {self.yellow}-r, --reinstall{self.endc} Upgrade packages of the same version.\n'
|
||||
f' {self.yellow}-k, --skip-installed{self.endc} Skip installed packages.\n'
|
||||
f' {self.yellow}-a, --install-data{self.endc} Install data into the database only.\n'
|
||||
|
@ -79,7 +79,7 @@ class Usage(Configs):
|
|||
f' {self.yellow}-n, --no-silent{self.endc} Disable silent mode.\n'
|
||||
f' {self.yellow}-p, --pkg-version{self.endc} Print the repository package version.\n'
|
||||
f' {self.yellow}-P, --parallel{self.endc} Download files in parallel.\n'
|
||||
f' {self.yellow}-B, --bin-repo={self.endc}[REPO] Set a binary repository.\n'
|
||||
f' {self.yellow}-o, --repository={self.endc}[REPO] Set a binary repository.\n'
|
||||
f' {self.yellow}-z, --directory={self.endc}[PATH] Download files to a specific path.\n'
|
||||
'\n -h, --help Show this message and exit.\n'
|
||||
' -v, --version Print version and exit.\n'
|
||||
|
|
|
@ -18,24 +18,27 @@ from slpkg.models.models import session as Session
|
|||
|
||||
class ViewMessage(Configs):
|
||||
|
||||
def __init__(self, flags: list, data=None):
|
||||
def __init__(self, flags: list, repository: str, data=None):
|
||||
__slots__ = 'flags', 'data'
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.repository = repository
|
||||
self.data: dict = data
|
||||
|
||||
self.session = Session
|
||||
self.utils = Utilities()
|
||||
self.dialogbox = DialogBox()
|
||||
self.ascii = Ascii()
|
||||
self.upgrade = Upgrade(flags, data)
|
||||
self.upgrade = Upgrade(repository, data)
|
||||
self.repos = Repositories()
|
||||
|
||||
self.download_only: Path = self.tmp_slpkg
|
||||
self.installed_packages: list = []
|
||||
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
self.option_for_resolve_off: bool = self.utils.is_option(
|
||||
['-o', '--resolve-off'], flags)
|
||||
['-O', '--resolve-off'], flags)
|
||||
|
||||
self.option_for_reinstall: bool = self.utils.is_option(
|
||||
['-r', '--reinstall'], flags)
|
||||
|
@ -43,17 +46,14 @@ class ViewMessage(Configs):
|
|||
self.option_for_yes: bool = self.utils.is_option(
|
||||
['-y', '--yes'], flags)
|
||||
|
||||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], flags)
|
||||
|
||||
self.repo: str = self.utils.repository_name(data)
|
||||
# self.repo: str = self.utils.repository_name(data)
|
||||
|
||||
def view_packages(self, package: str, mode: str) -> None:
|
||||
""" Printing the main packages. """
|
||||
size: str = ''
|
||||
color: str = self.red
|
||||
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
version: str = self.data[package][0]
|
||||
size: str = self.utils.convert_file_sizes(
|
||||
int(''.join(re.findall(r'\d+', self.data[package][4])))
|
||||
|
@ -79,7 +79,7 @@ class ViewMessage(Configs):
|
|||
and self.option_for_reinstall):
|
||||
color: str = self.violet
|
||||
|
||||
self.ascii.draw_view_package(package, version, size, color, self.repo)
|
||||
self.ascii.draw_view_package(package, version, size, color, self.repository)
|
||||
|
||||
def view_skipping_packages(self, package: str, version: str) -> None:
|
||||
""" Print the skipping packages. """
|
||||
|
@ -218,7 +218,7 @@ class ViewMessage(Configs):
|
|||
for pkg in packages:
|
||||
installed: str = self.utils.is_package_installed(pkg)
|
||||
|
||||
if self.option_for_binaries:
|
||||
if self.is_binary:
|
||||
size_comp += int(''.join(re.findall(r'\d+', self.data[pkg][4])))
|
||||
size_uncomp += int(''.join(re.findall(r'\d+', self.data[pkg][5])))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue