mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Merge branch 'develop' of https://gitlab.com/dslackw/slpkg into develop
This commit is contained in:
commit
999aed687a
30 changed files with 1660 additions and 258 deletions
|
@ -5,12 +5,14 @@
|
|||
# Default is the 'sbo' repository.
|
||||
|
||||
########################################################################
|
||||
# Note: Before using the repository, make sure you have read about it, #
|
||||
# some repositories are for -current only. #
|
||||
# Note: Before using the repository, make sure you have read about it. #
|
||||
# Some repositories are for -current only. Change the mirror if #
|
||||
# it is necessary. #
|
||||
########################################################################
|
||||
|
||||
[REPOSITORIES]
|
||||
|
||||
# Repository for slackware 15.0 stable.
|
||||
SBO_REPO_NAME = "sbo"
|
||||
SBO_REPO_MIRROR = "https://slackbuilds.org/slackbuilds/15.0/"
|
||||
SBO_REPO_SLACKBUILDS = "SLACKBUILDS.TXT"
|
||||
|
@ -18,6 +20,7 @@
|
|||
SBO_REPO_TAR_SUFFIX = ".tar.gz"
|
||||
SBO_REPO_TAG = "_SBo"
|
||||
|
||||
# Repository for slackware -current.
|
||||
PONCE_REPO_NAME = "ponce"
|
||||
PONCE_REPO = false
|
||||
PONCE_REPO_MIRROR = "https://cgit.ponce.cc/slackbuilds/plain/"
|
||||
|
@ -25,6 +28,8 @@
|
|||
PONCE_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
PONCE_REPO_TAG = "_SBo"
|
||||
|
||||
# Repository for slackware 15.0 stable.
|
||||
# Mirror for -current: http://slackware.uk/people/alien/sbrepos/current/x86_64/
|
||||
ALIEN_REPO_NAME = "alien"
|
||||
ALIEN_REPO = false
|
||||
ALIEN_REPO_MIRROR = "http://slackware.uk/people/alien/sbrepos/15.0/x86_64/"
|
||||
|
@ -33,6 +38,27 @@
|
|||
ALIEN_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
ALIEN_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware 15.0 stable.
|
||||
# Mirror for -current: https://slackware.nl/people/alien/multilib/current/
|
||||
MULTILIB_REPO_NAME = "multilib"
|
||||
MULTILIB_REPO = false
|
||||
MULTILIB_REPO_MIRROR = "https://slackware.nl/people/alien/multilib/15.0/"
|
||||
MULTILIB_REPO_CHANGELOG_MIRROR = "https://slackware.nl/people/alien/multilib/"
|
||||
MULTILIB_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
MULTILIB_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
MULTILIB_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware 15.0 stable.
|
||||
# Mirror for -current: https://slackware.nl/people/alien/restricted_sbrepos/current/x86_64/
|
||||
RESTRICTED_REPO_NAME = "restricted"
|
||||
RESTRICTED_REPO = false
|
||||
RESTRICTED_REPO_MIRROR = "https://slackware.nl/people/alien/restricted_sbrepos/15.0/x86_64/"
|
||||
RESTRICTED_REPO_CHANGELOG_MIRROR = "https://slackware.nl/people/alien/restricted_sbrepos/"
|
||||
RESTRICTED_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
RESTRICTED_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
RESTRICTED_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware -current.
|
||||
GNOME_REPO_NAME = "gnome"
|
||||
GNOME_REPO = false
|
||||
GNOME_REPO_MIRROR = "https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/"
|
||||
|
@ -40,6 +66,16 @@
|
|||
GNOME_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
GNOME_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware 15.0 stable.
|
||||
MSB_REPO_NAME = "msb"
|
||||
MSB_REPO = false
|
||||
MSB_REPO_MIRROR = "https://slackware.uk/msb/15.0/1.26/x86_64/"
|
||||
MSB_REPO_CHANGELOG_MIRROR = 'https://slackware.uk/msb/'
|
||||
MSB_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
MSB_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
MSB_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware -current.
|
||||
CONRAID_REPO_NAME = "conraid"
|
||||
CONRAID_REPO = false
|
||||
CONRAID_REPO_MIRROR = "https://slack.conraid.net/repository/slackware64-current/"
|
||||
|
@ -47,9 +83,53 @@
|
|||
CONRAID_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
CONRAID_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware 15.0 stable.
|
||||
# Mirror for -current: https://packages.slackonly.com/pub/packages/current-x86_64/
|
||||
SLACKONLY_REPO_NAME = "slackonly"
|
||||
SLACKONLY_REPO = false
|
||||
SLACKONLY_REPO_MIRROR = "https://packages.slackonly.com/pub/packages/15.0-x86_64/"
|
||||
SLACKONLY_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
SLACKONLY_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
SLACKONLY_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware 15.0 stable.
|
||||
# Mirror for -current: https://ponce.cc/slackware/slackware64-current/packages/
|
||||
PONCE_BIN_REPO_NAME = "ponce_bin"
|
||||
PONCE_BIN_REPO = false
|
||||
PONCE_BIN_REPO_MIRROR = "https://ponce.cc/slackware/slackware64-15.0/packages/"
|
||||
PONCE_BIN_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
PONCE_BIN_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
PONCE_BIN_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware 15.0 stable.
|
||||
SALIXOS_REPO_NAME = "salixos"
|
||||
SALIXOS_REPO = false
|
||||
SALIXOS_REPO_MIRROR = "https://download.salixos.org/x86_64/slackware-15.0/"
|
||||
SALIXOS_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
SALIXOS_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
SALIXOS_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware 15.0 stable.
|
||||
SALIXOS_EXTRA_REPO_NAME = "salixos_extra"
|
||||
SALIXOS_EXTRA_REPO = false
|
||||
SALIXOS_EXTRA_REPO_MIRROR = "https://download.salixos.org/x86_64/slackware-15.0/"
|
||||
SALIXOS_EXTRA_REPO_PACKAGES_MIRROR = 'https://download.salixos.org/x86_64/slackware-15.0/extra/'
|
||||
SALIXOS_EXTRA_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
SALIXOS_EXTRA_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
SALIXOS_EXTRA_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware -current.
|
||||
SLACKEL_REPO_NAME = "slackel"
|
||||
SLACKEL_REPO = false
|
||||
SLACKEL_REPO_MIRROR = "http://www.slackel.gr/repo/x86_64/slackware-current/"
|
||||
SLACKEL_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
SLACKEL_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
SLACKEL_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for slackware 15.0 stable.
|
||||
SLINT_REPO_NAME = "slint"
|
||||
SLINT_REPO = false
|
||||
SLINT_REPO_MIRROR = "https://slackware.uk/slint/x86_64/slint-15.0/"
|
||||
SLINT_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
SLINT_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
SLINT_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
|
14
man/slpkg.1
14
man/slpkg.1
|
@ -11,7 +11,7 @@ slpkg [-h|-v] [-u, update] [-U, upgrade] [-c, check-updates] [-I, repo-info] [-g
|
|||
[-D, clean-tmp] [-T, clean-data] [-b, build] [-i, install] [-d, download]
|
||||
[-R, remove] [-f, find] [-w, view] [-s, search] [-e, dependees] [-t, tracking] -y, --yes, -j, --jobs, -o, --resolve-off,
|
||||
-r, --reinstall, -k, --skip-installed, -E, --full-reverse, -S, --search, -n, --no-silent, -p, --pkg-version, -z,
|
||||
-G, --generate-only, -P, --parallel, -B, --bin-repo=[\fIPATH\fR], -z, --directory=[\fIPATH\fR]
|
||||
-G, --generate-only, -P, --parallel, -B, --bin-repo=[\fIREPO\fR], -z, --directory=[\fIPATH\fR]
|
||||
.SH DESCRIPTION
|
||||
.P
|
||||
Slpkg is a software package manager that installs, updates, and removes packages on Slackware based systems.
|
||||
|
@ -34,12 +34,13 @@ Upgrade all the installed packages if the newer version exists in the repository
|
|||
.P
|
||||
.B -c, check-updates
|
||||
.RS
|
||||
Check if there is any news on the SlackBuild's ChangeLog.txt file.
|
||||
Check if there is any news on the repositories ChangeLog.txt file.
|
||||
.RE
|
||||
.P
|
||||
.B -I, repo-info
|
||||
.RS
|
||||
Prints the repositories information.
|
||||
View information related to repositories, such as which repositories are active, when they were upgraded,
|
||||
and how many packages they contain.
|
||||
.RE
|
||||
.P
|
||||
.B -L, clean-logs
|
||||
|
@ -131,7 +132,7 @@ Turns off dependency resolving. (to be used with: -U, upgrade, -b, build, -i, in
|
|||
.B -r, --reinstall
|
||||
.RS
|
||||
Use this option if you want to upgrade all packages even if the same version is already installed.
|
||||
Do not skip installed packages. (to be used with: upgrade, -i, install)
|
||||
Do not skip installed packages. (to be used with: -U, upgrade, -i, install)
|
||||
.RE
|
||||
.P
|
||||
.B -k, --skip-installed
|
||||
|
@ -157,7 +158,7 @@ Example try: '\fIslpkg install python3 --search\fR' or '\fIslpkg download python
|
|||
.B -n, --no-silent
|
||||
.RS
|
||||
Disable silent mode, if it is enabled in the configuration file. (to be used with: -u, update, -U, upgrade, -b, build,
|
||||
-i, install, -d, download, -R, remove)
|
||||
-i, install, -R, remove)
|
||||
.RE
|
||||
.P
|
||||
.B -p, --pkg-version
|
||||
|
@ -181,7 +182,8 @@ Download files in parallel to speed up the process.
|
|||
.BI "-B," "" " \-\-bin-repo=[" REPO "]
|
||||
.RS
|
||||
Switch to binaries repositories and select a repository.
|
||||
Example: '\fIslpkg -i audacity --bin=repo=alien\fR'.
|
||||
Example: '\fIslpkg -i audacity --bin-repo=alien\fR'. Options update, check, and search support the asterisk '*' to apply
|
||||
it in all repositories, like search a package to all binaries repositories '\fIslpkg -s libreoffice --bin-repo='*'\fR'.
|
||||
(to be used with: -u, update, -U, upgrade, -i, install, -d, download, -s, search, -t, tracking, -e, dependees)
|
||||
.RE
|
||||
.P
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = slpkg
|
||||
version = 4.6.2
|
||||
version = r.c.2
|
||||
license_file = LICENSE
|
||||
author = Dimitris Zlatanidis
|
||||
author_email = d.zlatanidis@gmail.com
|
||||
|
|
|
@ -59,6 +59,8 @@ 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)
|
||||
|
||||
def execute(self) -> None:
|
||||
self.dependencies()
|
||||
|
||||
|
@ -74,7 +76,7 @@ class Packages(Configs):
|
|||
self.utils.finished_time(elapsed_time)
|
||||
|
||||
def dependencies(self):
|
||||
""" Creating te dependencies list and the order for install. """
|
||||
""" Creating the dependencies list and the order for install. """
|
||||
requires: list = []
|
||||
|
||||
if not self.utils.is_option(self.flag_resolve_off, self.flags):
|
||||
|
@ -100,10 +102,7 @@ class Packages(Configs):
|
|||
|
||||
for pkg in self.install_order:
|
||||
|
||||
skip_package: str = self.skip_installed_package(pkg)
|
||||
|
||||
if not skip_package:
|
||||
|
||||
if self.continue_install(pkg):
|
||||
mirror: str = BinQueries(pkg, self.repo).mirror()
|
||||
location: str = BinQueries(pkg, self.repo).location()
|
||||
package: str = BinQueries(pkg, self.repo).package_bin()
|
||||
|
@ -111,9 +110,8 @@ class Packages(Configs):
|
|||
pkg_urls.append(f'{mirror}{location}/{package}')
|
||||
self.binary_packages.append(package)
|
||||
self.utils.remove_file_if_exists(self.tmp_slpkg, package)
|
||||
|
||||
else:
|
||||
version: str = self.utils.split_binary_pkg(skip_package)[1]
|
||||
version: str = BinQueries(pkg, self.repo).version()
|
||||
self.view_message.view_skipping_packages(pkg, version)
|
||||
|
||||
if pkg_urls:
|
||||
|
@ -121,13 +119,16 @@ class Packages(Configs):
|
|||
down.download()
|
||||
print()
|
||||
|
||||
def skip_installed_package(self, package) -> str:
|
||||
""" Skip installed package when the option --skip-installed is applied. """
|
||||
installed_package: str = self.utils.is_package_installed(package)
|
||||
def continue_install(self, name) -> bool:
|
||||
""" Skip installed package when the option --skip-installed is applied
|
||||
and continue to install if the package is upgradable or the --reinstall option
|
||||
applied.
|
||||
"""
|
||||
if self.utils.is_option(self.flag_skip_installed, self.flags):
|
||||
return False
|
||||
|
||||
if (installed_package and self.mode == 'upgrade' and not self.upgrade.is_package_upgradeable(package)
|
||||
or self.mode == 'install' and not self.utils.is_option(self.flag_reinstall, self.flags)):
|
||||
return installed_package
|
||||
if self.upgrade.is_package_upgradeable(name) or self.utils.is_option(self.flag_reinstall, self.flags):
|
||||
return True
|
||||
|
||||
def checksum(self) -> None:
|
||||
""" Packages checksums. """
|
||||
|
@ -152,6 +153,8 @@ class Packages(Configs):
|
|||
|
||||
if not self.utils.is_option(self.flag_resolve_off, self.flags):
|
||||
name: str = self.utils.split_binary_pkg(package[:-4])[0]
|
||||
|
||||
if not self.utils.is_option(self.flag_resolve_off, self.flags):
|
||||
self.logging_installed_dependencies(name)
|
||||
|
||||
def logging_installed_dependencies(self, name: str) -> None:
|
||||
|
@ -228,7 +231,7 @@ class Packages(Configs):
|
|||
status: bool = False
|
||||
|
||||
repo_ver: str = BinQueries(package, self.repo).version()
|
||||
help_text: str = f'Package: {package}-{repo_ver}'
|
||||
help_text: str = f'Package: {package} {repo_ver}'
|
||||
upgradable: bool = self.upgrade.is_package_upgradeable(package)
|
||||
|
||||
if self.mode == 'upgrade' and upgradable:
|
||||
|
|
|
@ -24,7 +24,15 @@ class BinQueries(Configs):
|
|||
if self.name in self.black.packages():
|
||||
self.name: str = ''
|
||||
|
||||
def all_package_names(self) -> list:
|
||||
def count_packages(self):
|
||||
""" Counts the number of the packages. """
|
||||
count = self.session.query(
|
||||
BinariesTable.id).where(
|
||||
BinariesTable.repo == self.repo).count()
|
||||
|
||||
return count
|
||||
|
||||
def all_package_names_by_repo(self) -> list:
|
||||
""" Returns all the names of the binaries packages. """
|
||||
pkgs: tuple = self.session.query(
|
||||
BinariesTable.name).where(
|
||||
|
@ -32,7 +40,7 @@ class BinQueries(Configs):
|
|||
|
||||
return [pkg[0] for pkg in pkgs]
|
||||
|
||||
def all_binaries_packages(self) -> list:
|
||||
def all_binaries_packages_by_repo(self) -> list:
|
||||
""" Returns all the binaries packages. """
|
||||
pkgs: tuple = self.session.query(
|
||||
BinariesTable.package).where(
|
||||
|
@ -40,17 +48,25 @@ class BinQueries(Configs):
|
|||
|
||||
return [pkg[0] for pkg in pkgs]
|
||||
|
||||
def all_package_name_with_repo(self) -> tuple:
|
||||
def all_package_names_from_repositories(self) -> tuple:
|
||||
""" Returns the package name with the repo. """
|
||||
pkgs: tuple = self.session.query(
|
||||
BinariesTable.name, BinariesTable.repo).where(
|
||||
BinariesTable.repo == self.repo).all()
|
||||
BinariesTable.repo.in_(self.repos.bin_enabled_repos)).all()
|
||||
|
||||
if pkgs:
|
||||
return pkgs
|
||||
|
||||
return ()
|
||||
|
||||
def all_package_names_with_required(self) -> list:
|
||||
""" Returns all package with the dependencies. """
|
||||
required: list = self.session.query(
|
||||
BinariesTable.name, BinariesTable.required).where(
|
||||
BinariesTable.repo == self.repo).all()
|
||||
|
||||
return required
|
||||
|
||||
def repository(self) -> str:
|
||||
""" Return the repository name fo the package. """
|
||||
repository: tuple = self.session.query(
|
||||
|
@ -197,11 +213,3 @@ class BinQueries(Configs):
|
|||
if desc:
|
||||
return desc[0]
|
||||
return ''
|
||||
|
||||
def all_pkg_and_required(self) -> list:
|
||||
""" Returns all package with the dependencies. """
|
||||
required: list = self.session.query(
|
||||
BinariesTable.name, BinariesTable.required).where(
|
||||
BinariesTable.repo == self.repo).all()
|
||||
|
||||
return required
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
|
@ -11,24 +12,47 @@ 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()
|
||||
self.repos = Repositories()
|
||||
self.repo_package_names: list = BinQueries(
|
||||
self.name, self.repo).all_package_names_by_repo()
|
||||
|
||||
self.special_repos: list = [
|
||||
self.repos.salixos_repo_name,
|
||||
self.repos.salixos_extra_repo_name,
|
||||
self.repos.slackel_repo_name,
|
||||
self.repos.slint_repo_name
|
||||
]
|
||||
|
||||
def resolve(self) -> list:
|
||||
""" Resolve the dependencies. """
|
||||
requires: list[str] = BinQueries(self.name, self.repo).required()
|
||||
required: list[str] = BinQueries(self.name, self.repo).required()
|
||||
|
||||
# Resolve dependencies for some special repos.
|
||||
if self.repo in self.special_repos:
|
||||
requires: list = []
|
||||
for req in required:
|
||||
if req in self.repo_package_names:
|
||||
requires.append(req)
|
||||
return requires
|
||||
|
||||
for req in required:
|
||||
|
||||
# Remove requirements that are included as dependencies,
|
||||
# but are not included in the repository.
|
||||
if req not in self.repo_package_names:
|
||||
required.remove(req)
|
||||
|
||||
for req in requires:
|
||||
if req:
|
||||
sub: list[str] = BinQueries(req, self.repo).required()
|
||||
sub_required: list[str] = BinQueries(req, self.repo).required()
|
||||
|
||||
for s in sub:
|
||||
requires.append(s)
|
||||
for sub in sub_required:
|
||||
required.append(sub)
|
||||
|
||||
# Clean for dependencies not in the repository.
|
||||
for dep in requires:
|
||||
for dep in required:
|
||||
if dep not in self.repo_package_names:
|
||||
requires.remove(dep)
|
||||
required.remove(dep)
|
||||
|
||||
requires.reverse()
|
||||
required.reverse()
|
||||
|
||||
return list(dict.fromkeys(requires))
|
||||
return list(dict.fromkeys(required))
|
||||
|
|
|
@ -44,11 +44,28 @@ class CheckUpdates(Configs):
|
|||
self.repo_chg_txt: str = f'{self.repos.alien_repo_changelog_mirror}{self.repos.alien_repo_changelog}'
|
||||
compare[self.repos.alien_repo_name] = self.compare_dates()
|
||||
|
||||
if self.repos.multilib_repo and self.repo == self.repos.multilib_repo_name or self.repo == '*':
|
||||
self.local_chg_txt: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_changelog)
|
||||
self.repo_chg_txt: str = (f'{self.repos.multilib_repo_changelog_mirror}'
|
||||
f'{self.repos.multilib_repo_changelog}')
|
||||
compare[self.repos.multilib_repo_name] = self.compare_dates()
|
||||
|
||||
if self.repos.restricted_repo and self.repo == self.repos.restricted_repo_name or self.repo == '*':
|
||||
self.local_chg_txt: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_changelog)
|
||||
self.repo_chg_txt: str = (f'{self.repos.restricted_repo_changelog_mirror}'
|
||||
f'{self.repos.restricted_repo_changelog}')
|
||||
compare[self.repos.restricted_repo_name] = self.compare_dates()
|
||||
|
||||
if self.repos.gnome_repo and self.repo == self.repos.gnome_repo_name or self.repo == '*':
|
||||
self.local_chg_txt: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.gnome_repo_mirror}{self.repos.gnome_repo_changelog}'
|
||||
compare[self.repos.gnome_repo_name] = self.compare_dates()
|
||||
|
||||
if self.repos.msb_repo and self.repo == self.repos.msb_repo_name or self.repo == '*':
|
||||
self.local_chg_txt: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.msb_repo_changelog_mirror}{self.repos.msb_repo_changelog}'
|
||||
compare[self.repos.msb_repo_name] = self.compare_dates()
|
||||
|
||||
if self.repos.conraid_repo and self.repo == self.repos.conraid_repo_name or self.repo == '*':
|
||||
self.local_chg_txt: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.conraid_repo_mirror}{self.repos.conraid_repo_changelog}'
|
||||
|
@ -59,6 +76,33 @@ class CheckUpdates(Configs):
|
|||
self.repo_chg_txt: str = f'{self.repos.slackonly_repo_mirror}{self.repos.slackonly_repo_changelog}'
|
||||
compare[self.repos.slackonly_repo_name] = self.compare_dates()
|
||||
|
||||
if self.repos.ponce_bin_repo and self.repo == self.repos.ponce_bin_repo_name or self.repo == '*':
|
||||
self.local_chg_txt: Path = Path(self.repos.ponce_bin_repo_path, self.repos.ponce_bin_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.ponce_bin_repo_mirror}{self.repos.ponce_bin_repo_changelog}'
|
||||
compare[self.repos.ponce_bin_repo_name] = self.compare_dates()
|
||||
|
||||
if self.repos.salixos_repo and self.repo == self.repos.salixos_repo_name or self.repo == '*':
|
||||
self.local_chg_txt: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.salixos_repo_mirror}{self.repos.salixos_repo_changelog}'
|
||||
compare[self.repos.salixos_repo_name] = self.compare_dates()
|
||||
|
||||
if self.repos.salixos_extra_repo and self.repo == self.repos.salixos_extra_repo_name or self.repo == '*':
|
||||
self.local_chg_txt: Path = Path(self.repos.salixos_extra_repo_path,
|
||||
self.repos.salixos_extra_repo_changelog)
|
||||
self.repo_chg_txt: str = (f'{self.repos.salixos_extra_repo_mirror}'
|
||||
f'{self.repos.salixos_extra_repo_changelog}')
|
||||
compare[self.repos.salixos_extra_repo_name] = self.compare_dates()
|
||||
|
||||
if self.repos.slackel_repo and self.repo == self.repos.slackel_repo_name or self.repo == '*':
|
||||
self.local_chg_txt: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.slackel_repo_mirror}{self.repos.slackel_repo_changelog}'
|
||||
compare[self.repos.slackel_repo_name] = self.compare_dates()
|
||||
|
||||
if self.repos.slint_repo and self.repo == self.repos.slint_repo_name or self.repo == '*':
|
||||
self.local_chg_txt: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.slint_repo_mirror}{self.repos.slint_repo_changelog}'
|
||||
compare[self.repos.slint_repo_name] = self.compare_dates()
|
||||
|
||||
else:
|
||||
if self.repos.ponce_repo:
|
||||
self.local_chg_txt: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog)
|
||||
|
|
|
@ -37,13 +37,14 @@ class Check(Configs):
|
|||
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:
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
if not BinQueries(pkg, repo).package_name():
|
||||
if not BinQueries(pkg, repo).package_name() and pkg != '*':
|
||||
not_packages.append(pkg)
|
||||
|
||||
elif not SBoQueries(pkg).slackbuild():
|
||||
elif not SBoQueries(pkg).slackbuild() and pkg != '*':
|
||||
not_packages.append(pkg)
|
||||
|
||||
if not_packages:
|
||||
|
@ -52,6 +53,7 @@ class Check(Configs):
|
|||
def is_package_unsupported(self, slackbuilds: list) -> None:
|
||||
""" Checking for unsupported slackbuilds. """
|
||||
for sbo in slackbuilds:
|
||||
if sbo != '*':
|
||||
sources = SBoQueries(sbo).sources()
|
||||
|
||||
if 'UNSUPPORTED' in sources:
|
||||
|
@ -84,5 +86,6 @@ class Check(Configs):
|
|||
""" Checking for empty table and database file. """
|
||||
db = Path(self.db_path, self.database_name)
|
||||
if not self.session.query(self.repo_table).first() or not db.is_file():
|
||||
self.utils.raise_error_message("You need to update the package lists first.\n"
|
||||
" Please run 'slpkg update'")
|
||||
self.utils.raise_error_message("You need to update the package lists first, run:\n\n"
|
||||
" $ 'slpkg update'\n"
|
||||
" $ 'slpkg update --bin-repo='*' for binaries")
|
||||
|
|
|
@ -8,6 +8,7 @@ from urllib.parse import unquote
|
|||
|
||||
from slpkg.views.ascii import Ascii
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.utilities import Utilities
|
||||
|
||||
|
||||
class Md5sum:
|
||||
|
@ -16,6 +17,7 @@ class Md5sum:
|
|||
def __init__(self, flags: list):
|
||||
self.flags: list = flags
|
||||
self.ascii = Ascii()
|
||||
self.utils = Utilities()
|
||||
|
||||
def check(self, path: Union[str, Path], source: str, checksum: str) -> None:
|
||||
""" Checksum the source. """
|
||||
|
@ -34,8 +36,10 @@ class Md5sum:
|
|||
view = ViewMessage(self.flags)
|
||||
view.question()
|
||||
|
||||
@staticmethod
|
||||
def read_file(filename: Union[str, Path]) -> bytes:
|
||||
def read_file(self, filename: Union[str, Path]) -> bytes:
|
||||
""" Reads the text file. """
|
||||
try:
|
||||
with open(filename, 'rb') as f:
|
||||
return f.read()
|
||||
except FileNotFoundError:
|
||||
self.utils.raise_error_message(f"No such file or directory: '{filename}'")
|
||||
|
|
|
@ -42,6 +42,8 @@ class Dependees(Configs):
|
|||
print(f"The list below shows the "
|
||||
f"packages that dependees on '{', '.join([p for p in self.packages])}':\n")
|
||||
|
||||
self.packages: list = self.utils.apply_package_pattern(self.flags, self.packages, repo)
|
||||
|
||||
for pkg in self.packages:
|
||||
dependees: list = list(self.find_requires(pkg, repo))
|
||||
|
||||
|
@ -53,7 +55,7 @@ class Dependees(Configs):
|
|||
else:
|
||||
version: str = SBoQueries(pkg).version()
|
||||
|
||||
package: str = f'{self.byellow}{pkg}-{version}{self.endc}'
|
||||
package: str = f'{self.byellow}{pkg} {version}{self.endc}'
|
||||
|
||||
print(package)
|
||||
|
||||
|
@ -73,7 +75,7 @@ class Dependees(Configs):
|
|||
else:
|
||||
version: str = SBoQueries(dep[0]).version()
|
||||
|
||||
dependency: str = (f'{self.cyan}{dep[0]}{self.endc}-{self.yellow}'
|
||||
dependency: str = (f'{self.cyan}{dep[0]}{self.endc} {self.yellow}'
|
||||
f'{version}{self.endc}')
|
||||
|
||||
if i == 1:
|
||||
|
@ -83,16 +85,16 @@ class Dependees(Configs):
|
|||
|
||||
if self.utils.is_option(self.flag_full_reverse, self.flags):
|
||||
if i == len(dependees):
|
||||
print(" " * 4 + f' {self.llc}{self.hl} {self.violet}{dep[1]}{self.endc}')
|
||||
print(' ' * 4 + f' {self.llc}{self.hl} {self.violet}{dep[1]}{self.endc}')
|
||||
else:
|
||||
print(" " * 4 + f' {self.var}{self.hl} {self.violet}{dep[1]}{self.endc}')
|
||||
print(' ' * 4 + f' {self.var}{self.hl} {self.violet}{dep[1]}{self.endc}')
|
||||
|
||||
print(f'\n{self.grey}{len(dependees)} dependees for {pkg}{self.endc}\n')
|
||||
|
||||
def find_requires(self, pkg: str, repo) -> Generator[str, None, None]:
|
||||
""" Find requires that slackbuild dependees. """
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
requires: list = BinQueries(pkg, repo).all_pkg_and_required()
|
||||
requires: list = BinQueries(pkg, repo).all_package_names_with_required()
|
||||
else:
|
||||
requires: list = SBoQueries('').all_sbo_and_requires()
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ class Download(Configs):
|
|||
|
||||
def packages(self, packages: list, repo=None) -> None:
|
||||
""" Download the package only. """
|
||||
packages: list = self.utils.apply_package_pattern(self.flags, packages, repo)
|
||||
view = ViewMessage(self.flags, repo)
|
||||
view.download_packages(packages, self.directory)
|
||||
view.question()
|
||||
|
|
|
@ -7,7 +7,8 @@ from slpkg.configs import Configs
|
|||
from slpkg.utilities import Utilities
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import session as Session
|
||||
from slpkg.models.models import SBoTable, PonceTable, BinariesTable
|
||||
from slpkg.models.models import (SBoTable, PonceTable,
|
||||
BinariesTable, LastRepoUpdated)
|
||||
|
||||
|
||||
class InstallData(Configs):
|
||||
|
@ -24,6 +25,14 @@ class InstallData(Configs):
|
|||
self.byellow: str = f'{self.bold}{self.yellow}'
|
||||
self.endc: str = self.color['endc']
|
||||
|
||||
def last_updated(self, repo_file: Path) -> str:
|
||||
""" Reads the first date of the changelog file."""
|
||||
lines: list = self.utils.read_file(repo_file)
|
||||
days = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
|
||||
for line in lines:
|
||||
if line.startswith(days):
|
||||
return line.replace('\n', '')
|
||||
|
||||
def install_sbos_data(self) -> None:
|
||||
""" Install the data for SBo repository. """
|
||||
sbo_tags = [
|
||||
|
@ -39,11 +48,15 @@ class InstallData(Configs):
|
|||
'SLACKBUILD SHORT DESCRIPTION:'
|
||||
]
|
||||
sbo_table = SBoTable
|
||||
path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds)
|
||||
sbo_name: str = self.repos.sbo_repo_name
|
||||
path: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds)
|
||||
path_changelog: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog)
|
||||
|
||||
if self.repos.ponce_repo:
|
||||
sbo_table = PonceTable
|
||||
sbo_name: str = self.repos.ponce_repo_name
|
||||
path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
|
||||
path_changelog: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog)
|
||||
|
||||
slackbuilds_txt: list = self.utils.read_file(path)
|
||||
|
||||
|
@ -68,6 +81,10 @@ class InstallData(Configs):
|
|||
|
||||
cache: list = [] # reset cache after 11 lines
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=sbo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
@ -85,6 +102,7 @@ class InstallData(Configs):
|
|||
]
|
||||
path_packages: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
|
@ -116,7 +134,7 @@ class InstallData(Configs):
|
|||
|
||||
if line.startswith(pkg_tag[1]):
|
||||
package_location = line.replace(pkg_tag[1], '').strip()
|
||||
cache.append(package_location[1:]) # Do not install (.) dot
|
||||
cache.append(package_location[2:]) # Do not install (.) dot
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_size_comp = line.replace(pkg_tag[2], '').strip()
|
||||
|
@ -154,23 +172,27 @@ class InstallData(Configs):
|
|||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.alien_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
def install_gnome_data(self) -> None:
|
||||
""" Install the data for gnome repository. """
|
||||
def install_multilib_data(self) -> None:
|
||||
""" Install the data for multilib repository. """
|
||||
checksums_dict: dict = {}
|
||||
pkg_tag = [
|
||||
'PACKAGE NAME:',
|
||||
'PACKAGE MIRROR:',
|
||||
'PACKAGE LOCATION:',
|
||||
'PACKAGE SIZE (compressed):',
|
||||
'PACKAGE SIZE (uncompressed):',
|
||||
'PACKAGE DESCRIPTION:'
|
||||
]
|
||||
path_packages: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_checksums)
|
||||
path_packages: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
|
@ -194,16 +216,182 @@ class InstallData(Configs):
|
|||
cache.append(split_package[0]) # package name
|
||||
cache.append(split_package[1]) # package version
|
||||
cache.append(package_name)
|
||||
cache.append(self.repos.multilib_repo_mirror)
|
||||
try:
|
||||
cache.append(checksums_dict[package_name])
|
||||
except KeyError:
|
||||
cache.append('error checksum')
|
||||
|
||||
if line.startswith(pkg_tag[1]):
|
||||
package_mirror = line.replace(pkg_tag[1], '').strip()
|
||||
if not package_mirror.endswith('/'):
|
||||
package_mirror: str = f'{package_mirror}/'
|
||||
cache.append(package_mirror)
|
||||
package_location = line.replace(pkg_tag[1], '').strip()
|
||||
cache.append(package_location[2:]) # Do not install (./) dot
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_size_comp = line.replace(pkg_tag[2], '').strip()
|
||||
cache.append(f'{package_size_comp}B')
|
||||
|
||||
if line.startswith(pkg_tag[3]):
|
||||
package_size_uncomp = line.replace(pkg_tag[3], '').strip()
|
||||
cache.append(f'{package_size_uncomp}B')
|
||||
|
||||
if line.startswith(pkg_tag[4]):
|
||||
package_description = line.replace(pkg_tag[4], '').strip()
|
||||
cache.append(package_description)
|
||||
|
||||
if len(cache) == 9:
|
||||
data: str = BinariesTable(
|
||||
repo=self.repos.multilib_repo_name,
|
||||
name=cache[0],
|
||||
version=cache[1],
|
||||
package=cache[2],
|
||||
mirror=cache[3],
|
||||
checksum=cache[4],
|
||||
location=cache[5],
|
||||
size_comp=cache[6],
|
||||
size_uncomp=cache[7],
|
||||
description=cache[8],
|
||||
required=''
|
||||
)
|
||||
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.multilib_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
def install_restricted_data(self) -> None:
|
||||
""" Install the data for multilib repository. """
|
||||
checksums_dict: dict = {}
|
||||
pkg_tag = [
|
||||
'PACKAGE NAME:',
|
||||
'PACKAGE LOCATION:',
|
||||
'PACKAGE SIZE (compressed):',
|
||||
'PACKAGE SIZE (uncompressed):',
|
||||
'PACKAGE DESCRIPTION:'
|
||||
]
|
||||
path_packages: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
for line in checksums_md5:
|
||||
line = line.strip()
|
||||
|
||||
if line.endswith(('.txz', '.tgz')):
|
||||
file: str = line.split('./')[1].split('/')[-1].strip()
|
||||
checksum: str = line.split('./')[0].strip()
|
||||
checksums_dict[file] = checksum
|
||||
|
||||
cache: list = [] # init cache
|
||||
|
||||
print('Creating the database... ', end='', flush=True)
|
||||
|
||||
for line in packages_txt:
|
||||
|
||||
if line.startswith(pkg_tag[0]):
|
||||
package_name = line.replace(pkg_tag[0], '').strip()
|
||||
split_package: list = self.utils.split_binary_pkg(package_name)
|
||||
cache.append(split_package[0]) # package name
|
||||
cache.append(split_package[1]) # package version
|
||||
cache.append(package_name)
|
||||
cache.append(self.repos.restricted_repo_mirror)
|
||||
try:
|
||||
cache.append(checksums_dict[package_name])
|
||||
except KeyError:
|
||||
cache.append('error checksum')
|
||||
|
||||
if line.startswith(pkg_tag[1]):
|
||||
package_location = line.replace(pkg_tag[1], '').strip()
|
||||
cache.append(package_location[2:]) # Do not install (./) dot
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_size_comp = line.replace(pkg_tag[2], '').strip()
|
||||
cache.append(f'{package_size_comp}B')
|
||||
|
||||
if line.startswith(pkg_tag[3]):
|
||||
package_size_uncomp = line.replace(pkg_tag[3], '').strip()
|
||||
cache.append(f'{package_size_uncomp}B')
|
||||
|
||||
if line.startswith(pkg_tag[4]):
|
||||
package_description = line.replace(pkg_tag[4], '').strip()
|
||||
cache.append(package_description)
|
||||
|
||||
if len(cache) == 9:
|
||||
data: str = BinariesTable(
|
||||
repo=self.repos.restricted_repo_name,
|
||||
name=cache[0],
|
||||
version=cache[1],
|
||||
package=cache[2],
|
||||
mirror=cache[3],
|
||||
checksum=cache[4],
|
||||
location=cache[5],
|
||||
size_comp=cache[6],
|
||||
size_uncomp=cache[7],
|
||||
description=cache[8],
|
||||
required=''
|
||||
)
|
||||
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.restricted_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
def install_gnome_data(self) -> None:
|
||||
""" Install the data for gnome repository. """
|
||||
checksums_dict: dict = {}
|
||||
pkg_tag = [
|
||||
'PACKAGE NAME:',
|
||||
'PACKAGE MIRROR:',
|
||||
'PACKAGE LOCATION:',
|
||||
'PACKAGE SIZE (compressed):',
|
||||
'PACKAGE SIZE (uncompressed):',
|
||||
'PACKAGE DESCRIPTION:'
|
||||
]
|
||||
path_packages: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
for line in checksums_md5:
|
||||
line = line.strip()
|
||||
|
||||
if line.endswith(('.txz', '.tgz')):
|
||||
file: str = line.split('./')[1].split('/')[-1].strip()
|
||||
checksum: str = line.split('./')[0].strip()
|
||||
checksums_dict[file] = checksum
|
||||
|
||||
cache: list = [] # init cache
|
||||
|
||||
print('Creating the database... ', end='', flush=True)
|
||||
|
||||
for line in packages_txt:
|
||||
|
||||
if line.startswith(pkg_tag[0]):
|
||||
package_name = line.replace(pkg_tag[0], '').strip()
|
||||
split_package: list = self.utils.split_binary_pkg(package_name)
|
||||
cache.append(split_package[0]) # package name
|
||||
cache.append(split_package[1]) # package version
|
||||
cache.append(package_name)
|
||||
cache.append(self.repos.gnome_repo_mirror)
|
||||
try:
|
||||
cache.append(checksums_dict[package_name])
|
||||
except KeyError:
|
||||
cache.append('error checksum')
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_location = line.replace(pkg_tag[2], '').strip()
|
||||
|
@ -227,18 +415,108 @@ class InstallData(Configs):
|
|||
name=cache[0],
|
||||
version=cache[1],
|
||||
package=cache[2],
|
||||
checksum=cache[3],
|
||||
mirror=cache[4],
|
||||
mirror=cache[3],
|
||||
checksum=cache[4],
|
||||
location=cache[5],
|
||||
size_comp=cache[6],
|
||||
size_uncomp=cache[7],
|
||||
description=cache[8]
|
||||
description=cache[8],
|
||||
required=''
|
||||
)
|
||||
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.gnome_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
def install_msb_data(self) -> None:
|
||||
""" Install the data for msb repository. """
|
||||
checksums_dict: dict = {}
|
||||
pkg_tag = [
|
||||
'PACKAGE NAME:',
|
||||
'PACKAGE LOCATION:',
|
||||
'PACKAGE SIZE (compressed):',
|
||||
'PACKAGE SIZE (uncompressed):',
|
||||
'PACKAGE DESCRIPTION:'
|
||||
]
|
||||
path_packages: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
for line in checksums_md5:
|
||||
line = line.strip()
|
||||
|
||||
if line.endswith(('.txz', '.tgz')):
|
||||
file: str = line.split('./')[1].split('/')[-1].strip()
|
||||
checksum: str = line.split('./')[0].strip()
|
||||
checksums_dict[file] = checksum
|
||||
|
||||
cache: list = [] # init cache
|
||||
|
||||
print('Creating the database... ', end='', flush=True)
|
||||
|
||||
for line in packages_txt:
|
||||
|
||||
if line.startswith(pkg_tag[0]):
|
||||
package_name = line.replace(pkg_tag[0], '').strip()
|
||||
split_package: list = self.utils.split_binary_pkg(package_name)
|
||||
cache.append(split_package[0]) # package name
|
||||
cache.append(split_package[1]) # package version
|
||||
cache.append(package_name)
|
||||
cache.append(self.repos.msb_repo_mirror)
|
||||
try:
|
||||
cache.append(checksums_dict[package_name])
|
||||
except KeyError:
|
||||
cache.append('error checksum')
|
||||
|
||||
if line.startswith(pkg_tag[1]):
|
||||
package_location = line.replace(pkg_tag[1], '').strip()
|
||||
cache.append(package_location[2:]) # Do not install (./) dot
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_size_comp = line.replace(pkg_tag[2], '').strip()
|
||||
cache.append(f'{package_size_comp}B')
|
||||
|
||||
if line.startswith(pkg_tag[3]):
|
||||
package_size_uncomp = line.replace(pkg_tag[3], '').strip()
|
||||
cache.append(f'{package_size_uncomp}B')
|
||||
|
||||
if line.startswith(pkg_tag[4]):
|
||||
package_description = line.replace(pkg_tag[4], '').strip()
|
||||
cache.append(package_description)
|
||||
|
||||
if len(cache) == 9:
|
||||
data: str = BinariesTable(
|
||||
repo=self.repos.msb_repo_name,
|
||||
name=cache[0],
|
||||
version=cache[1],
|
||||
package=cache[2],
|
||||
mirror=cache[3],
|
||||
checksum=cache[4],
|
||||
location=cache[5],
|
||||
size_comp=cache[6],
|
||||
size_uncomp=cache[7],
|
||||
description=cache[8],
|
||||
required=''
|
||||
)
|
||||
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.msb_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
@ -256,6 +534,7 @@ class InstallData(Configs):
|
|||
]
|
||||
path_packages: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
|
@ -280,17 +559,12 @@ class InstallData(Configs):
|
|||
cache.append(split_package[0]) # package name
|
||||
cache.append(split_package[1]) # package version
|
||||
cache.append(package_name)
|
||||
cache.append(self.repos.conraid_repo_mirror)
|
||||
try:
|
||||
cache.append(checksums_dict[package_name])
|
||||
except KeyError:
|
||||
cache.append('error checksum')
|
||||
|
||||
if line.startswith(pkg_tag[1]):
|
||||
package_mirror: str = line.replace(pkg_tag[1], '').strip()
|
||||
if not package_mirror.endswith('/'):
|
||||
package_mirror: str = f'{package_mirror}/'
|
||||
cache.append(package_mirror)
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_location: str = line.replace(pkg_tag[2], '').strip()
|
||||
cache.append(package_location[2:]) # Do not install (./) dot
|
||||
|
@ -313,18 +587,23 @@ class InstallData(Configs):
|
|||
name=cache[0],
|
||||
version=cache[1],
|
||||
package=cache[2],
|
||||
checksum=cache[3],
|
||||
mirror=cache[4],
|
||||
mirror=cache[3],
|
||||
checksum=cache[4],
|
||||
location=cache[5],
|
||||
size_comp=cache[6],
|
||||
size_uncomp=cache[7],
|
||||
description=cache[8]
|
||||
description=cache[8],
|
||||
required='',
|
||||
)
|
||||
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.conraid_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
@ -342,6 +621,7 @@ class InstallData(Configs):
|
|||
]
|
||||
path_packages: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
|
@ -373,7 +653,7 @@ class InstallData(Configs):
|
|||
|
||||
if line.startswith(pkg_tag[1]):
|
||||
package_location = line.replace(pkg_tag[1], '').strip()
|
||||
cache.append(package_location[1:]) # Do not install (.) dot
|
||||
cache.append(package_location[2:]) # Do not install (./) dot
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_size_comp = line.replace(pkg_tag[2], '').strip()
|
||||
|
@ -411,6 +691,493 @@ class InstallData(Configs):
|
|||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.slackonly_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
def install_ponce_bin_data(self) -> None:
|
||||
""" Install the data for ponce_bin repository. """
|
||||
checksums_dict: dict = {}
|
||||
pkg_tag = [
|
||||
'PACKAGE NAME:',
|
||||
'PACKAGE MIRROR:',
|
||||
'PACKAGE LOCATION:',
|
||||
'PACKAGE SIZE (compressed):',
|
||||
'PACKAGE SIZE (uncompressed):',
|
||||
'PACKAGE DESCRIPTION:'
|
||||
]
|
||||
path_packages: Path = Path(self.repos.ponce_bin_repo_path, self.repos.ponce_bin_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.ponce_bin_repo_path, self.repos.ponce_bin_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.ponce_bin_repo_path, self.repos.ponce_bin_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
for line in checksums_md5:
|
||||
line = line.strip()
|
||||
|
||||
if line.endswith(('.txz', '.tgz')):
|
||||
file: str = line.split('./')[1].strip()
|
||||
checksum: str = line.split('./')[0].strip()
|
||||
checksums_dict[file] = checksum
|
||||
|
||||
cache: list = [] # init cache
|
||||
|
||||
print('Creating the database... ', end='', flush=True)
|
||||
|
||||
for line in packages_txt:
|
||||
|
||||
if line.startswith(pkg_tag[0]):
|
||||
package_name = line.replace(pkg_tag[0], '').strip()
|
||||
split_package: list = self.utils.split_binary_pkg(package_name)
|
||||
cache.append(split_package[0]) # package name
|
||||
cache.append(split_package[1]) # package version
|
||||
cache.append(package_name)
|
||||
cache.append(self.repos.ponce_bin_repo_mirror)
|
||||
try:
|
||||
cache.append(checksums_dict[package_name])
|
||||
except KeyError:
|
||||
cache.append('error checksum')
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_location = line.replace(pkg_tag[2], '').strip()
|
||||
cache.append(package_location[1:]) # Do not install (.) dot
|
||||
|
||||
if line.startswith(pkg_tag[3]):
|
||||
package_size_comp = line.replace(pkg_tag[3], '').strip()
|
||||
cache.append(f'{package_size_comp}B')
|
||||
|
||||
if line.startswith(pkg_tag[4]):
|
||||
package_size_uncomp = line.replace(pkg_tag[4], '').strip()
|
||||
cache.append(f'{package_size_uncomp}B')
|
||||
|
||||
if line.startswith(pkg_tag[5]):
|
||||
package_description = line.replace(pkg_tag[5], '').strip()
|
||||
cache.append(package_description)
|
||||
|
||||
if len(cache) == 9:
|
||||
data: str = BinariesTable(
|
||||
repo=self.repos.ponce_bin_repo_name,
|
||||
name=cache[0],
|
||||
version=cache[1],
|
||||
package=cache[2],
|
||||
mirror=cache[3],
|
||||
checksum=cache[4],
|
||||
location=cache[5],
|
||||
size_comp=cache[6],
|
||||
size_uncomp=cache[7],
|
||||
description=cache[8],
|
||||
required=''
|
||||
)
|
||||
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.ponce_bin_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
def install_salixos_data(self) -> None:
|
||||
""" Install the data for salixos repository. """
|
||||
checksums_dict: dict = {}
|
||||
pkg_tag = [
|
||||
'PACKAGE NAME:',
|
||||
'PACKAGE LOCATION:',
|
||||
'PACKAGE SIZE (compressed):',
|
||||
'PACKAGE SIZE (uncompressed):',
|
||||
'PACKAGE REQUIRED:',
|
||||
'PACKAGE DESCRIPTION:'
|
||||
]
|
||||
path_packages: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
for line in checksums_md5:
|
||||
line = line.strip()
|
||||
|
||||
if line.endswith(('.txz', '.tgz')):
|
||||
file: str = line.split('./')[1].split('/')[-1].strip()
|
||||
checksum: str = line.split('./')[0].strip()
|
||||
checksums_dict[file] = checksum
|
||||
|
||||
cache: list = [] # init cache
|
||||
|
||||
print('Creating the database... ', end='', flush=True)
|
||||
|
||||
for line in packages_txt:
|
||||
|
||||
if line.startswith(pkg_tag[0]):
|
||||
package_name = line.replace(pkg_tag[0], '').strip()
|
||||
split_package: list = self.utils.split_binary_pkg(package_name)
|
||||
cache.append(split_package[0]) # package name
|
||||
cache.append(split_package[1]) # package version
|
||||
cache.append(package_name)
|
||||
cache.append(self.repos.salixos_repo_mirror)
|
||||
try:
|
||||
cache.append(checksums_dict[package_name])
|
||||
except KeyError:
|
||||
cache.append('error checksum')
|
||||
|
||||
if line.startswith(pkg_tag[1]):
|
||||
package_location = line.replace(pkg_tag[1], '').strip()
|
||||
cache.append(package_location[2:]) # Do not install (./) dot
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_size_comp = line.replace(pkg_tag[2], '').strip()
|
||||
cache.append(f'{package_size_comp}B')
|
||||
|
||||
if line.startswith(pkg_tag[3]):
|
||||
package_size_uncomp = line.replace(pkg_tag[3], '').strip()
|
||||
cache.append(f'{package_size_uncomp}B')
|
||||
|
||||
if line.startswith(pkg_tag[4]):
|
||||
deps: list = []
|
||||
required = line.replace(pkg_tag[4], '').strip()
|
||||
|
||||
for req in required.split(','):
|
||||
dep = req.split('|')
|
||||
if len(dep) > 1:
|
||||
deps.append(dep[1])
|
||||
else:
|
||||
deps += dep
|
||||
|
||||
cache.append(' '.join(deps))
|
||||
|
||||
if line.startswith(pkg_tag[5]):
|
||||
package_description = line.replace(pkg_tag[5], '').strip()
|
||||
cache.append(package_description)
|
||||
|
||||
if len(cache) == 10:
|
||||
data: str = BinariesTable(
|
||||
repo=self.repos.salixos_repo_name,
|
||||
name=cache[0],
|
||||
version=cache[1],
|
||||
package=cache[2],
|
||||
mirror=cache[3],
|
||||
checksum=cache[4],
|
||||
location=cache[5],
|
||||
size_comp=cache[6],
|
||||
size_uncomp=cache[7],
|
||||
required=cache[8],
|
||||
description=cache[9]
|
||||
)
|
||||
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.salixos_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
def install_salixos_extra_data(self) -> None:
|
||||
""" Install the data for salixos_extra repository. """
|
||||
checksums_dict: dict = {}
|
||||
pkg_tag = [
|
||||
'PACKAGE NAME:',
|
||||
'PACKAGE LOCATION:',
|
||||
'PACKAGE SIZE (compressed):',
|
||||
'PACKAGE SIZE (uncompressed):',
|
||||
'PACKAGE REQUIRED:',
|
||||
'PACKAGE DESCRIPTION:'
|
||||
]
|
||||
path_packages: Path = Path(self.repos.salixos_extra_repo_path, self.repos.salixos_extra_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.salixos_extra_repo_path, self.repos.salixos_extra_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.salixos_extra_repo_path,
|
||||
self.repos.salixos_extra_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
for line in checksums_md5:
|
||||
line = line.strip()
|
||||
|
||||
if line.endswith(('.txz', '.tgz')):
|
||||
file: str = line.split('./')[1].split('/')[-1].strip()
|
||||
checksum: str = line.split('./')[0].strip()
|
||||
checksums_dict[file] = checksum
|
||||
|
||||
cache: list = [] # init cache
|
||||
|
||||
print('Creating the database... ', end='', flush=True)
|
||||
|
||||
for line in packages_txt:
|
||||
|
||||
if line.startswith(pkg_tag[0]):
|
||||
package_name = line.replace(pkg_tag[0], '').strip()
|
||||
split_package: list = self.utils.split_binary_pkg(package_name)
|
||||
cache.append(split_package[0]) # package name
|
||||
cache.append(split_package[1]) # package version
|
||||
cache.append(package_name)
|
||||
cache.append(self.repos.salixos_extra_repo_mirror)
|
||||
try:
|
||||
cache.append(checksums_dict[package_name])
|
||||
except KeyError:
|
||||
cache.append('error checksum')
|
||||
|
||||
if line.startswith(pkg_tag[1]):
|
||||
package_location = line.replace(pkg_tag[1], '').strip()
|
||||
cache.append(package_location[2:]) # Do not install (./) dot
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_size_comp = line.replace(pkg_tag[2], '').strip()
|
||||
cache.append(f'{package_size_comp}B')
|
||||
|
||||
if line.startswith(pkg_tag[3]):
|
||||
package_size_uncomp = line.replace(pkg_tag[3], '').strip()
|
||||
cache.append(f'{package_size_uncomp}B')
|
||||
|
||||
if line.startswith(pkg_tag[4]):
|
||||
deps: list = []
|
||||
required = line.replace(pkg_tag[4], '').strip()
|
||||
|
||||
for req in required.split(','):
|
||||
dep = req.split('|')
|
||||
if len(dep) > 1:
|
||||
deps.append(dep[1])
|
||||
else:
|
||||
deps += dep
|
||||
|
||||
cache.append(' '.join(deps))
|
||||
|
||||
if line.startswith(pkg_tag[5]):
|
||||
package_description = line.replace(pkg_tag[5], '').strip()
|
||||
cache.append(package_description)
|
||||
|
||||
if len(cache) == 10:
|
||||
data: str = BinariesTable(
|
||||
repo=self.repos.salixos_extra_repo_name,
|
||||
name=cache[0],
|
||||
version=cache[1],
|
||||
package=cache[2],
|
||||
mirror=cache[3],
|
||||
checksum=cache[4],
|
||||
location=cache[5],
|
||||
size_comp=cache[6],
|
||||
size_uncomp=cache[7],
|
||||
required=cache[8],
|
||||
description=cache[9]
|
||||
)
|
||||
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.salixos_extra_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
def install_slackel_data(self) -> None:
|
||||
""" Install the data for slackel repository. """
|
||||
checksums_dict: dict = {}
|
||||
pkg_tag = [
|
||||
'PACKAGE NAME:',
|
||||
'PACKAGE LOCATION:',
|
||||
'PACKAGE SIZE (compressed):',
|
||||
'PACKAGE SIZE (uncompressed):',
|
||||
'PACKAGE REQUIRED:',
|
||||
'PACKAGE DESCRIPTION:'
|
||||
]
|
||||
path_packages: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
for line in checksums_md5:
|
||||
line = line.strip()
|
||||
|
||||
if line.endswith(('.txz', '.tgz')):
|
||||
file: str = line.split('./')[1].split('/')[-1].strip()
|
||||
checksum: str = line.split('./')[0].strip()
|
||||
checksums_dict[file] = checksum
|
||||
|
||||
cache: list = [] # init cache
|
||||
|
||||
print('Creating the database... ', end='', flush=True)
|
||||
|
||||
for line in packages_txt:
|
||||
|
||||
if line.startswith(pkg_tag[0]):
|
||||
package_name = line.replace(pkg_tag[0], '').strip()
|
||||
split_package: list = self.utils.split_binary_pkg(package_name)
|
||||
cache.append(split_package[0]) # package name
|
||||
cache.append(split_package[1]) # package version
|
||||
cache.append(package_name)
|
||||
cache.append(self.repos.slackel_repo_mirror)
|
||||
try:
|
||||
cache.append(checksums_dict[package_name])
|
||||
except KeyError:
|
||||
cache.append('error checksum')
|
||||
|
||||
if line.startswith(pkg_tag[1]):
|
||||
package_location = line.replace(pkg_tag[1], '').strip()
|
||||
cache.append(package_location[2:]) # Do not install (./) dot
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_size_comp = line.replace(pkg_tag[2], '').strip()
|
||||
cache.append(f'{package_size_comp}B')
|
||||
|
||||
if line.startswith(pkg_tag[3]):
|
||||
package_size_uncomp = line.replace(pkg_tag[3], '').strip()
|
||||
cache.append(f'{package_size_uncomp}B')
|
||||
|
||||
if line.startswith(pkg_tag[4]):
|
||||
deps: list = []
|
||||
required = line.replace(pkg_tag[4], '').strip()
|
||||
|
||||
for req in required.split(','):
|
||||
dep = req.split('|')
|
||||
if len(dep) > 1:
|
||||
deps.append(dep[1])
|
||||
else:
|
||||
deps += dep
|
||||
|
||||
cache.append(' '.join(deps))
|
||||
|
||||
if line.startswith(pkg_tag[5]):
|
||||
package_description = line.replace(pkg_tag[5], '').strip()
|
||||
cache.append(package_description)
|
||||
|
||||
if len(cache) == 10:
|
||||
data: str = BinariesTable(
|
||||
repo=self.repos.slackel_repo_name,
|
||||
name=cache[0],
|
||||
version=cache[1],
|
||||
package=cache[2],
|
||||
mirror=cache[3],
|
||||
checksum=cache[4],
|
||||
location=cache[5],
|
||||
size_comp=cache[6],
|
||||
size_uncomp=cache[7],
|
||||
required=cache[8],
|
||||
description=cache[9]
|
||||
)
|
||||
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.slackel_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
def install_slint_data(self) -> None:
|
||||
""" Install the data for slint repository. """
|
||||
checksums_dict: dict = {}
|
||||
pkg_tag = [
|
||||
'PACKAGE NAME:',
|
||||
'PACKAGE LOCATION:',
|
||||
'PACKAGE SIZE (compressed):',
|
||||
'PACKAGE SIZE (uncompressed):',
|
||||
'PACKAGE REQUIRED:',
|
||||
'PACKAGE DESCRIPTION:'
|
||||
]
|
||||
path_packages: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_packages)
|
||||
path_checksums: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_checksums)
|
||||
path_changelog: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_changelog)
|
||||
packages_txt: list = self.utils.read_file(path_packages)
|
||||
checksums_md5: list = self.utils.read_file(path_checksums)
|
||||
|
||||
for line in checksums_md5:
|
||||
line = line.strip()
|
||||
|
||||
if line.endswith(('.txz', '.tgz')):
|
||||
file: str = line.split('./')[1].split('/')[-1].strip()
|
||||
checksum: str = line.split('./')[0].strip()
|
||||
checksums_dict[file] = checksum
|
||||
|
||||
cache: list = [] # init cache
|
||||
|
||||
print('Creating the database... ', end='', flush=True)
|
||||
|
||||
for line in packages_txt:
|
||||
|
||||
if line.startswith(pkg_tag[0]):
|
||||
package_name = line.replace(pkg_tag[0], '').strip()
|
||||
split_package: list = self.utils.split_binary_pkg(package_name)
|
||||
cache.append(split_package[0]) # package name
|
||||
cache.append(split_package[1]) # package version
|
||||
cache.append(package_name)
|
||||
cache.append(self.repos.slint_repo_mirror)
|
||||
try:
|
||||
cache.append(checksums_dict[package_name])
|
||||
except KeyError:
|
||||
cache.append('error checksum')
|
||||
|
||||
if line.startswith(pkg_tag[1]):
|
||||
package_location = line.replace(pkg_tag[1], '').strip()
|
||||
cache.append(package_location[2:]) # Do not install (./) dot
|
||||
|
||||
if line.startswith(pkg_tag[2]):
|
||||
package_size_comp = line.replace(pkg_tag[2], '').strip()
|
||||
cache.append(f'{package_size_comp}B')
|
||||
|
||||
if line.startswith(pkg_tag[3]):
|
||||
package_size_uncomp = line.replace(pkg_tag[3], '').strip()
|
||||
cache.append(f'{package_size_uncomp}B')
|
||||
|
||||
if line.startswith(pkg_tag[4]):
|
||||
deps: list = []
|
||||
required = line.replace(pkg_tag[4], '').strip()
|
||||
|
||||
for req in required.split(','):
|
||||
dep = req.split('|')
|
||||
if len(dep) > 1:
|
||||
deps.append(dep[1])
|
||||
else:
|
||||
deps += dep
|
||||
|
||||
cache.append(' '.join(deps))
|
||||
|
||||
if line.startswith(pkg_tag[5]):
|
||||
package_description = line.replace(pkg_tag[5], '').strip()
|
||||
cache.append(package_description)
|
||||
|
||||
if len(cache) == 10:
|
||||
data: str = BinariesTable(
|
||||
repo=self.repos.slint_repo_name,
|
||||
name=cache[0],
|
||||
version=cache[1],
|
||||
package=cache[2],
|
||||
mirror=cache[3],
|
||||
checksum=cache[4],
|
||||
location=cache[5],
|
||||
size_comp=cache[6],
|
||||
size_uncomp=cache[7],
|
||||
required=cache[8],
|
||||
description=cache[9]
|
||||
)
|
||||
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.slint_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
|
||||
self.session.commit()
|
||||
|
|
|
@ -199,8 +199,6 @@ class Argparse(Configs):
|
|||
self.flag_short_yes,
|
||||
self.flag_search,
|
||||
self.flag_short_search,
|
||||
self.flag_no_silent,
|
||||
self.flag_short_no_silent,
|
||||
self.flag_directory,
|
||||
self.flag_short_directory,
|
||||
self.flag_bin_repository,
|
||||
|
@ -283,11 +281,14 @@ class Argparse(Configs):
|
|||
|
||||
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)
|
||||
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.utils.is_option(self.flag_binaries, self.flags):
|
||||
|
||||
if self.binary_repo not in self.repos.binaries_repositories_dict.keys():
|
||||
except_options: list = ['-s', 'search', '-u', 'update', '-c', 'check-updates']
|
||||
|
||||
if 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.binary_repo not in self.repos.bin_repos_names and self.binary_repo != '*':
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.binary_repo}'")
|
||||
|
||||
def invalid_options(self) -> None:
|
||||
|
@ -401,7 +402,7 @@ class Argparse(Configs):
|
|||
|
||||
repo_packages: list = SBoQueries('').sbos()
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
repo_packages: list = BinQueries('', self.binary_repo).all_package_names()
|
||||
repo_packages: list = BinQueries('', self.binary_repo).all_package_names_by_repo()
|
||||
|
||||
installed: list = self.utils.installed_packages
|
||||
|
||||
|
@ -453,9 +454,11 @@ class Argparse(Configs):
|
|||
text: str = f'There are {len(choices)} packages:'
|
||||
code, tags = self.dialogbox.checklist(text, packages, title, height,
|
||||
width, list_height, choices)
|
||||
|
||||
os.system('clear')
|
||||
|
||||
if code == 'cancel':
|
||||
raise SystemExit()
|
||||
|
||||
if not tags:
|
||||
return packages
|
||||
|
||||
|
@ -623,7 +626,6 @@ class Argparse(Configs):
|
|||
|
||||
if len(self.args) >= 2:
|
||||
|
||||
self.check.is_empty_database()
|
||||
packages: list = self.is_file_list_packages()
|
||||
|
||||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
|
@ -697,7 +699,7 @@ class Argparse(Configs):
|
|||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.exists_in_the_database(packages)
|
||||
self.check.exists_in_the_database(packages, self.binary_repo)
|
||||
|
||||
dependees = Dependees(packages, self.flags)
|
||||
dependees.find(self.binary_repo)
|
||||
|
@ -715,7 +717,7 @@ class Argparse(Configs):
|
|||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.exists_in_the_database(packages)
|
||||
self.check.exists_in_the_database(packages, self.binary_repo)
|
||||
|
||||
tracking = Tracking(self.flags)
|
||||
tracking.packages(packages, self.binary_repo)
|
||||
|
@ -725,8 +727,11 @@ class Argparse(Configs):
|
|||
def help_for_commands(self) -> None:
|
||||
""" Extra help information for commands. """
|
||||
if len(self.args) == 2:
|
||||
try:
|
||||
flags = self.commands[self.args[1]]
|
||||
Help(self.args[1], flags).view()
|
||||
except KeyError:
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid argument '{''.join(self.args[1])}'")
|
||||
else:
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
|
|
@ -90,4 +90,15 @@ class LogsDependencies(Base):
|
|||
requires: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LastRepoUpdated(Base):
|
||||
""" The table that saves the last updated date. """
|
||||
|
||||
__tablename__ = 'lastupdated'
|
||||
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
repo: str = Column(Text)
|
||||
date: str = Column(Text)
|
||||
|
||||
|
||||
Base.metadata.create_all(engine)
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
from slpkg.models.models import LastRepoUpdated
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
class RepoInfo(Configs):
|
||||
|
@ -20,6 +21,7 @@ class RepoInfo(Configs):
|
|||
self.repos = Repositories()
|
||||
self.color = self.colour()
|
||||
self.columns, self.rows = shutil.get_terminal_size()
|
||||
self.session = Session
|
||||
|
||||
self.bold: str = self.color['bold']
|
||||
self.green: str = self.color['green']
|
||||
|
@ -32,48 +34,42 @@ class RepoInfo(Configs):
|
|||
|
||||
def info(self):
|
||||
""" Prints information about repositories. """
|
||||
total_packages: int = 0
|
||||
enabled: int = 0
|
||||
|
||||
print('Repositories Information:')
|
||||
print('=' * self.columns)
|
||||
print(f"{'Name:':<18}{'Status:':<15}{'Last Updated:':<35}{'Packages:':>12}")
|
||||
print('=' * self.columns)
|
||||
|
||||
total_packages: int = 0
|
||||
enabled: int = 0
|
||||
for repo, value in self.repos.repos_dict.items():
|
||||
count: int = 0
|
||||
status: str = 'Disabled'
|
||||
color: str = self.red
|
||||
|
||||
if value[0]:
|
||||
enabled += 1
|
||||
status: str = 'Enabled'
|
||||
color: str = self.green
|
||||
|
||||
last: str = self.last_update(Path(value[1], value[2]))
|
||||
last: str = self.session.query(
|
||||
LastRepoUpdated.date).where(
|
||||
LastRepoUpdated.repo == repo).first()
|
||||
|
||||
packages: dict = {
|
||||
self.repos.sbo_repo_name: len(SBoQueries('').sbos()),
|
||||
self.repos.ponce_repo_name: len(SBoQueries('').sbos()),
|
||||
self.repos.alien_repo_name: len(BinQueries('', repo).all_package_names()),
|
||||
self.repos.gnome_repo_name: len(BinQueries('', repo).all_package_names()),
|
||||
self.repos.conraid_repo_name: len(BinQueries('', repo).all_package_names()),
|
||||
self.repos.slackonly_repo_name: len(BinQueries('', repo).all_package_names())
|
||||
}
|
||||
if last is None:
|
||||
last: tuple = ('',)
|
||||
|
||||
if value[0]:
|
||||
count: int = packages[repo]
|
||||
if repo in [self.repos.sbo_repo_name, self.repos.ponce_repo_name]:
|
||||
count = int(SBoQueries('').count_packages())
|
||||
else:
|
||||
count = int(BinQueries('', repo).count_packages())
|
||||
|
||||
total_packages += count
|
||||
|
||||
print(f"{self.cyan}{repo:<18}{self.endc}{color}{status:<15}{self.endc}{last:<35}"
|
||||
print(f"{self.cyan}{repo:<18}{self.endc}{color}{status:<15}{self.endc}{last[0]:<35}"
|
||||
f"{self.yellow}{count:>12}{self.endc}")
|
||||
|
||||
print('=' * self.columns)
|
||||
print(f"{self.grey}Total of {enabled} repositories are enabled with {total_packages} packages available.")
|
||||
|
||||
def last_update(self, repo_file: Path) -> str:
|
||||
""" Reads the first date of the changelog file."""
|
||||
lines: list = self.utils.read_file(repo_file)
|
||||
days = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
|
||||
for line in lines:
|
||||
if line.startswith(days):
|
||||
return line.replace('\n', '')
|
||||
print(f"{self.grey}Total of {enabled}/{len(self.repos.repos_dict)} "
|
||||
f"repositories are enabled with {total_packages} packages available.\n")
|
||||
|
|
|
@ -22,57 +22,125 @@ class Repositories:
|
|||
|
||||
repos = {}
|
||||
binaries_repositories_dict = {}
|
||||
bin_enabled_repositories = []
|
||||
bin_enabled_repos = []
|
||||
sbo_enabled: bool = True
|
||||
|
||||
sbo_repo_name: str = 'sbo'
|
||||
sbo_repo_path: Path = Path(config.lib_path, 'repositories', sbo_repo_name)
|
||||
sbo_repo_mirror: str = "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_mirror: str = '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'
|
||||
|
||||
ponce_repo_name: str = 'ponce'
|
||||
ponce_repo: bool = False
|
||||
ponce_repo_path: Path = Path(config.lib_path, 'repositories', ponce_repo_name)
|
||||
ponce_repo_mirror: str = "https://cgit.ponce.cc/slackbuilds/plain/"
|
||||
ponce_repo_slackbuilds: str = "SLACKBUILDS.TXT"
|
||||
ponce_repo_changelog: str = "ChangeLog.txt"
|
||||
ponce_repo_tag: str = "_SBo"
|
||||
ponce_repo_mirror: str = 'https://cgit.ponce.cc/slackbuilds/plain/'
|
||||
ponce_repo_slackbuilds: str = 'SLACKBUILDS.TXT'
|
||||
ponce_repo_changelog: str = 'ChangeLog.txt'
|
||||
ponce_repo_tag: str = '_SBo'
|
||||
|
||||
alien_repo_name: str = 'alien'
|
||||
alien_repo: bool = True
|
||||
alien_repo: bool = False
|
||||
alien_repo_path: Path = Path(config.lib_path, 'repositories', alien_repo_name)
|
||||
alien_repo_mirror: str = "http://slackware.uk/people/alien/sbrepos/15.0/x86_64/"
|
||||
alien_repo_changelog_mirror: str = "http://slackware.uk/people/alien/sbrepos/"
|
||||
alien_repo_packages: str = "PACKAGES.TXT"
|
||||
alien_repo_checksums: str = "CHECKSUMS.md5"
|
||||
alien_repo_changelog: str = "ChangeLog.txt"
|
||||
alien_repo_mirror: str = 'http://slackware.uk/people/alien/sbrepos/15.0/x86_64/'
|
||||
alien_repo_changelog_mirror: str = 'http://slackware.uk/people/alien/sbrepos/'
|
||||
alien_repo_packages: str = 'PACKAGES.TXT'
|
||||
alien_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
alien_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
multilib_repo_name: str = 'multilib'
|
||||
multilib_repo: bool = False
|
||||
multilib_repo_path: Path = Path(config.lib_path, 'repositories', multilib_repo_name)
|
||||
multilib_repo_mirror: str = 'https://slackware.nl/people/alien/multilib/15.0/'
|
||||
multilib_repo_changelog_mirror: str = 'https://slackware.nl/people/alien/multilib/'
|
||||
multilib_repo_packages: str = 'PACKAGES.TXT'
|
||||
multilib_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
multilib_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
restricted_repo_name: str = 'restricted'
|
||||
restricted_repo: bool = False
|
||||
restricted_repo_path: Path = Path(config.lib_path, 'repositories', restricted_repo_name)
|
||||
restricted_repo_mirror: str = 'https://slackware.nl/people/alien/restricted_sbrepos/15.0/x86_64/'
|
||||
restricted_repo_changelog_mirror: str = 'https://slackware.nl/people/alien/restricted_sbrepos/'
|
||||
restricted_repo_packages: str = 'PACKAGES.TXT'
|
||||
restricted_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
restricted_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
gnome_repo_name: str = 'gnome'
|
||||
gnome_repo: bool = True
|
||||
gnome_repo: bool = False
|
||||
gnome_repo_path: Path = Path(config.lib_path, 'repositories', gnome_repo_name)
|
||||
gnome_repo_mirror: str = "https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/"
|
||||
gnome_repo_packages: str = "PACKAGES.TXT"
|
||||
gnome_repo_checksums: str = "CHECKSUMS.md5"
|
||||
gnome_repo_changelog: str = "ChangeLog.txt"
|
||||
gnome_repo_mirror: str = 'https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/'
|
||||
gnome_repo_packages: str = 'PACKAGES.TXT'
|
||||
gnome_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
gnome_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
msb_repo_name: str = 'msb'
|
||||
msb_repo: bool = False
|
||||
msb_repo_path: Path = Path(config.lib_path, 'repositories', msb_repo_name)
|
||||
msb_repo_mirror: str = 'https://slackware.uk/msb/15.0/1.26/x86_64/'
|
||||
msb_repo_changelog_mirror: str = 'https://slackware.uk/msb/'
|
||||
msb_repo_packages: str = 'PACKAGES.TXT'
|
||||
msb_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
msb_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
conraid_repo_name: str = 'conraid'
|
||||
conraid_repo: bool = True
|
||||
conraid_repo: bool = False
|
||||
conraid_repo_path: Path = Path(config.lib_path, 'repositories', conraid_repo_name)
|
||||
conraid_repo_mirror: str = "https://reddoglinux.ddns.net/linux/conraid_43.x/x86_64/"
|
||||
conraid_repo_packages: str = "PACKAGES.TXT"
|
||||
conraid_repo_checksums: str = "CHECKSUMS.md5"
|
||||
conraid_repo_changelog: str = "ChangeLog.txt"
|
||||
conraid_repo_mirror: str = 'https://reddoglinux.ddns.net/linux/conraid_43.x/x86_64/'
|
||||
conraid_repo_packages: str = 'PACKAGES.TXT'
|
||||
conraid_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
conraid_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
slackonly_repo_name: str = 'slackonly'
|
||||
slackonly_repo: bool = True
|
||||
slackonly_repo: bool = False
|
||||
slackonly_repo_path: Path = Path(config.lib_path, 'repositories', slackonly_repo_name)
|
||||
slackonly_repo_mirror: str = "https://packages.slackonly.com/pub/packages/15.0-x86_64/"
|
||||
slackonly_repo_packages: str = "PACKAGES.TXT"
|
||||
slackonly_repo_checksums: str = "CHECKSUMS.md5"
|
||||
slackonly_repo_changelog: str = "ChangeLog.txt"
|
||||
slackonly_repo_mirror: str = 'https://packages.slackonly.com/pub/packages/15.0-x86_64/'
|
||||
slackonly_repo_packages: str = 'PACKAGES.TXT'
|
||||
slackonly_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
slackonly_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
ponce_bin_repo_name: str = 'ponce_bin'
|
||||
ponce_bin_repo: bool = False
|
||||
ponce_bin_repo_path: Path = Path(config.lib_path, 'repositories', ponce_bin_repo_name)
|
||||
ponce_bin_repo_mirror: str = 'https://ponce.cc/slackware/slackware64-15.0/packages/'
|
||||
ponce_bin_repo_packages: str = 'PACKAGES.TXT'
|
||||
ponce_bin_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
ponce_bin_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
salixos_repo_name: str = 'salixos'
|
||||
salixos_repo: bool = False
|
||||
salixos_repo_path: Path = Path(config.lib_path, 'repositories', salixos_repo_name)
|
||||
salixos_repo_mirror: str = 'https://download.salixos.org/x86_64/slackware-15.0/'
|
||||
salixos_repo_packages: str = 'PACKAGES.TXT'
|
||||
salixos_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
salixos_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
salixos_extra_repo_name: str = 'salixos_extra'
|
||||
salixos_extra_repo: bool = False
|
||||
salixos_extra_repo_path: Path = Path(config.lib_path, 'repositories', salixos_extra_repo_name)
|
||||
salixos_extra_repo_mirror: str = 'https://download.salixos.org/x86_64/slackware-15.0/'
|
||||
salixos_extra_repo_packages_mirror: str = 'https://download.salixos.org/x86_64/slackware-15.0/extra/'
|
||||
salixos_extra_repo_packages: str = 'PACKAGES.TXT'
|
||||
salixos_extra_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
salixos_extra_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
slackel_repo_name: str = 'slackel'
|
||||
slackel_repo: bool = False
|
||||
slackel_repo_path: Path = Path(config.lib_path, 'repositories', slackel_repo_name)
|
||||
slackel_repo_mirror: str = 'http://www.slackel.gr/repo/x86_64/slackware-current/'
|
||||
slackel_repo_packages: str = 'PACKAGES.TXT'
|
||||
slackel_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
slackel_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
slint_repo_name: str = 'slint'
|
||||
slint_repo: bool = False
|
||||
slint_repo_path: Path = Path(config.lib_path, 'repositories', slint_repo_name)
|
||||
slint_repo_mirror: str = 'https://slackware.uk/slint/x86_64/slint-15.0/'
|
||||
slint_repo_packages: str = 'PACKAGES.TXT'
|
||||
slint_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
slint_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
# Default repository tag.
|
||||
repo_tag: str = sbo_repo_tag
|
||||
|
@ -107,6 +175,22 @@ class Repositories:
|
|||
alien_repo_checksums: str = repos['ALIEN_REPO_CHECKSUMS']
|
||||
alien_repo_changelog: str = repos['ALIEN_REPO_CHANGELOG']
|
||||
|
||||
multilib_repo_name: str = repos['MULTILIB_REPO_NAME']
|
||||
multilib_repo: bool = repos['MULTILIB_REPO']
|
||||
multilib_repo_mirror: str = repos['MULTILIB_REPO_MIRROR']
|
||||
multilib_repo_changelog_mirror: str = repos['MULTILIB_REPO_CHANGELOG_MIRROR']
|
||||
multilib_repo_packages: str = repos['MULTILIB_REPO_PACKAGES']
|
||||
multilib_repo_checksums: str = repos['MULTILIB_REPO_CHECKSUMS']
|
||||
multilib_repo_changelog: str = repos['MULTILIB_REPO_CHANGELOG']
|
||||
|
||||
restricted_repo_name: str = repos['RESTRICTED_REPO_NAME']
|
||||
restricted_repo: bool = repos['RESTRICTED_REPO']
|
||||
restricted_repo_mirror: str = repos['RESTRICTED_REPO_MIRROR']
|
||||
restricted_repo_changelog_mirror: str = repos['RESTRICTED_REPO_CHANGELOG_MIRROR']
|
||||
restricted_repo_packages: str = repos['RESTRICTED_REPO_PACKAGES']
|
||||
restricted_repo_checksums: str = repos['RESTRICTED_REPO_CHECKSUMS']
|
||||
restricted_repo_changelog: str = repos['RESTRICTED_REPO_CHANGELOG']
|
||||
|
||||
gnome_repo_name: str = repos['GNOME_REPO_NAME']
|
||||
gnome_repo: bool = repos['GNOME_REPO']
|
||||
gnome_repo_mirror: str = repos['GNOME_REPO_MIRROR']
|
||||
|
@ -114,6 +198,14 @@ class Repositories:
|
|||
gnome_repo_checksums: str = repos['GNOME_REPO_CHECKSUMS']
|
||||
gnome_repo_changelog: str = repos['GNOME_REPO_CHANGELOG']
|
||||
|
||||
msb_repo_name: str = repos['MSB_REPO_NAME']
|
||||
msb_repo: bool = repos['MSB_REPO']
|
||||
msb_repo_mirror: str = repos['MSB_REPO_MIRROR']
|
||||
msb_repo_changelog_mirror: str = repos['MSB_REPO_CHANGELOG_MIRROR']
|
||||
msb_repo_packages: str = repos['MSB_REPO_PACKAGES']
|
||||
msb_repo_checksums: str = repos['MSB_REPO_CHECKSUMS']
|
||||
msb_repo_changelog: str = repos['MSB_REPO_CHANGELOG']
|
||||
|
||||
conraid_repo_name: str = repos['CONRAID_REPO_NAME']
|
||||
conraid_repo: bool = repos['CONRAID_REPO']
|
||||
conraid_repo_mirror: str = repos['CONRAID_REPO_MIRROR']
|
||||
|
@ -128,26 +220,50 @@ class Repositories:
|
|||
slackonly_repo_checksums: str = repos['SLACKONLY_REPO_CHECKSUMS']
|
||||
slackonly_repo_changelog: str = repos['SLACKONLY_REPO_CHANGELOG']
|
||||
|
||||
ponce_bin_repo_name: str = repos['PONCE_BIN_REPO_NAME']
|
||||
ponce_bin_repo: bool = repos['PONCE_BIN_REPO']
|
||||
ponce_bin_repo_mirror: str = repos['PONCE_BIN_REPO_MIRROR']
|
||||
ponce_bin_repo_packages: str = repos['PONCE_BIN_REPO_PACKAGES']
|
||||
ponce_bin_repo_checksums: str = repos['PONCE_BIN_REPO_CHECKSUMS']
|
||||
ponce_bin_repo_changelog: str = repos['PONCE_BIN_REPO_CHANGELOG']
|
||||
|
||||
salixos_repo_name: str = repos['SALIXOS_REPO_NAME']
|
||||
salixos_repo: bool = repos['SALIXOS_REPO']
|
||||
salixos_repo_mirror: str = repos['SALIXOS_REPO_MIRROR']
|
||||
salixos_repo_packages: str = repos['SALIXOS_REPO_PACKAGES']
|
||||
salixos_repo_checksums: str = repos['SALIXOS_REPO_CHECKSUMS']
|
||||
salixos_repo_changelog: str = repos['SALIXOS_REPO_CHANGELOG']
|
||||
|
||||
salixos_extra_repo_name: str = repos['SALIXOS_EXTRA_REPO_NAME']
|
||||
salixos_extra_repo: bool = repos['SALIXOS_EXTRA_REPO']
|
||||
salixos_extra_repo_mirror: str = repos['SALIXOS_EXTRA_REPO_MIRROR']
|
||||
salixos_extra_repo_packages_mirror: str = repos['SALIXOS_EXTRA_REPO_PACKAGES_MIRROR']
|
||||
salixos_extra_repo_packages: str = repos['SALIXOS_EXTRA_REPO_PACKAGES']
|
||||
salixos_extra_repo_checksums: str = repos['SALIXOS_EXTRA_REPO_CHECKSUMS']
|
||||
salixos_extra_repo_changelog: str = repos['SALIXOS_EXTRA_REPO_CHANGELOG']
|
||||
|
||||
slackel_repo_name: str = repos['SLACKEL_REPO_NAME']
|
||||
slackel_repo: bool = repos['SLACKEL_REPO']
|
||||
slackel_repo_mirror: str = repos['SLACKEL_REPO_MIRROR']
|
||||
slackel_repo_packages: str = repos['SLACKEL_REPO_PACKAGES']
|
||||
slackel_repo_checksums: str = repos['SLACKEL_REPO_CHECKSUMS']
|
||||
slackel_repo_changelog: str = repos['SLACKEL_REPO_CHANGELOG']
|
||||
|
||||
slint_repo_name: str = repos['SLINT_REPO_NAME']
|
||||
slint_repo: bool = repos['SLINT_REPO']
|
||||
slint_repo_mirror: str = repos['SLINT_REPO_MIRROR']
|
||||
slint_repo_packages: str = repos['SLINT_REPO_PACKAGES']
|
||||
slint_repo_checksums: str = repos['SLINT_REPO_CHECKSUMS']
|
||||
slint_repo_changelog: str = repos['SLINT_REPO_CHANGELOG']
|
||||
|
||||
except (tomli.TOMLDecodeError, KeyError) as error:
|
||||
raise SystemExit(f"\n{config.prog_name} {bred}Error{endc}: {error}: in the configuration file "
|
||||
raise SystemExit(f'\n{config.prog_name} {bred}Error{endc}: {error}: in the configuration file '
|
||||
f"'{repositories_file_toml}'.\n"
|
||||
f"\nIf you have upgraded the '{config.prog_name}' probably you need to run:\n"
|
||||
f"'mv {repositories_file_toml}.new {repositories_file_toml}'.\n"
|
||||
f"or '{cyan}slpkg_new-configs{endc}' command.\n")
|
||||
|
||||
# Dictionary with the binaries repositories.
|
||||
binaries_repositories_dict = {
|
||||
alien_repo_name: alien_repo,
|
||||
gnome_repo_name: gnome_repo,
|
||||
conraid_repo_name: conraid_repo,
|
||||
slackonly_repo_name: slackonly_repo
|
||||
}
|
||||
|
||||
# All enabled binaries repositories.
|
||||
for repo, enable in binaries_repositories_dict.items():
|
||||
if enable:
|
||||
bin_enabled_repositories.append(repo)
|
||||
|
||||
# Switch to ponce repository if is true.
|
||||
if ponce_repo:
|
||||
sbo_enabled_repository: str = ponce_repo_name
|
||||
repo_tag: str = ponce_repo_tag
|
||||
|
@ -158,7 +274,24 @@ class Repositories:
|
|||
sbo_repo_name: [sbo_enabled, sbo_repo_path, sbo_repo_changelog],
|
||||
ponce_repo_name: [ponce_repo, ponce_repo_path, ponce_repo_changelog],
|
||||
alien_repo_name: [alien_repo, alien_repo_path, alien_repo_changelog],
|
||||
multilib_repo_name: [multilib_repo, multilib_repo_path, multilib_repo_changelog],
|
||||
restricted_repo_name: [restricted_repo, restricted_repo_path, restricted_repo_changelog],
|
||||
gnome_repo_name: [gnome_repo, gnome_repo_path, gnome_repo_changelog],
|
||||
msb_repo_name: [msb_repo, msb_repo_path, msb_repo_changelog],
|
||||
conraid_repo_name: [conraid_repo, conraid_repo_path, conraid_repo_changelog],
|
||||
slackonly_repo_name: [slackonly_repo, slackonly_repo_path, slackonly_repo_changelog]
|
||||
slackonly_repo_name: [slackonly_repo, slackonly_repo_path, slackonly_repo_changelog],
|
||||
ponce_bin_repo_name: [ponce_bin_repo, ponce_bin_repo_path, ponce_bin_repo_changelog],
|
||||
salixos_repo_name: [salixos_repo, salixos_repo_path, salixos_repo_changelog],
|
||||
salixos_extra_repo_name: [salixos_extra_repo_name, salixos_extra_repo_path, salixos_extra_repo_changelog],
|
||||
slackel_repo_name: [slackel_repo, slackel_repo_path, slackel_repo_changelog],
|
||||
slint_repo_name: [slint_repo, slint_repo_path, slint_repo_changelog]
|
||||
}
|
||||
|
||||
# All the binary repositories names.
|
||||
bin_repos_names = list(repos_dict.keys())[2:]
|
||||
|
||||
# All the enabled binary repositories names.
|
||||
for repo, enabled in repos_dict.items():
|
||||
if repo not in [sbo_repo_name, ponce_repo_name]:
|
||||
if enabled[0]:
|
||||
bin_enabled_repos.append(repo)
|
||||
|
|
|
@ -10,15 +10,23 @@ class Requires:
|
|||
|
||||
def __init__(self, name: str):
|
||||
self.name: str = name
|
||||
self.repo_slackbuilds_names: list = SBoQueries(self.name).sbos()
|
||||
|
||||
def resolve(self) -> list:
|
||||
""" Resolve the dependencies. """
|
||||
requires: list[str] = SBoQueries(self.name).requires() # type: ignore
|
||||
requires: list[str] = SBoQueries(self.name).requires()
|
||||
|
||||
for req in requires:
|
||||
|
||||
# Remove requirements that are included as dependencies,
|
||||
# but are not included in the repository.
|
||||
if req not in self.repo_slackbuilds_names:
|
||||
requires.remove(req)
|
||||
|
||||
if req:
|
||||
sub: list[str] = SBoQueries(req).requires() # type: ignore
|
||||
for s in sub:
|
||||
requires.append(s)
|
||||
sub_requires: list[str] = SBoQueries(req).requires()
|
||||
for sub in sub_requires:
|
||||
requires.append(sub)
|
||||
|
||||
requires.reverse()
|
||||
|
||||
|
|
|
@ -29,6 +29,13 @@ class SBoQueries(Configs):
|
|||
if self.repos.ponce_repo:
|
||||
self.sbo_table = PonceTable
|
||||
|
||||
def count_packages(self):
|
||||
""" Counts the number of the packages. """
|
||||
count = self.session.query(
|
||||
self.sbo_table.id).count()
|
||||
|
||||
return count
|
||||
|
||||
def repo_name(self):
|
||||
""" Returns the repo name by the table. """
|
||||
table = inspect(self.sbo_table)
|
||||
|
|
|
@ -7,7 +7,6 @@ import shutil
|
|||
import subprocess
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
from collections import OrderedDict
|
||||
from multiprocessing import Process, cpu_count
|
||||
|
||||
|
@ -64,15 +63,13 @@ class Slackbuilds(Configs):
|
|||
self.flag_jobs: list = ['-j', '--jobs']
|
||||
self.flag_no_silent: list = ['-n', '--no-silent']
|
||||
|
||||
self.slackbuilds: list = self.utils.apply_package_pattern(self.flags, self.slackbuilds)
|
||||
|
||||
def execute(self) -> None:
|
||||
""" Starting build or install the slackbuilds. """
|
||||
self.creating_dictionary()
|
||||
|
||||
if not self.utils.is_option(self.flag_resolve_off, self.flags):
|
||||
self.creating_dependencies_for_build()
|
||||
|
||||
self.creating_main_for_build()
|
||||
|
||||
self.view_before_build()
|
||||
|
||||
start: float = time.time()
|
||||
|
@ -85,6 +82,9 @@ class Slackbuilds(Configs):
|
|||
def creating_dictionary(self) -> None:
|
||||
""" Dictionary with the main slackbuilds and dependencies. """
|
||||
for sbo in self.slackbuilds:
|
||||
if self.utils.is_option(self.flag_resolve_off, self.flags):
|
||||
self.sbos[sbo] = []
|
||||
else:
|
||||
self.sbos[sbo] = Requires(sbo).resolve()
|
||||
|
||||
def creating_dependencies_for_build(self) -> None:
|
||||
|
@ -92,15 +92,6 @@ class Slackbuilds(Configs):
|
|||
for deps in self.sbos.values():
|
||||
for dep in deps:
|
||||
|
||||
# Checks if dependency exists in the ponce repository.
|
||||
# Sometimes the dependency reference is in the .info file,
|
||||
# but there is not exist in the repository as a folder.
|
||||
if self.repos.ponce_repo:
|
||||
location: str = SBoQueries(dep).location()
|
||||
path_ponce_repo_package = Path(self.repos.ponce_repo_path, location, dep)
|
||||
if not path_ponce_repo_package.is_dir():
|
||||
continue
|
||||
|
||||
# Skip installed package when the option --skip-installed is applied.
|
||||
if (self.utils.is_option(self.flag_skip_installed, self.flags) and
|
||||
self.utils.is_package_installed(dep)):
|
||||
|
@ -136,12 +127,19 @@ class Slackbuilds(Configs):
|
|||
|
||||
self.view_message.question()
|
||||
|
||||
def is_not_for_skipped(self, sbo: str) -> Literal[True]:
|
||||
""" 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))
|
||||
def continue_build_or_install(self, name) -> bool:
|
||||
""" Skip installed package when the option --skip-installed is applied
|
||||
and continue to install if the package is upgradable or the --reinstall option
|
||||
applied.
|
||||
"""
|
||||
if self.mode == 'build':
|
||||
return True
|
||||
|
||||
if self.utils.is_option(self.flag_skip_installed, self.flags):
|
||||
return False
|
||||
|
||||
if self.upgrade.is_package_upgradeable(name) or self.utils.is_option(self.flag_reinstall, self.flags):
|
||||
return True
|
||||
|
||||
def prepare_slackbuilds_for_build(self) -> None:
|
||||
""" Downloads files and sources. """
|
||||
|
@ -150,7 +148,7 @@ class Slackbuilds(Configs):
|
|||
|
||||
for sbo in self.install_order:
|
||||
|
||||
if self.is_not_for_skipped(sbo):
|
||||
if self.continue_build_or_install(sbo):
|
||||
|
||||
build_path: Path = Path(self.build_path, sbo)
|
||||
|
||||
|
@ -203,12 +201,12 @@ class Slackbuilds(Configs):
|
|||
""" Build the slackbuilds and install. """
|
||||
for sbo in self.install_order:
|
||||
|
||||
if self.is_not_for_skipped(sbo):
|
||||
if self.continue_build_or_install(sbo):
|
||||
self.build_the_script(self.build_path, sbo)
|
||||
|
||||
if not self.mode == 'build':
|
||||
if self.mode in ['install', 'upgrade']:
|
||||
|
||||
pkg: str = self.creating_package_for_install(sbo)
|
||||
pkg: str = self.package_for_install(sbo)
|
||||
self.install_package(pkg)
|
||||
|
||||
if not self.utils.is_option(self.flag_resolve_off, self.flags):
|
||||
|
@ -271,9 +269,8 @@ class Slackbuilds(Configs):
|
|||
|
||||
self.multi_process(command, package, message)
|
||||
|
||||
def creating_package_for_install(self, name: str) -> str:
|
||||
""" Creating a list with all the finished packages for
|
||||
installation. """
|
||||
def package_for_install(self, name: str) -> str:
|
||||
""" Returns the package for install. """
|
||||
version: str = SBoQueries(name).version()
|
||||
|
||||
pattern: str = f'{name}-{version}*{self.repos.repo_tag}*'
|
||||
|
|
|
@ -28,7 +28,7 @@ class SearchPackage(Configs):
|
|||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
def package(self, packages: list, repo=None) -> None:
|
||||
""" Searching and print the matched slackbuilds. """
|
||||
""" Searching and print the matched packages. """
|
||||
matching: int = 0
|
||||
repository: str = ''
|
||||
|
||||
|
@ -37,7 +37,8 @@ class SearchPackage(Configs):
|
|||
|
||||
# Searching for binaries.
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
pkg_repo: tuple = BinQueries('', repo).all_package_name_with_repo()
|
||||
if repo == '*':
|
||||
pkg_repo: tuple = BinQueries('', repo).all_package_names_from_repositories()
|
||||
|
||||
for pkg in packages:
|
||||
for pr in pkg_repo:
|
||||
|
@ -53,6 +54,21 @@ class SearchPackage(Configs):
|
|||
|
||||
print(f'{repository}{self.cyan}{pr[0]}{self.endc}-{self.yellow}{version}{self.endc}'
|
||||
f'{self.green}{desc}{self.endc}')
|
||||
else:
|
||||
pkg_repo: list = BinQueries('', repo).all_package_names_by_repo()
|
||||
|
||||
for pkg in packages:
|
||||
for pr in pkg_repo:
|
||||
|
||||
if pkg in pr or pkg == '*':
|
||||
matching += 1
|
||||
|
||||
desc: str = BinQueries(pr, repo).description()
|
||||
version: str = BinQueries(pr, repo).version()
|
||||
|
||||
print(f'{repository}{self.cyan}{pr}{self.endc}-{self.yellow}{version}{self.endc}'
|
||||
f'{self.green}{desc}{self.endc}')
|
||||
|
||||
else:
|
||||
# Searching for slackbuilds.
|
||||
names: list = SBoQueries('').sbos()
|
||||
|
|
|
@ -33,20 +33,23 @@ class Tracking(Configs):
|
|||
|
||||
def packages(self, packages: list, repo: str) -> None:
|
||||
""" Prints the packages dependencies. """
|
||||
print(f"The list below shows the packages with dependencies:\n")
|
||||
print(f"The list below shows the packages '{', '.join([p for p in packages])}' with dependencies:\n")
|
||||
|
||||
packages: list = self.utils.apply_package_pattern(self.flags, packages, repo)
|
||||
|
||||
char: str = f' {self.llc}{self.hl}'
|
||||
sp: str = ' ' * 4
|
||||
|
||||
for package in packages:
|
||||
pkg = f'{self.yellow}{package}{self.endc}'
|
||||
|
||||
if self.utils.is_option(self.flag_pkg_version, self.flags):
|
||||
version: str = SBoQueries(package).version()
|
||||
|
||||
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}'
|
||||
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()
|
||||
|
@ -55,24 +58,25 @@ class Tracking(Configs):
|
|||
|
||||
how_many: int = len(requires)
|
||||
|
||||
if not requires:
|
||||
requires: list = ['No dependencies']
|
||||
|
||||
print(pkg)
|
||||
print(char, end='')
|
||||
|
||||
if not requires:
|
||||
print(f' {self.cyan}No dependencies{self.endc}')
|
||||
else:
|
||||
for i, req in enumerate(requires, start=1):
|
||||
require: str = f'{self.cyan}{req}{self.endc}'
|
||||
|
||||
if self.utils.is_option(self.flag_pkg_version, self.flags):
|
||||
version: str = f"-{self.yellow}{SBoQueries(req).version()}{self.endc}"
|
||||
|
||||
version: str = f" {self.yellow}{SBoQueries(req).version()}{self.endc}"
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
version: str = f"-{self.yellow}{BinQueries(req, repo).version()}{self.endc}"
|
||||
version: str = f" {self.yellow}{BinQueries(req, repo).version()}{self.endc}"
|
||||
|
||||
require: str = f'{self.cyan}{req}{self.endc}{version}'
|
||||
|
||||
if i == 1:
|
||||
print(f' {self.cyan}{requires[0]}{self.endc}')
|
||||
print(f' {require}')
|
||||
else:
|
||||
print(f'{sp}{require}')
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ from slpkg.repositories import Repositories
|
|||
from slpkg.check_updates import CheckUpdates
|
||||
from slpkg.models.models import session as Session
|
||||
from slpkg.models.models import (Base, engine, SBoTable,
|
||||
PonceTable, BinariesTable)
|
||||
PonceTable, BinariesTable,
|
||||
LastRepoUpdated)
|
||||
|
||||
|
||||
class UpdateRepository(Configs):
|
||||
|
@ -56,14 +57,39 @@ class UpdateRepository(Configs):
|
|||
if self.repo == self.repos.alien_repo_name or self.repo == '*':
|
||||
self.alien_repository()
|
||||
|
||||
if self.repo == self.repos.multilib_repo_name or self.repo == '*':
|
||||
self.multilib_repository()
|
||||
|
||||
if self.repo == self.repos.restricted_repo_name or self.repo == '*':
|
||||
self.restricted_repository()
|
||||
|
||||
if self.repo == self.repos.gnome_repo_name or self.repo == '*':
|
||||
self.gnome_repository()
|
||||
|
||||
if self.repo == self.repos.msb_repo_name or self.repo == '*':
|
||||
self.msb_repository()
|
||||
|
||||
if self.repo == self.repos.conraid_repo_name or self.repo == '*':
|
||||
self.conraid_repository()
|
||||
|
||||
if self.repo == self.repos.slackonly_repo_name or self.repo == '*':
|
||||
self.slackonly_repository()
|
||||
|
||||
if self.repo == self.repos.ponce_bin_repo_name or self.repo == '*':
|
||||
self.ponce_bin_repository()
|
||||
|
||||
if self.repo == self.repos.salixos_repo_name or self.repo == '*':
|
||||
self.salixos_repository()
|
||||
|
||||
if self.repo == self.repos.salixos_extra_repo_name or self.repo == '*':
|
||||
self.salixos_extra_repository()
|
||||
|
||||
if self.repo == self.repos.slackel_repo_name or self.repo == '*':
|
||||
self.slackel_repository()
|
||||
|
||||
if self.repo == self.repos.slint_repo_name or self.repo == '*':
|
||||
self.slint_repository()
|
||||
|
||||
else:
|
||||
self.slackbuild_repositories()
|
||||
|
||||
|
@ -87,11 +113,66 @@ class UpdateRepository(Configs):
|
|||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.alien_repo_name)
|
||||
self.delete_last_updated(self.repos.alien_repo_name)
|
||||
self.data.install_alien_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.alien_repo_name)
|
||||
|
||||
def multilib_repository(self):
|
||||
if self.repos.multilib_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.multilib_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.multilib_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.multilib_repo_mirror}{self.repos.multilib_repo_packages}')
|
||||
urls.append(f'{self.repos.multilib_repo_changelog_mirror}{self.repos.multilib_repo_changelog}')
|
||||
urls.append(f'{self.repos.multilib_repo_mirror}{self.repos.multilib_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.multilib_repo_path, self.repos.multilib_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.multilib_repo_path, self.repos.multilib_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.multilib_repo_path, self.repos.multilib_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.multilib_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.multilib_repo_name)
|
||||
self.delete_last_updated(self.repos.multilib_repo_name)
|
||||
self.data.install_multilib_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.multilib_repo_name)
|
||||
|
||||
def restricted_repository(self):
|
||||
if self.repos.restricted_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.restricted_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.restricted_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.restricted_repo_mirror}{self.repos.restricted_repo_packages}')
|
||||
urls.append(f'{self.repos.restricted_repo_changelog_mirror}{self.repos.restricted_repo_changelog}')
|
||||
urls.append(f'{self.repos.restricted_repo_mirror}{self.repos.restricted_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.restricted_repo_path, self.repos.restricted_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.restricted_repo_path, self.repos.restricted_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.restricted_repo_path, self.repos.restricted_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.restricted_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.restricted_repo_name)
|
||||
self.delete_last_updated(self.repos.restricted_repo_name)
|
||||
self.data.install_restricted_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.restricted_repo_name)
|
||||
|
||||
def gnome_repository(self):
|
||||
if self.repos.gnome_repo:
|
||||
urls: list = []
|
||||
|
@ -112,11 +193,42 @@ class UpdateRepository(Configs):
|
|||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.gnome_repo_name)
|
||||
self.delete_last_updated(self.repos.gnome_repo_name)
|
||||
self.data.install_gnome_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.gnome_repo_name)
|
||||
|
||||
def msb_repository(self):
|
||||
if self.repos.msb_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.msb_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.msb_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.msb_repo_mirror}{self.repos.msb_repo_packages}')
|
||||
urls.append(f'{self.repos.msb_repo_changelog_mirror}{self.repos.msb_repo_changelog}')
|
||||
urls.append(f'{self.repos.msb_repo_mirror}{self.repos.msb_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.msb_repo_path,
|
||||
self.repos.msb_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.msb_repo_path,
|
||||
self.repos.msb_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.msb_repo_path,
|
||||
self.repos.msb_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.msb_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.msb_repo_name)
|
||||
self.delete_last_updated(self.repos.msb_repo_name)
|
||||
self.data.install_msb_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.msb_repo_name)
|
||||
|
||||
def conraid_repository(self):
|
||||
if self.repos.conraid_repo:
|
||||
urls: list = []
|
||||
|
@ -138,6 +250,7 @@ class UpdateRepository(Configs):
|
|||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.conraid_repo_name)
|
||||
self.delete_last_updated(self.repos.conraid_repo_name)
|
||||
self.data.install_conraid_data()
|
||||
print()
|
||||
else:
|
||||
|
@ -164,11 +277,150 @@ class UpdateRepository(Configs):
|
|||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.slackonly_repo_name)
|
||||
self.delete_last_updated(self.repos.slackonly_repo_name)
|
||||
self.data.install_slackonly_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.slackonly_repo_name)
|
||||
|
||||
def ponce_bin_repository(self):
|
||||
if self.repos.ponce_bin_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.ponce_bin_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.ponce_bin_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.ponce_bin_repo_mirror}{self.repos.ponce_bin_repo_packages}')
|
||||
urls.append(f'{self.repos.ponce_bin_repo_mirror}{self.repos.ponce_bin_repo_changelog}')
|
||||
urls.append(f'{self.repos.ponce_bin_repo_mirror}{self.repos.ponce_bin_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.ponce_bin_repo_path, self.repos.ponce_bin_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.ponce_bin_repo_path, self.repos.ponce_bin_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.ponce_bin_repo_path, self.repos.ponce_bin_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.ponce_bin_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.ponce_bin_repo_name)
|
||||
self.delete_last_updated(self.repos.ponce_bin_repo_name)
|
||||
self.data.install_ponce_bin_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.ponce_bin_repo_name)
|
||||
|
||||
def salixos_repository(self):
|
||||
if self.repos.salixos_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.salixos_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.salixos_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.salixos_repo_mirror}{self.repos.salixos_repo_packages}')
|
||||
urls.append(f'{self.repos.salixos_repo_mirror}{self.repos.salixos_repo_changelog}')
|
||||
urls.append(f'{self.repos.salixos_repo_mirror}{self.repos.salixos_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.salixos_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.salixos_repo_name)
|
||||
self.delete_last_updated(self.repos.salixos_repo_name)
|
||||
self.data.install_salixos_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.salixos_repo_name)
|
||||
|
||||
def salixos_extra_repository(self):
|
||||
if self.repos.salixos_extra_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.salixos_extra_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.salixos_extra_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.salixos_extra_repo_packages_mirror}{self.repos.salixos_extra_repo_packages}')
|
||||
urls.append(f'{self.repos.salixos_extra_repo_mirror}{self.repos.salixos_extra_repo_changelog}')
|
||||
urls.append(f'{self.repos.salixos_extra_repo_mirror}{self.repos.salixos_extra_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.salixos_extra_repo_path,
|
||||
self.repos.salixos_extra_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.salixos_extra_repo_path,
|
||||
self.repos.salixos_extra_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.salixos_extra_repo_path,
|
||||
self.repos.salixos_extra_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.salixos_extra_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.salixos_extra_repo_name)
|
||||
self.delete_last_updated(self.repos.salixos_extra_repo_name)
|
||||
self.data.install_salixos_extra_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.salixos_extra_repo_name)
|
||||
|
||||
def slackel_repository(self):
|
||||
if self.repos.slackel_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.slackel_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.slackel_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.slackel_repo_mirror}{self.repos.slackel_repo_packages}')
|
||||
urls.append(f'{self.repos.slackel_repo_mirror}{self.repos.slackel_repo_changelog}')
|
||||
urls.append(f'{self.repos.slackel_repo_mirror}{self.repos.slackel_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.slackel_repo_path, self.repos.slackel_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.slackel_repo_path, self.repos.slackel_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.slackel_repo_path, self.repos.slackel_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.slackel_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.slackel_repo_name)
|
||||
self.delete_last_updated(self.repos.slackel_repo_name)
|
||||
self.data.install_slackel_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.slackel_repo_name)
|
||||
|
||||
def slint_repository(self):
|
||||
if self.repos.slint_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.slint_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.slint_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.slint_repo_mirror}{self.repos.slint_repo_packages}')
|
||||
urls.append(f'{self.repos.slint_repo_mirror}{self.repos.slint_repo_changelog}')
|
||||
urls.append(f'{self.repos.slint_repo_mirror}{self.repos.slint_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.slint_repo_path, self.repos.slint_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.slint_repo_path, self.repos.slint_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.slint_repo_path, self.repos.slint_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.slint_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.slint_repo_name)
|
||||
self.delete_last_updated(self.repos.slint_repo_name)
|
||||
self.data.install_slint_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.slint_repo_name)
|
||||
|
||||
def slackbuild_repositories(self):
|
||||
""" Update the slackbuild repositories. """
|
||||
if self.repos.ponce_repo:
|
||||
|
@ -192,6 +444,7 @@ class UpdateRepository(Configs):
|
|||
os.chdir(self.repos.ponce_repo_path)
|
||||
gen_command: str = f'./gen_sbo_txt.sh > {self.repos.ponce_repo_slackbuilds}'
|
||||
self.utils.process(gen_command)
|
||||
self.delete_last_updated(self.repos.ponce_repo_name)
|
||||
print('\n')
|
||||
|
||||
else:
|
||||
|
@ -205,6 +458,7 @@ class UpdateRepository(Configs):
|
|||
lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.sbo_repo_mirror} '
|
||||
f'{self.repos.sbo_repo_path}')
|
||||
self.utils.process(lftp_command)
|
||||
self.delete_last_updated(self.repos.sbo_repo_name)
|
||||
|
||||
self.delete_sbo_data()
|
||||
self.data.install_sbos_data()
|
||||
|
@ -277,6 +531,11 @@ class UpdateRepository(Configs):
|
|||
self.session.query(BinariesTable).where(BinariesTable.repo == repo).delete()
|
||||
self.session.commit()
|
||||
|
||||
def delete_last_updated(self, repo) -> None:
|
||||
""" Deletes the last updated date. """
|
||||
self.session.query(LastRepoUpdated).where(LastRepoUpdated.repo == repo).delete()
|
||||
self.session.commit()
|
||||
|
||||
def drop_the_tables(self):
|
||||
""" Drop all the tables from the database. """
|
||||
print(f'\n{self.prog_name}: {self.bred}WARNING{self.endc}: All the data from the database will be deleted!')
|
||||
|
@ -285,7 +544,8 @@ class UpdateRepository(Configs):
|
|||
tables: list = [
|
||||
PonceTable.__table__,
|
||||
SBoTable.__table__,
|
||||
BinariesTable.__table__
|
||||
BinariesTable.__table__,
|
||||
LastRepoUpdated.__table__
|
||||
]
|
||||
|
||||
Base.metadata.drop_all(bind=engine, tables=tables)
|
||||
|
|
|
@ -25,7 +25,7 @@ class Upgrade(Configs):
|
|||
def packages(self) -> Generator[str, None, None]:
|
||||
""" Compares version of packages and returns the maximum. """
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
repo_packages: list = BinQueries('', self.repo).all_package_names()
|
||||
repo_packages: list = BinQueries('', self.repo).all_package_names_by_repo()
|
||||
else:
|
||||
repo_packages: list = SBoQueries('').sbos()
|
||||
|
||||
|
@ -37,18 +37,20 @@ class Upgrade(Configs):
|
|||
if self.is_package_upgradeable(inst_package):
|
||||
yield inst_package
|
||||
|
||||
def is_package_upgradeable(self, package: str) -> bool:
|
||||
def is_package_upgradeable(self, name: str) -> bool:
|
||||
""" Checks for installed and upgradeable packages. """
|
||||
inst_package: str = self.utils.is_package_installed(package)
|
||||
inst_package: str = self.utils.is_package_installed(name)
|
||||
|
||||
if inst_package:
|
||||
inst_version: str = self.utils.split_binary_pkg(inst_package)[1]
|
||||
inst_build: str = self.utils.split_binary_pkg(inst_package)[3]
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
repo_package: str = BinQueries(package, self.repo).package_bin()
|
||||
return parse(repo_package[:-4]) > parse(inst_package)
|
||||
|
||||
repo_package: str = BinQueries(name, self.repo).package_bin()
|
||||
repo_version: str = BinQueries(name, self.repo).version()
|
||||
repo_build: str = self.utils.split_binary_pkg(repo_package)[3]
|
||||
else:
|
||||
repo_version: str = SBoQueries(package).version()
|
||||
repo_build: str = self.utils.read_sbo_build_tag(package)
|
||||
repo_version: str = SBoQueries(name).version()
|
||||
repo_build: str = self.utils.read_sbo_build_tag(name)
|
||||
|
||||
return parse(repo_version + repo_build) > parse(inst_version + inst_build)
|
||||
|
|
|
@ -6,12 +6,13 @@ import time
|
|||
import shutil
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import Generator, Any, Union
|
||||
from typing import Generator, Union
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.blacklist import Blacklist
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
class Utilities:
|
||||
|
@ -29,6 +30,7 @@ class Utilities:
|
|||
self.red: str = self.color['red']
|
||||
self.endc: str = self.color['endc']
|
||||
self.bred: str = f'{self.bold}{self.red}'
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
self.installed_packages: list = list(self.all_installed())
|
||||
self.installed_package_names: list = list(self.all_installed_names())
|
||||
|
@ -122,9 +124,11 @@ class Utilities:
|
|||
return ''.join(re.findall(r'\d+', line))
|
||||
|
||||
@staticmethod
|
||||
def is_option(flag: list, flags: list) -> Any:
|
||||
def is_option(flag: list, flags: list) -> bool:
|
||||
""" Checking for flags. """
|
||||
return [f for f in flag if f in flags]
|
||||
for f in flag:
|
||||
if f in flags:
|
||||
return True
|
||||
|
||||
def read_packages_from_file(self, file: Path) -> Generator:
|
||||
""" Reads packages from file and split these to list. """
|
||||
|
@ -140,13 +144,13 @@ class Utilities:
|
|||
|
||||
yield package
|
||||
|
||||
except FileNotFoundError as err:
|
||||
self.raise_error_message(str(err))
|
||||
except FileNotFoundError:
|
||||
self.raise_error_message(f"No such file or directory: '{file}'")
|
||||
|
||||
@staticmethod
|
||||
def read_file(file: Union[str, Path]) -> list:
|
||||
""" Reads the text file. """
|
||||
with open(file, 'r', encoding='utf-8') as f:
|
||||
with open(file, 'r', encoding='utf-8', errors='replace') as f:
|
||||
return f.readlines()
|
||||
|
||||
@staticmethod
|
||||
|
@ -178,3 +182,16 @@ class Utilities:
|
|||
unit: str = 'GB'
|
||||
|
||||
return f'{str(round(file_size, 2))} {unit}'
|
||||
|
||||
def apply_package_pattern(self, flags: list, packages: list, repo=None) -> list:
|
||||
""" Apply the pattern. """
|
||||
for pkg in packages:
|
||||
if pkg == '*':
|
||||
packages.remove(pkg)
|
||||
|
||||
if self.is_option(self.flag_bin_repository, flags):
|
||||
packages += BinQueries('', repo).all_package_names_by_repo()
|
||||
else:
|
||||
packages += SBoQueries('').sbos()
|
||||
|
||||
return packages
|
||||
|
|
|
@ -51,7 +51,7 @@ class Ascii(Configs):
|
|||
|
||||
def draw_package_title_box(self, message: str, title: str) -> None:
|
||||
""" Drawing package title box. """
|
||||
middle_title: int = int((self.columns / 2) - len(title) + 6)
|
||||
middle_title: int = int((self.columns / 2) - len(title) + 10)
|
||||
|
||||
print(f'{self.bgreen}{self.upper_left_corner}' + f'{self.horizontal_line}' * (self.columns - 2) +
|
||||
f'{self.upper_right_corner}')
|
||||
|
|
|
@ -70,7 +70,7 @@ class Usage(Configs):
|
|||
f' {self.cyan}-f, find{self.endc} [packages...] Find installed packages.\n'
|
||||
f' {self.cyan}-w, view{self.endc} [packages...] View packages from the repository.\n'
|
||||
f' {self.cyan}-s, search{self.endc} [packages...] Search packages from the repository.\n'
|
||||
f' {self.cyan}-e, dependees{self.endc} [packages...] Show which packages depend.\n'
|
||||
f' {self.cyan}-e, dependees{self.endc} [packages...] Show which packages depend on.\n'
|
||||
f' {self.cyan}-t, tracking{self.endc} [packages...] Tracking the packages dependencies.\n'
|
||||
f'\n{self.bold}OPTIONS:{self.endc}\n'
|
||||
f' {self.yellow}-y, --yes{self.endc} Answer Yes to all questions.\n'
|
||||
|
|
|
@ -25,7 +25,9 @@ class Help(Configs):
|
|||
help_commands: dict = {
|
||||
'update': "Updates the package list and the database.",
|
||||
'upgrade': "Upgrade all the installed packages if the newer version exists in the repository.",
|
||||
'check-updates': "Check if there is any news on the SlackBuild's ChangeLog.txt file.",
|
||||
'check-updates': "Check if there is any news on the repositories ChangeLog.txt file.",
|
||||
'repo-info': "View information related to repositories, such as which repositories are active, "
|
||||
"when they were upgraded, and how many packages they contain.",
|
||||
'configs': "Edit the configuration '/etc/slpkg/slpkg.toml' file.",
|
||||
'clean-logs': "Cleans dependencies log tracking. After that procedure you should remove dependencies "
|
||||
"by hand.",
|
||||
|
@ -42,13 +44,14 @@ class Help(Configs):
|
|||
'find': "Find your installed packages on your system.",
|
||||
'view': "View information packages from the repository and get everything in your terminal.",
|
||||
'search': "Search and match packages from the repository.",
|
||||
'dependees': "Show which SlackBuilds depend on.",
|
||||
'dependees': "Show which packages depend on.",
|
||||
'tracking': "Tracking the packages dependencies."
|
||||
}
|
||||
|
||||
help_commands['-u'] = help_commands['update']
|
||||
help_commands['-U'] = help_commands['upgrade']
|
||||
help_commands['-c'] = help_commands['check-updates']
|
||||
help_commands['-I'] = help_commands['repo-info']
|
||||
help_commands['-g'] = help_commands['configs']
|
||||
help_commands['-L'] = help_commands['clean-logs']
|
||||
help_commands['-D'] = help_commands['clean-tmp']
|
||||
|
|
|
@ -5,7 +5,7 @@ class Version:
|
|||
""" Print the version. """
|
||||
|
||||
def __init__(self):
|
||||
self.version_info: tuple = (4, 6, 2)
|
||||
self.version_info: tuple = ('r', 'c', 2)
|
||||
self.version: str = '{0}.{1}.{2}'.format(*self.version_info)
|
||||
self.license: str = 'MIT License'
|
||||
self.author: str = 'Dimitris Zlatanidis (dslackw)'
|
||||
|
|
|
@ -44,6 +44,8 @@ class ViewPackage(Configs):
|
|||
red: str = color['red']
|
||||
endc: str = color['endc']
|
||||
|
||||
packages: list = self.utils.apply_package_pattern(self.flags, packages)
|
||||
|
||||
for package in packages:
|
||||
|
||||
info: list = self.session.query(
|
||||
|
|
|
@ -207,7 +207,10 @@ class ViewMessage(Configs):
|
|||
|
||||
for pkg in packages:
|
||||
|
||||
upgradeable: bool = False
|
||||
if option != 'remove':
|
||||
upgradeable: bool = self.upgrade.is_package_upgradeable(pkg)
|
||||
|
||||
installed: str = self.utils.is_package_installed(pkg)
|
||||
|
||||
if not installed:
|
||||
|
|
Loading…
Reference in a new issue