mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Merge branch 'develop' into 'master'
Develop See merge request dslackw/slpkg!114
This commit is contained in:
commit
cd74dc5c34
51 changed files with 4461 additions and 890 deletions
|
@ -1,3 +1,13 @@
|
|||
4.6.2 - 17/03/2023
|
||||
Updated:
|
||||
- Checks for recurring options
|
||||
- Improve speed and quality
|
||||
Removed:
|
||||
- File pattern from cli menu
|
||||
Added:
|
||||
- Binaries support repositories
|
||||
- Repositories inforamtion
|
||||
|
||||
4.6.1 - 15/03/2023
|
||||
Updated:
|
||||
- For empty arguments
|
||||
|
|
29
README.rst
29
README.rst
|
@ -63,6 +63,7 @@ Usage
|
|||
-u, update Update the package lists.
|
||||
-U, upgrade Upgrade all the packages.
|
||||
-c, check-updates Check for news on ChangeLog.txt.
|
||||
-I, repo-info Prints the repositories information.
|
||||
-g, configs Edit the configuration file.
|
||||
-L, clean-logs Clean dependencies log tracking.
|
||||
-T, clean-data Clean all the repositories data
|
||||
|
@ -89,8 +90,8 @@ Usage
|
|||
-p, --pkg-version Print the repository package version.
|
||||
-G, --generate-only Generates only the SLACKBUILDS.TXT file.
|
||||
-P, --parallel Download files in parallel.
|
||||
-B, --bin-repo=[REPO] Set a binary repository.
|
||||
-z, --directory=PATH Download files to a specific path.
|
||||
-F, --file-pattern=PATTERN Include specific installed files.
|
||||
|
||||
-h, --help Show this message and exit.
|
||||
-v, --version Print version and exit.
|
||||
|
@ -109,6 +110,9 @@ Configuration files
|
|||
/etc/slpkg/slpkg.toml
|
||||
General configuration of slpkg
|
||||
|
||||
/etc/slpkg/repositories.toml
|
||||
Repositories configurations
|
||||
|
||||
/etc/slpkg/blacklist.toml
|
||||
Blacklist of packages
|
||||
|
||||
|
@ -116,11 +120,26 @@ Configuration files
|
|||
Repositories
|
||||
------------
|
||||
|
||||
Two repositories are supported, please read the config file.
|
||||
|
||||
- `slackbuilds <https://slackbuilds.org>`_ repository
|
||||
- `ponce <https://cgit.ponce.cc/slackbuilds/>`_ repository
|
||||
The supported repositories, please read the repositories configuration file.
|
||||
|
||||
- `Slackbuilds <https://slackbuilds.org>`_ repository.
|
||||
- `Ponce <https://cgit.ponce.cc/slackbuilds/>`_ repository.
|
||||
- `Slackware <https://slackware.uk/slackware/slackware64-15.0/>`_ repository.
|
||||
- `Slackware extra <https://slackware.uk/slackware/slackware64-15.0/extra/>`_ repository.
|
||||
- `Slackware patches <https://slackware.uk/slackware/slackware64-15.0/patches/>`_ repository.
|
||||
- `Alien <http://slackware.uk/people/alien/sbrepos/15.0/x86_64/>`_ repository.
|
||||
- `Multilib <https://slackware.nl/people/alien/multilib/15.0/>`_ repository.
|
||||
- `Restricted <https://slackware.nl/people/alien/restricted_sbrepos/15.0/x86_64/>`_ repository.
|
||||
- `Gnome <https://reddoglinux.ddns.net/linux/gnome/41.x/x86_64/>`_ repository.
|
||||
- `Msb <https://slackware.uk/msb/15.0/1.26/x86_64/>`_ repository.
|
||||
- `Csb <https://slackware.uk/csb/15.0/x86_64/>`_ repository.
|
||||
- `Conraid <https://slack.conraid.net/repository/slackware64-current/>`_ repository.
|
||||
- `Slackonly <https://packages.slackonly.com/pub/packages/15.0-x86_64/>`_ repository.
|
||||
- `Salix OS <https://download.salixos.org/x86_64/slackware-15.0/>`_ repository.
|
||||
- `Salix OS extra <https://download.salixos.org/x86_64/slackware-15.0/extra/>`_ repository.
|
||||
- `Salix OS patches <https://download.salixos.org/x86_64/slackware-15.0/patches/>`_ repository.
|
||||
- `Slackel OS <http://www.slackel.gr/repo/x86_64/current/>`_ repository.
|
||||
- `Slint OS <https://slackware.uk/slint/x86_64/slint-15.0/>`_ repository.
|
||||
|
||||
Donate
|
||||
------
|
||||
|
|
|
@ -14,8 +14,10 @@ class NewConfig:
|
|||
self.flags: list = flags
|
||||
self.etc_path: str = '/etc/slpkg'
|
||||
self.slpkg_config = Path(self.etc_path, 'slpkg.toml')
|
||||
self.repositories_config = Path(self.etc_path, 'repositories.toml')
|
||||
self.blacklist_config = Path(self.etc_path, 'blacklist.toml')
|
||||
self.slpkg_config_new = Path(self.etc_path, 'slpkg.toml.new')
|
||||
self.repositories_config_new = Path(self.etc_path, 'repositories.toml.new')
|
||||
self.blacklist_config_new = Path(self.etc_path, 'blacklist.toml.new')
|
||||
|
||||
self.color: dict = {}
|
||||
|
@ -59,12 +61,16 @@ class NewConfig:
|
|||
def check(self):
|
||||
""" Checks for .new files. """
|
||||
print('Checking for NEW configuration files...')
|
||||
if self.slpkg_config_new.is_file() or self.blacklist_config_new.is_file():
|
||||
if (self.slpkg_config_new.is_file() or self.blacklist_config_new.is_file()
|
||||
or self.repositories_config_new.is_file()):
|
||||
print('\nThere are NEW files:\n')
|
||||
|
||||
if self.slpkg_config_new.is_file():
|
||||
print(f"{self.bgreen:>12}{self.slpkg_config_new}{self.endc}")
|
||||
|
||||
if self.repositories_config_new.is_file():
|
||||
print(f"{self.bgreen:>12}{self.repositories_config_new}{self.endc}")
|
||||
|
||||
if self.blacklist_config_new.is_file():
|
||||
print(f"{self.bgreen:>12}{self.blacklist_config_new}{self.endc}")
|
||||
|
||||
|
@ -79,7 +85,8 @@ class NewConfig:
|
|||
|
||||
self.menu()
|
||||
|
||||
elif not self.slpkg_config_new.is_file() and not self.blacklist_config_new.is_file():
|
||||
elif (not self.slpkg_config_new.is_file() and not self.blacklist_config_new.is_file()
|
||||
and not self.repositories_config_new.is_file()):
|
||||
print(f"\n{'No .new files found.':>23}\n")
|
||||
|
||||
def menu(self):
|
||||
|
@ -109,6 +116,9 @@ class NewConfig:
|
|||
if self.slpkg_config_new.is_file():
|
||||
self.overwrite_config_file()
|
||||
|
||||
if self.repositories_config_new.is_file():
|
||||
self.overwrite_repositories_file()
|
||||
|
||||
if self.blacklist_config_new.is_file():
|
||||
self.overwrite_blacklist_file()
|
||||
print() # new line
|
||||
|
@ -122,6 +132,15 @@ class NewConfig:
|
|||
shutil.move(self.slpkg_config_new, self.slpkg_config)
|
||||
print(f"mv {self.slpkg_config_new} -> {self.green}{self.slpkg_config}{self.endc}")
|
||||
|
||||
def overwrite_repositories_file(self):
|
||||
""" Copy tne repositories.toml.new file and rename the old to .orig. """
|
||||
if self.slpkg_config.is_file():
|
||||
shutil.copy(self.repositories_config, f"{self.repositories_config}.orig")
|
||||
print(f"\ncp {self.green}{self.repositories_config}{self.endc} -> {self.repositories_config}.orig")
|
||||
|
||||
shutil.move(self.repositories_config_new, self.repositories_config)
|
||||
print(f"mv {self.repositories_config_new} -> {self.green}{self.repositories_config}{self.endc}")
|
||||
|
||||
def overwrite_blacklist_file(self):
|
||||
""" Copy tne blacklist.toml.new file and rename the old to .orig. """
|
||||
if self.blacklist_config.is_file():
|
||||
|
@ -134,17 +153,24 @@ class NewConfig:
|
|||
def remove(self):
|
||||
""" Removes the .new files. """
|
||||
print() # new line
|
||||
self.remove_config_file()
|
||||
self.remove_blacklist_file()
|
||||
self.remove_config_new_file()
|
||||
self.remove_repositories_new_file()
|
||||
self.remove_blacklist_new_file()
|
||||
print() # new line
|
||||
|
||||
def remove_config_file(self):
|
||||
def remove_config_new_file(self):
|
||||
""" Remove slpkg.toml.new file. """
|
||||
if self.slpkg_config_new.is_file():
|
||||
self.slpkg_config_new.unlink()
|
||||
print(f"rm {self.red}{self.slpkg_config_new}{self.endc}")
|
||||
|
||||
def remove_blacklist_file(self):
|
||||
def remove_repositories_new_file(self):
|
||||
""" Remove repositories.toml.new file. """
|
||||
if self.repositories_config_new.is_file():
|
||||
self.repositories_config_new.unlink()
|
||||
print(f"rm {self.red}{self.repositories_config_new}{self.endc}")
|
||||
|
||||
def remove_blacklist_new_file(self):
|
||||
""" Remove blacklist.toml.new file. """
|
||||
if self.blacklist_config_new.is_file():
|
||||
self.blacklist_config_new.unlink()
|
||||
|
@ -169,13 +195,33 @@ class NewConfig:
|
|||
print() # new line
|
||||
if make.lower() == 'r':
|
||||
print() # new line
|
||||
self.remove_config_file()
|
||||
self.remove_config_new_file()
|
||||
print() # new line
|
||||
if make.lower() == 'd':
|
||||
self.diff_files(self.slpkg_config_new, self.slpkg_config)
|
||||
if make.lower() == 'v':
|
||||
self.vimdiff(self.slpkg_config_new, self.slpkg_config)
|
||||
|
||||
if self.repositories_config_new.is_file():
|
||||
make = input(f'{self.bgreen}{self.repositories_config_new}{self.endc} - '
|
||||
f'({self.byellow}K{self.endc}/{self.byellow}O{self.endc}/'
|
||||
f'{self.byellow}R{self.endc}/{self.byellow}D{self.endc}/'
|
||||
f'{self.byellow}V{self.endc}): ')
|
||||
|
||||
if make.lower() == 'k':
|
||||
pass
|
||||
if make.lower() == 'o':
|
||||
self.overwrite_repositories_file()
|
||||
print() # new line
|
||||
if make.lower() == 'r':
|
||||
print() # new line
|
||||
self.remove_repositories_new_file()
|
||||
print() # new line
|
||||
if make.lower() == 'd':
|
||||
self.diff_files(self.repositories_config_new, self.repositories_config)
|
||||
if make.lower() == 'v':
|
||||
self.vimdiff(self.repositories_config_new, self.repositories_config)
|
||||
|
||||
if self.blacklist_config_new.is_file():
|
||||
make = input(f'{self.bgreen}{self.blacklist_config_new}{self.endc} - '
|
||||
f'({self.byellow}K{self.endc}/{self.byellow}O{self.endc}/'
|
||||
|
@ -189,7 +235,7 @@ class NewConfig:
|
|||
print() # new line
|
||||
if make.lower() == 'r':
|
||||
print() # new line
|
||||
self.remove_blacklist_file()
|
||||
self.remove_blacklist_new_file()
|
||||
print() # new line
|
||||
if make.lower() == 'd':
|
||||
self.diff_files(self.blacklist_config_new, self.blacklist_config)
|
||||
|
@ -197,7 +243,7 @@ class NewConfig:
|
|||
self.vimdiff(self.blacklist_config_new, self.blacklist_config)
|
||||
|
||||
@staticmethod
|
||||
def diff_files(file1, file2):
|
||||
def diff_files(file2, file1):
|
||||
""" Diff the .new and the current file. """
|
||||
with open(file1, 'r') as f1:
|
||||
with open(file2, 'r') as f2:
|
||||
|
|
190
configs/repositories.toml
Normal file
190
configs/repositories.toml
Normal file
|
@ -0,0 +1,190 @@
|
|||
################# REPOSITORIES CONFIGURATION FILE ######################
|
||||
# This is the configuration of repositories file. #
|
||||
# The philosophy behind this is to have two repositories for #
|
||||
# Slackbuilds one for the Slackware stable and one for the -current #
|
||||
# and many binaries for all versions. #
|
||||
# Set 'true' to 'PONCE_REPO' to switch Slackbuild.org repository. #
|
||||
# Set 'true' to the repositories you want to enable. #
|
||||
# Default is the 'sbo' Slackbuilds.org repository. #
|
||||
########################################################################
|
||||
|
||||
########################################################################
|
||||
# Note: Before using a repository, make sure you have read about it. #
|
||||
# Some repositories are for -current only. Change the mirror if #
|
||||
# it is necessary. The mirror should end with a slash '/'. #
|
||||
########################################################################
|
||||
|
||||
[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"
|
||||
SBO_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
SBO_REPO_TAR_SUFFIX = ".tar.gz"
|
||||
SBO_REPO_TAG = "_SBo"
|
||||
|
||||
# Repository for Slackware -current.
|
||||
PONCE_REPO = false
|
||||
PONCE_REPO_NAME = "ponce"
|
||||
PONCE_REPO_MIRROR = "https://cgit.ponce.cc/slackbuilds/plain/"
|
||||
PONCE_REPO_SLACKBUILDS = "SLACKBUILDS.TXT"
|
||||
PONCE_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
PONCE_REPO_TAG = "_SBo"
|
||||
|
||||
# Official repository for Slackware x86_64 15.0 stable.
|
||||
# For Slackware x86_64 -current:
|
||||
# https://slackware.uk/slackware/slackware64-current/
|
||||
SLACK_REPO = false
|
||||
SLACK_REPO_NAME = "slack"
|
||||
SLACK_REPO_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/"
|
||||
SLACK_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
SLACK_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
SLACK_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Official repository for Slackware patches x86_64 15.0 stable.
|
||||
# For Slackware patches x86_64 -current:
|
||||
# https://slackware.uk/slackware/slackware64-current/extra/
|
||||
SLACK_EXTRA_REPO = false
|
||||
SLACK_EXTRA_REPO_NAME = "slack_extra"
|
||||
SLACK_EXTRA_REPO_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/"
|
||||
SLACK_EXTRA_REPO_PACKAGES_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/extra/"
|
||||
SLACK_EXTRA_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
SLACK_EXTRA_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
SLACK_EXTRA_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Official repository for Slackware patches x86_64 15.0 stable.
|
||||
# For Slackware patches x86_64 -current:
|
||||
# https://slackware.uk/slackware/slackware64-current/patches/
|
||||
SLACK_PATCHES_REPO = false
|
||||
SLACK_PATCHES_REPO_NAME = "slack_patches"
|
||||
SLACK_PATCHES_REPO_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/"
|
||||
SLACK_PATCHES_REPO_PACKAGES_MIRROR = "https://slackware.uk/slackware/slackware64-15.0/patches/"
|
||||
SLACK_PATCHES_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
SLACK_PATCHES_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
SLACK_PATCHES_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for Slackware x86_64 15.0 stable.
|
||||
# For Slackware x86_64 -current:
|
||||
# http://slackware.uk/people/alien/sbrepos/current/x86_64/
|
||||
ALIEN_REPO = false
|
||||
ALIEN_REPO_NAME = "alien"
|
||||
ALIEN_REPO_MIRROR = "http://slackware.uk/people/alien/sbrepos/"
|
||||
ALIEN_REPO_PACKAGES_MIRROR = "http://slackware.uk/people/alien/sbrepos/15.0/x86_64/"
|
||||
ALIEN_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
ALIEN_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
ALIEN_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for Slackware x86_64 15.0 stable.
|
||||
# For Slackware x86_64 -current:
|
||||
# https://slackware.nl/people/alien/multilib/current/
|
||||
MULTILIB_REPO = false
|
||||
MULTILIB_REPO_NAME = "multilib"
|
||||
MULTILIB_REPO_MIRROR = "https://slackware.nl/people/alien/multilib/"
|
||||
MULTILIB_REPO_PACKAGES_MIRROR = "https://slackware.nl/people/alien/multilib/15.0/"
|
||||
MULTILIB_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
MULTILIB_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
MULTILIB_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for Slackware x86_64 15.0 stable.
|
||||
# For Slackware x86_64 -current:
|
||||
# https://slackware.nl/people/alien/restricted_sbrepos/current/x86_64/
|
||||
RESTRICTED_REPO = false
|
||||
RESTRICTED_REPO_NAME = "restricted"
|
||||
RESTRICTED_REPO_MIRROR = "https://slackware.nl/people/alien/restricted_sbrepos/"
|
||||
RESTRICTED_REPO_PACKAGES_MIRROR = "https://slackware.nl/people/alien/restricted_sbrepos/15.0/x86_64/"
|
||||
RESTRICTED_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
RESTRICTED_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
RESTRICTED_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for Slackware x86_64 15.0 stable.
|
||||
# For Slackware x86_64 -current:
|
||||
# https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/
|
||||
GNOME_REPO = false
|
||||
GNOME_REPO_NAME = "gnome"
|
||||
GNOME_REPO_MIRROR = "https://reddoglinux.ddns.net/linux/gnome/41.x/x86_64/"
|
||||
GNOME_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
GNOME_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
GNOME_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for Slackware x86_64 15.0 stable.
|
||||
# For Slackware x86_64 -current:
|
||||
# https://slackware.uk/msb/current/1.26/x86_64/
|
||||
MSB_REPO = false
|
||||
MSB_REPO_NAME = "msb"
|
||||
MSB_REPO_MIRROR = "https://slackware.uk/msb/"
|
||||
MSB_REPO_PACKAGES_MIRROR = 'https://slackware.uk/msb/15.0/1.26/x86_64/'
|
||||
MSB_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
MSB_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
MSB_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for Slackware x86_64 15.0 stable.
|
||||
# For Slackware x86_64 -current:
|
||||
# https://slackware.uk/csb/current/x86_64/
|
||||
CSB_REPO = false
|
||||
CSB_REPO_NAME = "csb"
|
||||
CSB_REPO_MIRROR = "https://slackware.uk/csb/"
|
||||
CSB_REPO_PACKAGES_MIRROR = 'https://slackware.uk/csb/15.0/x86_64/'
|
||||
CSB_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
CSB_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
CSB_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for Slackware x86_64 -current.
|
||||
CONRAID_REPO = false
|
||||
CONRAID_REPO_NAME = "conraid"
|
||||
CONRAID_REPO_MIRROR = "https://slack.conraid.net/repository/slackware64-current/"
|
||||
CONRAID_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
CONRAID_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
CONRAID_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for Slackware x86_64 15.0 stable.
|
||||
# For Slackware x86_64 -current:
|
||||
# https://packages.slackonly.com/pub/packages/current-x86_64/
|
||||
SLACKONLY_REPO = false
|
||||
SLACKONLY_REPO_NAME = "slackonly"
|
||||
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 Salix OS x86_64 15.0 stable.
|
||||
SALIXOS_REPO = false
|
||||
SALIXOS_REPO_NAME = "salixos"
|
||||
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 Salix OS x86_64 15.0 stable.
|
||||
SALIXOS_EXTRA_REPO = false
|
||||
SALIXOS_EXTRA_REPO_NAME = "salixos_extra"
|
||||
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 Salix OS x86_64 15.0 stable.
|
||||
SALIXOS_PATCHES_REPO = false
|
||||
SALIXOS_PATCHES_REPO_NAME = "salixos_patches"
|
||||
SALIXOS_PATCHES_REPO_MIRROR = "https://download.salixos.org/x86_64/slackware-15.0/"
|
||||
SALIXOS_PATCHES_REPO_PACKAGES_MIRROR = 'https://download.salixos.org/x86_64/slackware-15.0/patches/'
|
||||
SALIXOS_PATCHES_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
SALIXOS_PATCHES_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
SALIXOS_PATCHES_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for Slackel OS x86_64 -current.
|
||||
SLACKEL_REPO = false
|
||||
SLACKEL_REPO_NAME = "slackel"
|
||||
SLACKEL_REPO_MIRROR = "http://www.slackel.gr/repo/x86_64/current/"
|
||||
SLACKEL_REPO_PACKAGES = "PACKAGES.TXT"
|
||||
SLACKEL_REPO_CHECKSUMS = "CHECKSUMS.md5"
|
||||
SLACKEL_REPO_CHANGELOG = "ChangeLog.txt"
|
||||
|
||||
# Repository for Slackware x86_64 15.0 stable.
|
||||
SLINT_REPO = false
|
||||
SLINT_REPO_NAME = "slint"
|
||||
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"
|
|
@ -1,26 +1,20 @@
|
|||
[CONFIGS]
|
||||
# OS architecture by default.
|
||||
OS_ARCH = "x86_64"
|
||||
# Tmp path for slpkg.
|
||||
TMP_SLPKG = "/tmp/slpkg/"
|
||||
# Path for building source and the script.
|
||||
BUILD_PATH = "/tmp/slpkg/build/"
|
||||
# The name of the database. Default name is 'database.slpkg'.
|
||||
DATABASE_NAME = "database.slpkg"
|
||||
# Where the packages download.
|
||||
# This path working only with the command download.
|
||||
DOWNLOAD_ONLY_PATH = "/tmp/slpkg/"
|
||||
# File suffix for list packages.
|
||||
# Change here if you are going to use '.sqf' files.
|
||||
FILE_LIST_SUFFIX = ".pkgs"
|
||||
# Configs for displaying colorful menu. Default is true. [true/false].
|
||||
# Configs for displaying colorful menu. Default is true. [true/false]
|
||||
COLORS = true
|
||||
# Dialog is a program that will let you present a variety of questions or
|
||||
# display messages using dialog boxes from a shell script.
|
||||
# Default is true. [true/false].
|
||||
# Default is true. [true/false]
|
||||
DIALOG = true
|
||||
# If silent mode is true, it does not print the commands as they are executed.
|
||||
# Default is true. [true/false].
|
||||
# Default is true. [true/false]
|
||||
SILENT_MODE = true
|
||||
# Choose ascii printable characters.
|
||||
# If true, it uses the extended characters, otherwise the basic ones.
|
||||
|
@ -29,10 +23,11 @@
|
|||
# Set false to all the questions. If set false, option --yes will not work.
|
||||
# Default is true. [true/false].
|
||||
ASK_QUESTION = true
|
||||
# Download sources in parallel. Default is false. [true/false].
|
||||
# Download sources in parallel. Default is false. [true/false]
|
||||
PARALLEL_DOWNLOADS = false
|
||||
# Pass your file pattern here, instead, you can use '--file-pattern=' or '-F=' option.
|
||||
FILE_PATTERN = ""
|
||||
# Pass your file pattern here, if you want to work only with 'sbo' packages
|
||||
# add '*_SBo' pattern. Default is the '*'.
|
||||
FILE_PATTERN = "*"
|
||||
# There are 5 predefined spinners for the progress bar.
|
||||
# Default is pixel. [spinner/pie/moon/line/pixel]
|
||||
PROGRESS_SPINNER = "pixel"
|
||||
|
@ -40,25 +35,6 @@
|
|||
# Default is green. [green/violet/yellow/blue/cyan/grey/red]
|
||||
SPINNER_COLOR = "green"
|
||||
|
||||
# SLACKBUILDS.ORG REPOSITORY CONFIGS.
|
||||
SBO_REPO_PATH = "/var/lib/slpkg/repositories/sbo/"
|
||||
SBO_REPO_URL = "https://slackbuilds.org/slackbuilds/15.0/"
|
||||
SBO_TXT = "SLACKBUILDS.TXT"
|
||||
SBO_CHGLOG_TXT = "ChangeLog.txt"
|
||||
SBO_TAR_SUFFIX = ".tar.gz"
|
||||
SBO_REPO_TAG = "_SBo"
|
||||
|
||||
# PONCE REPOSITORY CONFIGS.
|
||||
# Set the 'PONCE_REPO = true' to switch to the ponce repository and
|
||||
# run 'slpkg update' to update the database if it is necessary.
|
||||
# Default is false. [true/false].
|
||||
PONCE_REPO = false
|
||||
PONCE_REPO_PATH = "/var/lib/slpkg/repositories/ponce/"
|
||||
PONCE_REPO_URL = "https://cgit.ponce.cc/slackbuilds/plain/"
|
||||
PONCE_TXT = "SLACKBUILDS.TXT"
|
||||
PONCE_CHGLOG_TXT = "ChangeLog.txt"
|
||||
PONCE_REPO_TAG = "_SBo"
|
||||
|
||||
# Slackware command for install packages, instead, you can use 'installpkg'.
|
||||
INSTALLPKG = "upgradepkg --install-new"
|
||||
# Slackware command to reinstall packages.
|
||||
|
@ -67,7 +43,7 @@
|
|||
REMOVEPKG = "removepkg"
|
||||
|
||||
# You can choose a downloader among wget, curl and lftp.
|
||||
# Default is wget. [wget/curl/lftp].
|
||||
# Default is wget. [wget/curl/lftp]
|
||||
DOWNLOADER = "wget"
|
||||
# Wget downloader options.
|
||||
# -c, --continue: resume getting a partially-downloaded file.
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
.TH slpkg 1 "Orestiada, Grèce" "slpkg 4.5.4" dslackw
|
||||
.TH slpkg 1 "Orestiada, Grèce" "slpkg 4.7.0" dslackw
|
||||
.SH NOM
|
||||
.P
|
||||
.B slpkg - [OPTIONS] [COMMANDE] <packages>.
|
||||
slpkg \- Package manager pour Slackware.
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
slpkg [-h|-v] [-u, update] [-U, upgrade] [-c, check-updates] [-g, configs] [-L, clean-logs] [-D, clean-tmp] [-b, build] [-i, install] [-d, download]
|
||||
slpkg \c
|
||||
[\fICOMMAND\fR] [\fIOPTIONS\fR] [\fIFILELIST|PACKAGES...\fR]
|
||||
.P
|
||||
slpkg [-h|-v] [-u, update] [-U, upgrade] [-c, check-updates] [-I, repo-info] [-g, configs] [-L, clean-logs]
|
||||
[-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, --directory=[PATH], -F, --file-pattern=[PATTERN]
|
||||
-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]
|
||||
.SH DESCRIPTION
|
||||
.P
|
||||
\fBSlpkg\fP est un gestionnaire de paquets logiciels qui \fBinstalle\fP, \fBmet à jour\fP et \fBsupprime\fP les paquets pour les systèmes basés sur \fBSlackware\fP.
|
||||
|
@ -32,11 +37,21 @@ Mettre à niveau tous les paquets installés si une version plus récente existe
|
|||
Vérifier si le fichier \fBChangeLog.txt\fP du SlackBuild contient des mises à jour.
|
||||
.RE
|
||||
.P
|
||||
.B -I, repo-info
|
||||
.RS
|
||||
Afficher les informations relatives aux dépôts, telles que les dépôts actifs, la date de leur mise à jour et le nombre de paquets qu'ils contiennent.
|
||||
.RE
|
||||
.P
|
||||
.B -L, clean-logs
|
||||
.RS
|
||||
Nettoyer les journaux de suivi de dépendances. \fBAttention\fP, après cette procédure vous devrez supprimer les dépendances à la main.
|
||||
.RE
|
||||
.P
|
||||
.B -T, clean-data
|
||||
.RS
|
||||
Il est parfois nécessaire de nettoyer toutes les données des dépôts de la base de données. Exécutez cette commande pour supprimer toutes les données et exécutez \fB'slpkg update'\fP pour les recréer.
|
||||
.RE
|
||||
.P
|
||||
.B -D, clean-tmp
|
||||
.RS
|
||||
Supprimer tous les scripts et sources des SlackBuilds téléchargés.
|
||||
|
@ -94,43 +109,43 @@ Suivi des dépendances des paquets.
|
|||
.RE
|
||||
.SH OPTIONS
|
||||
.P
|
||||
-y, --yes
|
||||
.B -y, --yes
|
||||
.RS
|
||||
Répondre \fBOui\fP à toutes les questions. (à utiliser avec: \fB-u, update, -U, upgrade, -L, clean-logs, -b, build,
|
||||
-i, install, -d, download\fP) (Non utilisée avec \fB-R, remove\fP, option supprimée pour des raisons de sécurité)
|
||||
.RE
|
||||
.P
|
||||
-j, --jobs
|
||||
.B -j, --jobs
|
||||
.RS
|
||||
Accélération des scripts SlackBuild. Lorsque l'indicateur \fB--jobs\fP est activé, slpkg détecte automatiquement le nombre de
|
||||
de processeurs et le saisit dans la variable \fBMAKEFLAGS\fP. Certains SlackBuilds échouent lorsque \fBMAKEFLAGS\fP est déclaré ou que
|
||||
le nombre de processeurs (-j) est supérieur à 1. (à utiliser avec: \fB-U, upgrade, build, -i, install\fP)
|
||||
.RE
|
||||
.P
|
||||
-o, --resolve-off
|
||||
.B -o, --resolve-off
|
||||
.RS
|
||||
Désactiver la résolution des dépendances. (à utiliser avec: \fB-U, upgrade, -b, build, -i, install\fP)
|
||||
.RE
|
||||
.P
|
||||
-r, --reinstall
|
||||
.B -r, --reinstall
|
||||
.RS
|
||||
Utilisez cette option si vous voulez mettre à niveau tous les paquets même si la même version est déjà installée.
|
||||
Ne saute pas les paquets déjà installés. (à utiliser avec: \fB-U, upgrade, -i, install\fP)
|
||||
.RE
|
||||
.P
|
||||
-k, --skip-installed
|
||||
.B -k, --skip-installed
|
||||
.RS
|
||||
Utilisez cette option si vous voulez éviter de construire et de réinstaller des paquets.
|
||||
Remarque : Cette option n'affecte que les dépendances. (à utiliser avec: \fB-i, install\fP)
|
||||
.RE
|
||||
.P
|
||||
-E, --full-reverse
|
||||
.B -E, --full-reverse
|
||||
.RS
|
||||
Dépendances inverses complètes. Ne fonctionne qu'avec la commande \fB-e, dependees\fP et montre aussi les \fBRequires\fP.
|
||||
(à utiliser avec: -e, dependees)
|
||||
.RE
|
||||
.P
|
||||
-S, --search
|
||||
.B -S, --search
|
||||
.RS
|
||||
Active l'utilitaire de dialogue pour rechercher des paquets dans le dépôt.
|
||||
Essayez par exemple : \fB`slpkg install python3 --search`\fP ou \fB`slpkg download python3 --search`\fP et ainsi de suite.
|
||||
|
@ -138,46 +153,73 @@ Essayez par exemple : \fB`slpkg install python3 --search`\fP ou \fB`slpkg downlo
|
|||
-s, search, -e, dependees, -t, tracking\fP)
|
||||
.RE
|
||||
.P
|
||||
-n, --no-silent
|
||||
.B -n, --no-silent
|
||||
.RS
|
||||
Désactiver le mode silencieux s'il est activé dans le fichier de configuration. (à utiliser avec: \fB-u, update, -U,upgrade, -b, build,
|
||||
-i, install, -d, download, -R, remove\fP)
|
||||
.RE
|
||||
.P
|
||||
-z, --directory=[PATH]
|
||||
.RS
|
||||
Définir le répertoire où seront enregistrés les fichiers téléchargés. (à utiliser avec: \fB-d, download\fP)
|
||||
.RE
|
||||
.P
|
||||
-p, --pkg-version
|
||||
.B -p, --pkg-version
|
||||
.RS
|
||||
Afficher la version du package du dépôt. (à utiliser avec: \fB-e, dependees, -t, tracking, -w, view\fP)
|
||||
.RE
|
||||
.P
|
||||
-F, --file-pattern=[PATTERN]
|
||||
.B -G, --generate-only
|
||||
.RS
|
||||
Inclure des fichiers installés spécifiques avec un motif, comme \fB`slpkg -f 'python' --file-pattern='*'`\fP,
|
||||
et afficher tous les paquets installés qui incluent le nom 'python', et pas seulement les paquets SBo.
|
||||
Aussi, lorsque vous voulez installer et visualiser des paquets que vous avez installés à partir d'autres dépôts, essayez comme suit
|
||||
\fB`slpkg -i podman --file-pattern='*alien'`\fP ou si vous voulez vérifier et mettre à jour des paquets provenant d'autres dépôts
|
||||
\fB`slpkg upgrade --file-pattern='*alien'`\fP ou supprimez des paquets avec \fB`slpkg -R <packages> --file-pattern='*'`\fP.
|
||||
(à utiliser avec : \fB-U, upgrade, -i, install, -R, remove, -f, find\fP)
|
||||
N'est utilisé qu'avec le dépôt ponce et lorsque vous souhaitez générer uniquement le fichier SLACKBUILDS.TXT
|
||||
et mettre à jour la base de données, sans re-télécharger l'ensemble du référentiel. (à utiliser avec : -u, update)
|
||||
.RE
|
||||
.P
|
||||
-h | --help
|
||||
.B -P, --parallel
|
||||
.RS
|
||||
Télécharger des fichiers en parallèle pour accélérer le processus.
|
||||
(à utiliser avec: -u, update, -U, upgrade, -b, build, -i, install, -d, download)
|
||||
.RE
|
||||
.P
|
||||
.BI "-B," "" " \-\-bin-repo=[" REPO "]
|
||||
.RS
|
||||
Passer aux dépôts de binaires et sélectionner un dépôt.
|
||||
Exemple: '\fIslpkg -i audacity --bin=repo=alien\fR'.
|
||||
(à utiliser avec: -u, update, -U, upgrade, -i, install, -d, download, -s, search, -t, tracking, -e, dependees)
|
||||
.RE
|
||||
.P
|
||||
.B -z, --directory=[PATH]
|
||||
.RS
|
||||
Définir le répertoire où seront enregistrés les fichiers téléchargés. (à utiliser avec: \fB-d, download\fP)
|
||||
.RE
|
||||
.P
|
||||
.B -h | --help
|
||||
.RS
|
||||
Afficher l'aide.
|
||||
.RE
|
||||
.P
|
||||
-v | --version
|
||||
.B -v | --version
|
||||
.RS
|
||||
Afficher la version.
|
||||
.RE
|
||||
.SH OPTION SYNTAX
|
||||
.P
|
||||
En plus de la façon classique, vous pouvez mettre ensemble plusieurs options qui ne nécessitent pas d'arguments, comme par exemple :
|
||||
.PP
|
||||
.Vb 1.
|
||||
\& slpkg -iPny [\fIPACKAGES...\fR]
|
||||
.Ve
|
||||
.RE
|
||||
.SH FILELIST|PACKAGES
|
||||
.P
|
||||
Au lieu de paquets, vous pouvez passer un fichier texte avec le suffixe '.pkgs' et les noms des paquets. Exemple : 'slpkg install list.pkgs'.
|
||||
Éditer la configuration '/etc/slpkg/slpkg.toml' pour changer le suffixe si vous le souhaitez. Vous pouvez utiliser des listes provenant d'autres sources, avec des fichiers '.sqf'.
|
||||
.RE
|
||||
.SH FICHIERS DE CONFIGURATION
|
||||
.P
|
||||
Fichier de \fBconfiguration\fP : /etc/slpkg/slpkg.toml
|
||||
.RE
|
||||
.P
|
||||
Fichier des \fBdépôts\fP : /etc/slpkg/repositories.toml
|
||||
.P
|
||||
Fichier \fBblacklist\fP : /etc/slpkg/blacklist.toml
|
||||
.P
|
||||
\fIslpkg_new-config\fR permet de gérer les fichiers de configuration \fB.new\fP facilement et rapidement. Déplacez, copiez ou supprimez-les.
|
||||
.RE
|
||||
.SH RAPPORT DE BOGUES
|
||||
.P
|
||||
Veuillez signaler tout bogue trouvé à \fBhttps://gitlab.com/dslackw/slpkg/-/issues\fP.
|
||||
|
|
41
man/slpkg.1
41
man/slpkg.1
|
@ -1,17 +1,17 @@
|
|||
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.6.1" dslackw
|
||||
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.7.0" dslackw
|
||||
.SH NAME
|
||||
.P
|
||||
slpkg \- Package manager utility for Slackware.
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
slpkg \c
|
||||
[\fIOPTIONS\fR] [\fICOMMAND\fR] [\fIFILELIST|PACKAGES...\fR]
|
||||
[\fICOMMAND\fR] [\fIOPTIONS\fR] [\fIFILELIST|PACKAGES...\fR]
|
||||
.P
|
||||
slpkg [-h|-v] [-u, update] [-U, upgrade] [-c, check-updates] [-g, configs] [-L, clean-logs]
|
||||
slpkg [-h|-v] [-u, update] [-U, upgrade] [-c, check-updates] [-I, repo-info] [-g, configs] [-L, clean-logs]
|
||||
[-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, -z, --directory=[\fIPATH\fR], -F, --file-pattern=[\fIPATTERN\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,7 +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
|
||||
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
|
||||
|
@ -126,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
|
||||
|
@ -152,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
|
||||
|
@ -173,21 +179,19 @@ Download files in parallel to speed up the process.
|
|||
(to be used with: -u, update, -U, upgrade, -b, build, -i, install, -d, download)
|
||||
.RE
|
||||
.P
|
||||
.BI "-B," "" " \-\-bin-repo=[" REPO "]
|
||||
.RS
|
||||
Switch to binaries repositories and select a repository.
|
||||
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
|
||||
.BI "-z," "" " \-\-directory=[" PATH "]
|
||||
.RS
|
||||
The directory is the path where the files will be saved. (to be used with: -d, download)
|
||||
.RE
|
||||
.P
|
||||
.BI "-F," "" " \-\-file-pattern=[" PATTERN "]
|
||||
.RS
|
||||
Include specific installed files with a pattern, such as '\fIslpkg -f 'python --file-pattern="*"\fR',
|
||||
and prints all installed packages that include the name 'python', not only the SBo packages.
|
||||
Also when you want to install and view packages that you have installed from other repositories, try like
|
||||
'\fIslpkg -i podman --file-pattern="*alien"\fR' or if you want to check and upgrade packages from other repositories
|
||||
'\fIslpkg upgrade --file-pattern="*alien"\fR' or remove packages with '\fIslpkg -R [PACKAGES...] --file-pattern="*"\fR'.
|
||||
(to be used with: -U, upgrade, -i, install, -R, remove, -f, find)
|
||||
.RE
|
||||
.P
|
||||
.B -h | --help
|
||||
.RS
|
||||
Show help information and exit.
|
||||
|
@ -213,7 +217,8 @@ Edit the config '/etc/slpkg/slpkg.toml' file to change the suffix if you want. Y
|
|||
.SH CONFIGURATION FILES
|
||||
.P
|
||||
Configuration file in the /etc/slpkg/slpkg.toml file.
|
||||
.RE
|
||||
.P
|
||||
Repositories file in the /etc/slpkg/repositories.toml file.
|
||||
.P
|
||||
Blacklist file in the /etc/slpkg/blacklist.toml file.
|
||||
.P
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = slpkg
|
||||
version = 4.6.1
|
||||
version = r.c.3
|
||||
license_file = LICENSE
|
||||
author = Dimitris Zlatanidis
|
||||
author_email = d.zlatanidis@gmail.com
|
||||
|
@ -18,8 +18,6 @@ classifiers =
|
|||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3 :: Only
|
||||
Programming Language :: Python :: 3.7
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
Programming Language :: Unix Shell
|
||||
|
@ -36,7 +34,9 @@ packages =
|
|||
slpkg
|
||||
slpkg.models
|
||||
slpkg.views
|
||||
python_requires = >=3.7
|
||||
slpkg.sbos
|
||||
slpkg.binaries
|
||||
python_requires = >= 3.9
|
||||
install_requires =
|
||||
SQLAlchemy >= 1.4.46
|
||||
pythondialog >= 3.5.3
|
||||
|
|
|
@ -9,6 +9,7 @@ config() {
|
|||
}
|
||||
|
||||
config etc/slpkg/slpkg.toml.new
|
||||
config etc/slpkg/repositories.toml.new
|
||||
config etc/slpkg/blacklist.toml.new
|
||||
|
||||
if [ -x /usr/bin/update-desktop-database ]; then
|
||||
|
|
|
@ -99,6 +99,7 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr
|
|||
# Install configuration files and creating lib directory
|
||||
mkdir -p $PKG/etc/$PRGNAM
|
||||
install -D -m0644 configs/slpkg.toml $PKG/etc/slpkg/slpkg.toml.new
|
||||
install -D -m0644 configs/repositories.toml $PKG/etc/slpkg/repositories.toml.new
|
||||
install -D -m0644 configs/blacklist.toml $PKG/etc/slpkg/blacklist.toml.new
|
||||
|
||||
mkdir -p $PKG/var/lib/$PRGNAM/repositories/ponce
|
||||
|
|
0
slpkg/binaries/__init__.py
Normal file
0
slpkg/binaries/__init__.py
Normal file
255
slpkg/binaries/install.py
Normal file
255
slpkg/binaries/install.py
Normal file
|
@ -0,0 +1,255 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
from multiprocessing import Process
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.checksum import Md5sum
|
||||
from slpkg.upgrade import Upgrade
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.dialog_box import DialogBox
|
||||
from slpkg.downloader import Downloader
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.progress_bar import ProgressBar
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.required import Required
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
from slpkg.models.models import LogsDependencies
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
class Packages(Configs):
|
||||
|
||||
def __init__(self, packages: list, flags: list, repo: str, mode: str):
|
||||
super(Configs, self).__init__()
|
||||
self.packages: list = packages
|
||||
self.flags: list = flags
|
||||
self.repo: str = repo
|
||||
self.mode: str = mode
|
||||
|
||||
self.progress = ProgressBar()
|
||||
self.color = self.colour()
|
||||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
self.dialogbox = DialogBox()
|
||||
self.upgrade = Upgrade(self.flags, self.repo)
|
||||
self.view_message = ViewMessage(self.flags, self.repo)
|
||||
self.session = Session
|
||||
|
||||
self.output: int = 0
|
||||
self.stderr = None
|
||||
self.stdout = None
|
||||
self.process_message: str = ''
|
||||
self.bold: str = self.color['bold']
|
||||
self.cyan: str = self.color['cyan']
|
||||
self.red: str = self.color['red']
|
||||
self.yellow: str = self.color['yellow']
|
||||
self.endc: str = self.color['endc']
|
||||
self.byellow: str = f'{self.bold}{self.yellow}'
|
||||
self.bred: str = f'{self.bold}{self.red}'
|
||||
|
||||
self.packages_requires: list = []
|
||||
self.install_order: list = []
|
||||
self.binary_packages: list = []
|
||||
self.flag_reinstall: list = ['-r', '--reinstall']
|
||||
self.flag_skip_installed: list = ['-k', '--skip-installed']
|
||||
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()
|
||||
|
||||
self.view_message.install_packages(self.packages, self.packages_requires, self.mode)
|
||||
self.view_message.question()
|
||||
|
||||
start: float = time.time()
|
||||
self.download()
|
||||
self.checksum()
|
||||
self.install_packages()
|
||||
elapsed_time: float = time.time() - start
|
||||
|
||||
self.utils.finished_time(elapsed_time)
|
||||
|
||||
def dependencies(self):
|
||||
""" Creating the dependencies list and the order for install. """
|
||||
requires: list = []
|
||||
|
||||
if not self.utils.is_option(self.flag_resolve_off, self.flags):
|
||||
|
||||
for pkg in self.packages:
|
||||
self.packages_requires += Required(pkg, self.repo).resolve()
|
||||
|
||||
# Clean dependencies from the dependencies list if already added with main packages.
|
||||
for req in self.packages_requires:
|
||||
if req not in self.packages:
|
||||
requires.append(req)
|
||||
|
||||
requires = list(set(requires))
|
||||
|
||||
if requires:
|
||||
self.packages_requires = self.choose_dependencies(requires)
|
||||
|
||||
self.install_order = [*self.packages_requires, *self.packages]
|
||||
|
||||
def download(self) -> None:
|
||||
""" Download packages from the repositories. """
|
||||
pkg_urls: list = []
|
||||
|
||||
for pkg in self.install_order:
|
||||
|
||||
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()
|
||||
|
||||
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 = BinQueries(pkg, self.repo).version()
|
||||
self.view_message.view_skipping_packages(pkg, version)
|
||||
|
||||
if pkg_urls:
|
||||
down = Downloader(self.tmp_slpkg, pkg_urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
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 self.upgrade.is_package_upgradeable(name) or self.utils.is_option(self.flag_reinstall, self.flags):
|
||||
return True
|
||||
|
||||
def checksum(self) -> None:
|
||||
""" Packages checksums. """
|
||||
md5 = Md5sum(self.flags)
|
||||
for package in self.binary_packages:
|
||||
pkg_checksum: str = BinQueries(package, self.repo).package_checksum()
|
||||
md5.check(self.tmp_slpkg, package, pkg_checksum)
|
||||
|
||||
def install_packages(self) -> None:
|
||||
""" Install the packages. """
|
||||
slack_command: str = self.installpkg
|
||||
if self.utils.is_option(self.flag_reinstall, self.flags) or self.mode == 'upgrade':
|
||||
slack_command: str = self.reinstall
|
||||
|
||||
message: str = f'{self.cyan}Installing{self.endc}'
|
||||
|
||||
for package in self.binary_packages:
|
||||
self.process_message: str = f"package '{package}' to install"
|
||||
command: str = f'{slack_command} {self.tmp_slpkg}/{package}'
|
||||
|
||||
self.multi_process(command, package, message)
|
||||
|
||||
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:
|
||||
""" Logging installed dependencies and used for remove. """
|
||||
exist = self.session.query(LogsDependencies.name).filter(
|
||||
LogsDependencies.name == name).first()
|
||||
|
||||
requires: list = Required(name, self.repo).resolve()
|
||||
|
||||
# Update the dependencies if exist else create it.
|
||||
if exist:
|
||||
self.session.query(
|
||||
LogsDependencies).filter(
|
||||
LogsDependencies.name == name).update(
|
||||
{LogsDependencies.requires: ' '.join(requires)})
|
||||
|
||||
elif requires:
|
||||
deps: list = LogsDependencies(name=name, requires=' '.join(requires))
|
||||
self.session.add(deps)
|
||||
self.session.commit()
|
||||
|
||||
def multi_process(self, command: str, filename: str, message: str) -> None:
|
||||
""" Starting multiprocessing install/upgrade process. """
|
||||
if self.silent_mode and not self.utils.is_option(self.flag_no_silent, self.flags):
|
||||
|
||||
done: str = f' {self.byellow} Done{self.endc}'
|
||||
self.stderr = subprocess.DEVNULL
|
||||
self.stdout = subprocess.DEVNULL
|
||||
|
||||
# Starting multiprocessing
|
||||
p1 = Process(target=self.utils.process, args=(command, self.stderr, self.stdout))
|
||||
p2 = Process(target=self.progress.bar, args=(f'[{message}]', filename))
|
||||
|
||||
p1.start()
|
||||
p2.start()
|
||||
|
||||
# Wait until process 1 finish
|
||||
p1.join()
|
||||
|
||||
# Terminate process 2 if process 1 finished
|
||||
if not p1.is_alive():
|
||||
|
||||
if p1.exitcode != 0:
|
||||
done: str = f'{self.bred}Failed: {self.endc}{self.process_message}.'
|
||||
self.output: int = p1.exitcode # type: ignore
|
||||
|
||||
print(f'{self.endc}{done}', end='')
|
||||
p2.terminate()
|
||||
|
||||
# Wait until process 2 finish
|
||||
p2.join()
|
||||
|
||||
# Restore the terminal cursor
|
||||
print('\x1b[?25h', self.endc)
|
||||
else:
|
||||
self.utils.process(command, self.stderr, self.stdout)
|
||||
|
||||
self.print_error()
|
||||
|
||||
def print_error(self) -> None:
|
||||
""" Stop the process and print the error message. """
|
||||
if self.output != 0:
|
||||
self.utils.raise_error_message(f"{self.output}: {self.process_message}")
|
||||
|
||||
def choose_dependencies(self, dependencies: list) -> list:
|
||||
""" Choose packages for install. """
|
||||
height: int = 10
|
||||
width: int = 70
|
||||
list_height: int = 0
|
||||
choices: list = []
|
||||
title: str = ' Choose dependencies you want to install '
|
||||
|
||||
for package in dependencies:
|
||||
status: bool = False
|
||||
|
||||
repo_ver: str = BinQueries(package, self.repo).version()
|
||||
help_text: str = f'Package: {package} {repo_ver}'
|
||||
upgradable: bool = self.upgrade.is_package_upgradeable(package)
|
||||
|
||||
if self.mode == 'upgrade' and upgradable:
|
||||
status: bool = True
|
||||
|
||||
if self.mode == 'install' and upgradable:
|
||||
status: bool = True
|
||||
|
||||
choices += [(package, repo_ver, status, help_text)]
|
||||
|
||||
text: str = f'There are {len(choices)} dependencies:'
|
||||
|
||||
code, tags = self.dialogbox.checklist(text, dependencies, title, height,
|
||||
width, list_height, choices)
|
||||
|
||||
if not code:
|
||||
return dependencies
|
||||
|
||||
os.system('clear')
|
||||
|
||||
return tags
|
215
slpkg/binaries/queries.py
Normal file
215
slpkg/binaries/queries.py
Normal file
|
@ -0,0 +1,215 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Union
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.blacklist import Blacklist
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import BinariesTable
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
class BinQueries(Configs):
|
||||
""" Queries class for the sbo repository. """
|
||||
|
||||
def __init__(self, name: str, repo: str):
|
||||
super(Configs, self).__init__()
|
||||
self.name: str = name
|
||||
self.repo: str = repo
|
||||
self.session = Session
|
||||
self.repos = Repositories()
|
||||
|
||||
self.black = Blacklist()
|
||||
if self.name in self.black.packages():
|
||||
self.name: str = ''
|
||||
|
||||
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(
|
||||
BinariesTable.repo == self.repo).all()
|
||||
|
||||
return [pkg[0] for pkg in pkgs]
|
||||
|
||||
def all_binaries_packages_by_repo(self) -> list:
|
||||
""" Returns all the binaries packages. """
|
||||
pkgs: tuple = self.session.query(
|
||||
BinariesTable.package).where(
|
||||
BinariesTable.repo == self.repo).all()
|
||||
|
||||
return [pkg[0] for pkg in pkgs]
|
||||
|
||||
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.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(
|
||||
BinariesTable.repo).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if repository:
|
||||
return repository[0]
|
||||
return ''
|
||||
|
||||
def package_name(self) -> str:
|
||||
""" Returns the package name. """
|
||||
pkg: tuple = self.session.query(
|
||||
BinariesTable.name).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if pkg:
|
||||
return pkg[0]
|
||||
return ''
|
||||
|
||||
def package_bin(self) -> str:
|
||||
""" Returns the binary package. """
|
||||
pkg: tuple = self.session.query(
|
||||
BinariesTable.package).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if pkg:
|
||||
return pkg[0]
|
||||
return ''
|
||||
|
||||
def package_checksum(self) -> str:
|
||||
""" Returns the binary package checksum. """
|
||||
md5: tuple = self.session.query(
|
||||
BinariesTable.checksum).filter(
|
||||
BinariesTable.package == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if md5:
|
||||
return md5[0]
|
||||
return ''
|
||||
|
||||
def version(self) -> str:
|
||||
""" Returns the package version. """
|
||||
pkg: tuple = self.session.query(
|
||||
BinariesTable.version).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if pkg:
|
||||
return pkg[0]
|
||||
return ''
|
||||
|
||||
def mirror(self) -> str:
|
||||
""" Returns the package mirror. """
|
||||
mir: tuple = self.session.query(
|
||||
BinariesTable.mirror).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if mir:
|
||||
return mir[0]
|
||||
return ''
|
||||
|
||||
def location(self) -> str:
|
||||
""" Returns the package location. """
|
||||
loc: tuple = self.session.query(
|
||||
BinariesTable.location).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if loc:
|
||||
return loc[0]
|
||||
return ''
|
||||
|
||||
def size_comp(self) -> str:
|
||||
""" Returns the package comp size. """
|
||||
size: tuple = self.session.query(
|
||||
BinariesTable.size_comp).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if size:
|
||||
return size[0]
|
||||
return ''
|
||||
|
||||
def unsize_comp(self) -> str:
|
||||
""" Returns the package uncomp size. """
|
||||
size: tuple = self.session.query(
|
||||
BinariesTable.unsize_comp).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if size:
|
||||
return size[0]
|
||||
return ''
|
||||
|
||||
def required(self) -> Union[list, list]:
|
||||
""" Returns the package required. """
|
||||
requires: tuple = self.session.query(
|
||||
BinariesTable.required).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if requires and not requires[0] is None:
|
||||
requires: list = requires[0].split()
|
||||
for req in requires:
|
||||
if req in self.black.packages():
|
||||
requires.remove(req)
|
||||
return requires
|
||||
return []
|
||||
|
||||
def conflicts(self) -> str:
|
||||
""" Returns the package conflicts. """
|
||||
con: tuple = self.session.query(
|
||||
BinariesTable.conflicts).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if con:
|
||||
return con[0]
|
||||
return ''
|
||||
|
||||
def suggests(self) -> str:
|
||||
""" Returns the package suggests. """
|
||||
sug: tuple = self.session.query(
|
||||
BinariesTable.suggests).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if sug:
|
||||
return sug[0]
|
||||
return ''
|
||||
|
||||
def description(self) -> str:
|
||||
""" Returns the package description. """
|
||||
desc: tuple = self.session.query(
|
||||
BinariesTable.description).filter(
|
||||
BinariesTable.name == self.name).where(
|
||||
BinariesTable.repo == self.repo).first()
|
||||
|
||||
if desc:
|
||||
return desc[0]
|
||||
return ''
|
58
slpkg/binaries/required.py
Normal file
58
slpkg/binaries/required.py
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
class Required:
|
||||
""" Creates a list of dependencies with
|
||||
the right order to install. """
|
||||
|
||||
def __init__(self, name: str, repo: str):
|
||||
self.name: str = name
|
||||
self.repo: str = repo
|
||||
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. """
|
||||
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)
|
||||
|
||||
if req:
|
||||
sub_required: list[str] = BinQueries(req, self.repo).required()
|
||||
|
||||
for sub in sub_required:
|
||||
required.append(sub)
|
||||
|
||||
# Clean for dependencies not in the repository.
|
||||
for dep in required:
|
||||
if dep not in self.repo_package_names:
|
||||
required.remove(dep)
|
||||
|
||||
required.reverse()
|
||||
|
||||
return list(dict.fromkeys(required))
|
|
@ -32,8 +32,8 @@ class Blacklist(Configs):
|
|||
return tomli.load(black)['BLACKLIST']['PACKAGES']
|
||||
except (tomli.TOMLDecodeError, KeyError) as error:
|
||||
raise SystemExit(f"\n{self.prog_name} {self.bred}Error{self.endc}: {error}: in the configuration file "
|
||||
f"'/etc/slpkg/blacklist.toml'.\n"
|
||||
f"'{self.blacklist_file_toml}'.\n"
|
||||
f"\nIf you have upgraded the '{self.prog_name}' probably you need to run:\n"
|
||||
f"'mv {self.etc_path}/blacklist.toml.new {self.etc_path}/blacklist.toml'.\n"
|
||||
f"'mv {self.blacklist_file_toml}.new {self.blacklist_file_toml}'.\n"
|
||||
f"or '{self.cyan}slpkg_new-configs{self.endc}' command.\n")
|
||||
return []
|
||||
|
|
|
@ -7,38 +7,164 @@ from pathlib import Path
|
|||
from multiprocessing import Process
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.progress_bar import ProgressBar
|
||||
from slpkg.repositories import Repositories
|
||||
|
||||
|
||||
class CheckUpdates(Configs):
|
||||
""" Check for changes in the ChangeLog file. """
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, flags: list, repo: str):
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.repo = repo
|
||||
self.utils = Utilities()
|
||||
self.progress = ProgressBar()
|
||||
self.color = self.colour()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.bold: str = self.color['bold']
|
||||
self.green: str = self.color['green']
|
||||
self.yellow: str = self.color['yellow']
|
||||
self.bgreen: str = f'{self.bold}{self.green}'
|
||||
self.endc: str = self.color['endc']
|
||||
self.flag_bin_repository: list = ['-B', '--bin-repo=']
|
||||
self.compare: dict = {}
|
||||
|
||||
# Slackbuilds.org repository settings.
|
||||
self.changelog_txt: str = self.sbo_chglog_txt
|
||||
self.local_chg_txt = Path(self.sbo_repo_path, self.changelog_txt)
|
||||
self.repo_chg_txt: str = f'{self.sbo_repo_url}{self.changelog_txt}'
|
||||
self.local_chg_txt = None
|
||||
self.repo_chg_txt = None
|
||||
|
||||
def check(self) -> bool:
|
||||
""" Checks the ChangeLogs and returns True or False. """
|
||||
def check(self) -> dict:
|
||||
bin_repositories: dict = {
|
||||
self.repos.slack_repo_name: self.slack_repository,
|
||||
self.repos.slack_extra_repo_name: self.slack_extra_repository,
|
||||
self.repos.slack_patches_repo_name: self.slack_patches_repository,
|
||||
self.repos.alien_repo_name: self.alien_repository,
|
||||
self.repos.multilib_repo_name: self.multilib_repository,
|
||||
self.repos.restricted_repo_name: self.restricted_repository,
|
||||
self.repos.gnome_repo_name: self.gnome_repository,
|
||||
self.repos.msb_repo_name: self.msb_repository,
|
||||
self.repos.csb_repo_name: self.csb_repository,
|
||||
self.repos.conraid_repo_name: self.conraid_repository,
|
||||
self.repos.slackonly_repo_name: self.slackonly_repository,
|
||||
self.repos.salixos_repo_name: self.salixos_repository,
|
||||
self.repos.salixos_extra_repo_name: self.salixos_extra_repository,
|
||||
self.repos.salixos_patches_repo_name: self.salixos_patches_repository,
|
||||
self.repos.slackel_repo_name: self.slackel_repository,
|
||||
self.repos.slint_repo_name: self.slint_repository
|
||||
}
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
|
||||
for repo in bin_repositories.keys():
|
||||
if repo in self.repos.bin_enabled_repos and repo == self.repo:
|
||||
bin_repositories[repo]()
|
||||
break
|
||||
|
||||
if self.repo == '*':
|
||||
bin_repositories[repo]()
|
||||
else:
|
||||
|
||||
if self.repos.ponce_repo:
|
||||
self.ponce_repository()
|
||||
else:
|
||||
self.sbo_repository()
|
||||
|
||||
return self.compare
|
||||
|
||||
def slack_repository(self) -> None:
|
||||
self.local_chg_txt: Path = Path(self.repos.slack_repo_path, self.repos.slack_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.slack_repo_mirror}{self.repos.slack_repo_changelog}'
|
||||
self.compare[self.repos.slack_repo_name] = self.compare_dates()
|
||||
|
||||
def slack_extra_repository(self) -> None:
|
||||
self.local_chg_txt: Path = Path(self.repos.slack_extra_repo_path, self.repos.slack_extra_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.slack_extra_repo_mirror}{self.repos.slack_extra_repo_changelog}'
|
||||
self.compare[self.repos.slack_extra_repo_name] = self.compare_dates()
|
||||
|
||||
def slack_patches_repository(self) -> None:
|
||||
self.local_chg_txt: Path = Path(self.repos.slack_patches_repo_path, self.repos.slack_patches_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.slack_patches_repo_mirror}{self.repos.slack_patches_repo_changelog}'
|
||||
self.compare[self.repos.slack_patches_repo_name] = self.compare_dates()
|
||||
|
||||
def alien_repository(self) -> None:
|
||||
self.local_chg_txt: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.alien_repo_mirror}{self.repos.alien_repo_changelog}'
|
||||
self.compare[self.repos.alien_repo_name] = self.compare_dates()
|
||||
|
||||
def multilib_repository(self) -> None:
|
||||
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_mirror}{self.repos.multilib_repo_changelog}'
|
||||
self.compare[self.repos.multilib_repo_name] = self.compare_dates()
|
||||
|
||||
def restricted_repository(self) -> None:
|
||||
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_mirror}{self.repos.restricted_repo_changelog}'
|
||||
self.compare[self.repos.restricted_repo_name] = self.compare_dates()
|
||||
|
||||
def gnome_repository(self) -> None:
|
||||
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}'
|
||||
self.compare[self.repos.gnome_repo_name] = self.compare_dates()
|
||||
|
||||
def msb_repository(self) -> None:
|
||||
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_mirror}{self.repos.msb_repo_changelog}'
|
||||
self.compare[self.repos.msb_repo_name] = self.compare_dates()
|
||||
|
||||
def csb_repository(self) -> None:
|
||||
self.local_chg_txt: Path = Path(self.repos.csb_repo_path, self.repos.csb_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.csb_repo_mirror}{self.repos.csb_repo_changelog}'
|
||||
self.compare[self.repos.csb_repo_name] = self.compare_dates()
|
||||
|
||||
def conraid_repository(self) -> None:
|
||||
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}'
|
||||
self.compare[self.repos.conraid_repo_name] = self.compare_dates()
|
||||
|
||||
def slackonly_repository(self) -> None:
|
||||
self.local_chg_txt: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.slackonly_repo_mirror}{self.repos.slackonly_repo_changelog}'
|
||||
self.compare[self.repos.slackonly_repo_name] = self.compare_dates()
|
||||
|
||||
def salixos_repository(self) -> None:
|
||||
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}'
|
||||
self.compare[self.repos.salixos_repo_name] = self.compare_dates()
|
||||
|
||||
def salixos_extra_repository(self) -> None:
|
||||
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}{self.repos.salixos_extra_repo_changelog}'
|
||||
self.compare[self.repos.salixos_extra_repo_name] = self.compare_dates()
|
||||
|
||||
def salixos_patches_repository(self) -> None:
|
||||
self.local_chg_txt: Path = Path(self.repos.salixos_patches_repo_path, self.repos.salixos_patches_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.salixos_patches_repo_mirror}{self.repos.salixos_patches_repo_changelog}'
|
||||
self.compare[self.repos.salixos_patches_repo_name] = self.compare_dates()
|
||||
|
||||
def slackel_repository(self) -> None:
|
||||
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}'
|
||||
self.compare[self.repos.slackel_repo_name] = self.compare_dates()
|
||||
|
||||
def slint_repository(self) -> None:
|
||||
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}'
|
||||
self.compare[self.repos.slint_repo_name] = self.compare_dates()
|
||||
|
||||
def sbo_repository(self) -> None:
|
||||
self.local_chg_txt: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.sbo_repo_mirror}{self.repos.sbo_repo_changelog}'
|
||||
self.compare[self.repos.sbo_repo_name] = self.compare_dates()
|
||||
|
||||
def ponce_repository(self) -> None:
|
||||
self.local_chg_txt: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog)
|
||||
self.repo_chg_txt: str = f'{self.repos.ponce_repo_mirror}{self.repos.ponce_repo_changelog}'
|
||||
self.compare[self.repos.ponce_repo_name] = self.compare_dates()
|
||||
|
||||
def compare_dates(self) -> bool:
|
||||
local_date: int = 0
|
||||
|
||||
# Ponce repository settings.
|
||||
if self.ponce_repo:
|
||||
self.changelog_txt: str = self.ponce_chglog_txt
|
||||
self.local_chg_txt = Path(self.ponce_repo_path, self.changelog_txt)
|
||||
self.repo_chg_txt: str = f'{self.ponce_repo_url}{self.changelog_txt}'
|
||||
|
||||
try:
|
||||
http = urllib3.PoolManager()
|
||||
repo = http.request('GET', self.repo_chg_txt)
|
||||
|
@ -53,14 +179,22 @@ class CheckUpdates(Configs):
|
|||
return repo_date != local_date
|
||||
|
||||
def view_message(self) -> None:
|
||||
if self.check():
|
||||
print(f'\n\n{self.bgreen}There are new updates available!{self.endc}')
|
||||
else:
|
||||
print(f'\n\n{self.endc}{self.yellow}No updated packages since the last check.{self.endc}')
|
||||
compare = self.check()
|
||||
|
||||
new_line: str = '\n\n'
|
||||
if not compare:
|
||||
new_line: str = '\n'
|
||||
|
||||
for repo, comp in compare.items():
|
||||
if comp:
|
||||
print(f"{new_line}{self.green}There are new updates available for the{self.endc} "
|
||||
f"'{self.bgreen}{repo}{self.endc}'{self.green} repository!{self.endc}")
|
||||
|
||||
if True not in compare.values():
|
||||
print(f'{new_line}{self.endc}{self.yellow}No updated packages since the last check.{self.endc}')
|
||||
|
||||
def updates(self) -> None:
|
||||
""" Starting multiprocessing download process. """
|
||||
message: str = f'Checking for news in the {self.changelog_txt} file...'
|
||||
message: str = 'Checking for news, please wait...'
|
||||
|
||||
# Starting multiprocessing
|
||||
p1 = Process(target=self.view_message)
|
||||
|
|
|
@ -4,36 +4,48 @@
|
|||
from pathlib import Path
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.blacklist import Blacklist
|
||||
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 session as Session
|
||||
|
||||
from slpkg.models.models import SBoTable, PonceTable, BinariesTable
|
||||
|
||||
|
||||
class Check(Configs):
|
||||
""" Some checks before proceed. """
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, flags: list):
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.black = Blacklist()
|
||||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.repo_path = self.sbo_repo_path
|
||||
if self.ponce_repo:
|
||||
self.repo_path = self.ponce_repo_path
|
||||
self.session = Session
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
def exists_in_the_database(self, slackbuilds: list) -> None:
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
self.repo_table = BinariesTable
|
||||
else:
|
||||
self.repo_table = SBoTable
|
||||
if self.repos.ponce_repo:
|
||||
self.repo_table = PonceTable
|
||||
|
||||
def exists_in_the_database(self, packages: list, repo=None) -> None:
|
||||
""" Checking if the slackbuild exists in the database. """
|
||||
not_packages: list = []
|
||||
|
||||
for sbo in slackbuilds:
|
||||
for pkg in packages:
|
||||
|
||||
if not SBoQueries(sbo).slackbuild():
|
||||
not_packages.append(sbo)
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
if not BinQueries(pkg, repo).package_name() and pkg != '*':
|
||||
not_packages.append(pkg)
|
||||
|
||||
else:
|
||||
location = SBoQueries(sbo).location()
|
||||
if not Path(self.repo_path, location, sbo).is_dir():
|
||||
not_packages.append(sbo)
|
||||
elif not SBoQueries(pkg).slackbuild() and pkg != '*':
|
||||
not_packages.append(pkg)
|
||||
|
||||
if not_packages:
|
||||
self.utils.raise_error_message(f"Packages '{', '.join(not_packages)}' does not exists")
|
||||
|
@ -41,37 +53,39 @@ class Check(Configs):
|
|||
def is_package_unsupported(self, slackbuilds: list) -> None:
|
||||
""" Checking for unsupported slackbuilds. """
|
||||
for sbo in slackbuilds:
|
||||
sources = SBoQueries(sbo).sources()
|
||||
if sbo != '*':
|
||||
sources = SBoQueries(sbo).sources()
|
||||
|
||||
if 'UNSUPPORTED' in sources:
|
||||
self.utils.raise_error_message(f"Package '{sbo}' unsupported by arch")
|
||||
if 'UNSUPPORTED' in sources:
|
||||
self.utils.raise_error_message(f"Package '{sbo}' unsupported by arch")
|
||||
|
||||
def is_installed(self, slackbuilds: list, file_pattern: str) -> None:
|
||||
def is_installed(self, packages: list) -> None:
|
||||
""" Checking for installed packages. """
|
||||
not_found = []
|
||||
|
||||
for sbo in slackbuilds:
|
||||
package: str = self.utils.is_package_installed(sbo, file_pattern)
|
||||
for pkg in packages:
|
||||
package: str = self.utils.is_package_installed(pkg)
|
||||
if not package:
|
||||
not_found.append(sbo)
|
||||
not_found.append(pkg)
|
||||
|
||||
if not_found:
|
||||
self.utils.raise_error_message(f'Not found \'{", ".join(not_found)}\' installed packages')
|
||||
|
||||
def is_blacklist(self, slackbuilds: list) -> None:
|
||||
def is_blacklist(self, package: list) -> None:
|
||||
""" Checking if the packages are blacklisted. """
|
||||
blacklist: list = []
|
||||
|
||||
for sbo in slackbuilds:
|
||||
if sbo in self.black.packages():
|
||||
blacklist.append(sbo)
|
||||
for pkg in package:
|
||||
if pkg in self.black.packages():
|
||||
blacklist.append(pkg)
|
||||
|
||||
if blacklist:
|
||||
self.utils.raise_error_message(f"The packages '{', '.join(blacklist)}' is blacklisted")
|
||||
|
||||
def is_empty_database(self) -> None:
|
||||
""" Checking for empty table """
|
||||
""" Checking for empty table and database file. """
|
||||
db = Path(self.db_path, self.database_name)
|
||||
if not SBoQueries('').sbos() or not db.is_file():
|
||||
self.utils.raise_error_message("You need to update the package lists first.\n"
|
||||
" Please run 'slpkg update'")
|
||||
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, 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. """
|
||||
with open(filename, 'rb') as f:
|
||||
return f.read()
|
||||
try:
|
||||
with open(filename, 'rb') as f:
|
||||
return f.read()
|
||||
except FileNotFoundError:
|
||||
self.utils.raise_error_message(f"No such file or directory: '{filename}'")
|
||||
|
|
140
slpkg/configs.py
140
slpkg/configs.py
|
@ -17,7 +17,7 @@ class Load:
|
|||
self.endc: str = '\x1b[0m'
|
||||
self.bred: str = f'{bold}{red}'
|
||||
|
||||
def config_file(self, path: str, file: str) -> dict: # type: ignore
|
||||
def config_file(self, path: Path, file: str) -> dict: # type: ignore
|
||||
try:
|
||||
""" Load the configs from the file. """
|
||||
config_path_file = Path(path, f'{file}.toml')
|
||||
|
@ -45,93 +45,37 @@ class Configs:
|
|||
'endc': '\x1b[0m'
|
||||
}
|
||||
|
||||
# Programme name.
|
||||
prog_name: str = 'slpkg'
|
||||
|
||||
# OS architecture by default
|
||||
os_arch: str = platform.machine()
|
||||
|
||||
# All necessary paths.
|
||||
tmp_path: str = '/tmp/'
|
||||
tmp_slpkg: str = Path(tmp_path, prog_name) # type: ignore
|
||||
build_path: str = Path(tmp_path, prog_name, 'build') # type: ignore
|
||||
download_only_path: str = Path(tmp_slpkg, '') # type: ignore
|
||||
lib_path: str = Path('/var/lib', prog_name) # type: ignore
|
||||
etc_path: str = Path('/etc', prog_name) # type: ignore
|
||||
db_path: str = Path(lib_path, 'database') # type: ignore
|
||||
log_packages: str = Path('/var', 'log', 'packages') # type: ignore
|
||||
tmp_slpkg: Path = Path(tmp_path, prog_name)
|
||||
build_path: Path = Path(tmp_path, prog_name, 'build')
|
||||
download_only_path: Path = Path(tmp_slpkg, '')
|
||||
lib_path: Path = Path('/var/lib', prog_name)
|
||||
etc_path: Path = Path('/etc', prog_name)
|
||||
db_path: Path = Path(lib_path, 'database')
|
||||
log_packages: Path = Path('/var', 'log', 'packages')
|
||||
|
||||
# Database name.
|
||||
database_name: str = f'database.{prog_name}'
|
||||
|
||||
# File suffix for list packages.
|
||||
file_list_suffix: str = '.pkgs'
|
||||
|
||||
# SBo repository configs.
|
||||
sbo_repo_path: str = Path(lib_path, 'repositories', 'sbo') # type: ignore
|
||||
sbo_repo_url: str = 'https://slackbuilds.org/slackbuilds/15.0/'
|
||||
sbo_txt: str = 'SLACKBUILDS.TXT'
|
||||
sbo_chglog_txt: str = 'ChangeLog.txt'
|
||||
sbo_tar_suffix: str = '.tar.gz'
|
||||
sbo_repo_tag: str = '_SBo'
|
||||
|
||||
# Ponce repo configs.
|
||||
ponce_repo: bool = False
|
||||
ponce_repo_path: str = Path(lib_path, 'repositories', 'ponce') # type: ignore
|
||||
ponce_repo_url: str = 'https://cgit.ponce.cc/slackbuilds/plain/'
|
||||
ponce_txt: str = 'SLACKBUILDS.TXT'
|
||||
ponce_chglog_txt: str = 'ChangeLog.txt'
|
||||
ponce_repo_tag: str = '_SBo'
|
||||
|
||||
# Slackware commands.
|
||||
installpkg: str = 'upgradepkg --install-new'
|
||||
reinstall: str = 'upgradepkg --reinstall'
|
||||
removepkg: str = 'removepkg'
|
||||
|
||||
# Cli menu colors configs.
|
||||
colors: bool = True
|
||||
|
||||
# Dialog utility.
|
||||
dialog: bool = True # type: ignore
|
||||
|
||||
# Downloader command. Wget and curl.
|
||||
dialog: bool = True
|
||||
downloader: str = 'wget'
|
||||
|
||||
# Wget options.
|
||||
wget_options: str = '-c -N -q --show-progress'
|
||||
|
||||
# Curl options.
|
||||
curl_options: str = ''
|
||||
|
||||
# Lftp get options.
|
||||
lftp_get_options: str = '-c get -e'
|
||||
|
||||
# Lftp mirror options.
|
||||
lftp_mirror_options: str = '-c mirror --parallel=10 --only-newer'
|
||||
|
||||
# Choose the view mode.
|
||||
silent_mode: bool = True
|
||||
|
||||
# Choose ascii characters.
|
||||
# If True use extended else basic.
|
||||
ascii_characters: bool = True
|
||||
|
||||
# Set false to all the questions.
|
||||
ask_question: bool = True
|
||||
|
||||
# Download parallel multi-sources.
|
||||
parallel_downloads: bool = False
|
||||
|
||||
# Pass the file pattern here.
|
||||
file_pattern_conf: str = ''
|
||||
|
||||
# Progress bar spinners.
|
||||
file_pattern: str = '*'
|
||||
progress_spinner: str = 'pixel'
|
||||
|
||||
# Progress bar spinner color.
|
||||
spinner_color: str = 'green'
|
||||
|
||||
# Load configurations from the file.
|
||||
load = Load()
|
||||
configs = load.config_file(etc_path, prog_name)
|
||||
|
||||
|
@ -139,80 +83,25 @@ class Configs:
|
|||
try:
|
||||
config = configs['CONFIGS']
|
||||
|
||||
# OS architecture by default.
|
||||
os_arch: str = config['OS_ARCH']
|
||||
|
||||
# All necessary paths.
|
||||
tmp_slpkg: str = config['TMP_SLPKG']
|
||||
build_path: str = config['BUILD_PATH']
|
||||
download_only_path: str = config['DOWNLOAD_ONLY_PATH']
|
||||
sbo_repo_path: str = config['SBO_REPO_PATH']
|
||||
|
||||
# Database name.
|
||||
database_name: str = config['DATABASE_NAME']
|
||||
|
||||
# Set false to all the questions.
|
||||
download_only_path: Path = config['DOWNLOAD_ONLY_PATH']
|
||||
ask_question: bool = config['ASK_QUESTION']
|
||||
|
||||
# SBo repository details.
|
||||
sbo_repo_url: str = config['SBO_REPO_URL']
|
||||
sbo_txt: str = config['SBO_TXT']
|
||||
sbo_chglog_txt: str = config['SBO_CHGLOG_TXT']
|
||||
sbo_tar_suffix: str = config['SBO_TAR_SUFFIX']
|
||||
sbo_repo_tag: str = config['SBO_REPO_TAG']
|
||||
|
||||
# Ponce repo configs.
|
||||
ponce_repo: bool = config['PONCE_REPO']
|
||||
ponce_repo_path: str = config['PONCE_REPO_PATH']
|
||||
ponce_repo_url: str = config['PONCE_REPO_URL']
|
||||
ponce_txt: str = config['PONCE_TXT']
|
||||
ponce_chglog_txt: str = config['PONCE_CHGLOG_TXT']
|
||||
ponce_repo_tag: str = config['PONCE_REPO_TAG']
|
||||
|
||||
# Slackware commands.
|
||||
installpkg: str = config['INSTALLPKG']
|
||||
reinstall: str = config['REINSTALL']
|
||||
removepkg: str = config['REMOVEPKG']
|
||||
|
||||
# Cli menu colors configs.
|
||||
colors: bool = config['COLORS']
|
||||
|
||||
# Dialog utility.
|
||||
dialog: str = config['DIALOG']
|
||||
|
||||
# Downloader command.
|
||||
downloader: str = config['DOWNLOADER']
|
||||
|
||||
# Wget options.
|
||||
wget_options: str = config['WGET_OPTIONS']
|
||||
|
||||
# Curl options.
|
||||
curl_options: str = config['CURL_OPTIONS']
|
||||
|
||||
lftp_get_options: str = config['LFTP_GET_OPTIONS']
|
||||
|
||||
# Lftp options.
|
||||
lftp_mirror_options: str = config['LFTP_MIRROR_OPTIONS']
|
||||
|
||||
# Choose the view mode.
|
||||
silent_mode: bool = config['SILENT_MODE']
|
||||
|
||||
# Choose ascii characters. Extended or basic.
|
||||
ascii_characters: bool = config['ASCII_CHARACTERS']
|
||||
|
||||
# File suffix for list packages.
|
||||
file_list_suffix: str = config['FILE_LIST_SUFFIX']
|
||||
|
||||
# Download parallel multi-sources.
|
||||
parallel_downloads: bool = config['PARALLEL_DOWNLOADS']
|
||||
|
||||
# Pass the file pattern here.
|
||||
file_pattern_conf: str = config['FILE_PATTERN']
|
||||
|
||||
# Progress bar spinners.
|
||||
progress_spinner: str = config['PROGRESS_SPINNER']
|
||||
|
||||
# Progress bar spinner color.
|
||||
spinner_color: str = config['SPINNER_COLOR']
|
||||
|
||||
except KeyError as error:
|
||||
|
@ -222,20 +111,15 @@ class Configs:
|
|||
f"'mv {etc_path}/{prog_name}.toml.new {etc_path}/{prog_name}.toml'.\n"
|
||||
f"or '{color['cyan']}slpkg_new-configs{color['endc']}' command.\n")
|
||||
|
||||
repo_tag: str = sbo_repo_tag
|
||||
if ponce_repo:
|
||||
repo_tag: str = ponce_repo_tag
|
||||
|
||||
# Creating the paths if not exists
|
||||
paths = [
|
||||
tmp_slpkg,
|
||||
build_path,
|
||||
download_only_path,
|
||||
sbo_repo_path,
|
||||
lib_path,
|
||||
etc_path,
|
||||
db_path,
|
||||
ponce_repo_path]
|
||||
]
|
||||
|
||||
for path in paths:
|
||||
if not os.path.isdir(path):
|
||||
|
|
|
@ -4,24 +4,24 @@
|
|||
from typing import Generator
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.views.ascii import Ascii
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.models.models import session as Session
|
||||
from slpkg.models.models import SBoTable, PonceTable
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
class Dependees(Configs, Utilities):
|
||||
class Dependees(Configs):
|
||||
""" Show which packages depend. """
|
||||
|
||||
def __init__(self, packages: list, flags: list):
|
||||
super(Configs, self).__init__()
|
||||
super(Utilities, self).__init__()
|
||||
self.packages: list = packages
|
||||
self.flags: list = flags
|
||||
|
||||
self.session = Session
|
||||
self.ascii = Ascii()
|
||||
self.repos = Repositories()
|
||||
self.color = self.colour()
|
||||
self.utils = Utilities()
|
||||
|
||||
self.llc: str = self.ascii.lower_left_corner
|
||||
self.hl: str = self.ascii.horizontal_line
|
||||
|
@ -35,24 +35,27 @@ class Dependees(Configs, Utilities):
|
|||
self.endc: str = self.color['endc']
|
||||
self.flag_full_reverse: list = ['-E', '--full-reverse']
|
||||
self.flag_pkg_version: list = ['-p', '--pkg-version']
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
# Switch between sbo and ponce repository.
|
||||
self.sbo_table = SBoTable
|
||||
if self.ponce_repo:
|
||||
self.sbo_table = PonceTable
|
||||
|
||||
def slackbuilds(self):
|
||||
def find(self, repo: str) -> None:
|
||||
""" Collecting the dependees. """
|
||||
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))
|
||||
dependees: list = list(self.find_requires(pkg, repo))
|
||||
|
||||
package: str = f'{self.byellow}{pkg}{self.endc}'
|
||||
|
||||
if self.is_option(self.flag_pkg_version, self.flags):
|
||||
package: str = f'{self.byellow}{pkg}-{SBoQueries(pkg).version()}{self.endc}'
|
||||
if self.utils.is_option(self.flag_pkg_version, self.flags):
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
version: str = BinQueries(pkg, repo).version()
|
||||
else:
|
||||
version: str = SBoQueries(pkg).version()
|
||||
|
||||
package: str = f'{self.byellow}{pkg} {version}{self.endc}'
|
||||
|
||||
print(package)
|
||||
|
||||
|
@ -65,26 +68,36 @@ class Dependees(Configs, Utilities):
|
|||
for i, dep in enumerate(dependees, start=1):
|
||||
dependency: str = f'{self.cyan}{dep[0]}{self.endc}'
|
||||
|
||||
if self.is_option(self.flag_pkg_version, self.flags):
|
||||
dependency: str = (f'{self.cyan}{dep[0]}{self.endc}-{self.yellow}'
|
||||
f'{SBoQueries(dep[0]).version()}{self.endc}')
|
||||
if self.utils.is_option(self.flag_pkg_version, self.flags):
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
version: str = BinQueries(dep[0], repo).version()
|
||||
else:
|
||||
version: str = SBoQueries(dep[0]).version()
|
||||
|
||||
dependency: str = (f'{self.cyan}{dep[0]}{self.endc} {self.yellow}'
|
||||
f'{version}{self.endc}')
|
||||
|
||||
if i == 1:
|
||||
print(f' {dependency}')
|
||||
else:
|
||||
print(f'{sp}{dependency}')
|
||||
|
||||
if self.is_option(self.flag_full_reverse, self.flags):
|
||||
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, sbo: str) -> Generator[str, None, None]:
|
||||
def find_requires(self, pkg: str, repo) -> Generator[str, None, None]:
|
||||
""" Find requires that slackbuild dependees. """
|
||||
requires: list = self.session.query(self.sbo_table.name, self.sbo_table.requires).all() # type: ignore
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
requires: list = BinQueries(pkg, repo).all_package_names_with_required()
|
||||
else:
|
||||
requires: list = SBoQueries('').all_sbo_and_requires()
|
||||
|
||||
for req in requires:
|
||||
if [r for r in req[1].split() if r == sbo]:
|
||||
if [r for r in req[1].split() if r == pkg]:
|
||||
yield req
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slpkg.queries import SBoQueries
|
||||
|
||||
|
||||
class Requires:
|
||||
""" Creates a list of dependencies with
|
||||
the right order to install. """
|
||||
|
||||
def __init__(self, name: str):
|
||||
self.name: str = name
|
||||
|
||||
def resolve(self) -> list:
|
||||
""" Resolve the dependencies. """
|
||||
requires: list[str] = SBoQueries(self.name).requires() # type: ignore
|
||||
for req in requires:
|
||||
if req:
|
||||
sub: list[str] = SBoQueries(req).requires() # type: ignore
|
||||
for s in sub:
|
||||
requires.append(s)
|
||||
|
||||
requires.reverse()
|
||||
|
||||
return list(dict.fromkeys(requires))
|
|
@ -4,7 +4,7 @@
|
|||
import locale
|
||||
from dialog import Dialog
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
from typing import Union, Tuple
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.views.version import Version
|
||||
|
@ -22,7 +22,7 @@ class DialogBox(Configs):
|
|||
self.d.set_background_title(f'{self.prog_name} {Version().version} - Software Package Manager')
|
||||
|
||||
def checklist(self, text: str, packages: list, title: str, height: int, width: int,
|
||||
list_height: int, choices: list):
|
||||
list_height: int, choices: list) -> Tuple[bool, list]:
|
||||
""" Display a checklist box. """
|
||||
more_kwargs: dict = {}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class DialogBox(Configs):
|
|||
|
||||
return code, tags
|
||||
|
||||
def mixedform(self, text: str, title: str, elements: list, height: int, width: int):
|
||||
def mixedform(self, text: str, title: str, elements: list, height: int, width: int) -> Tuple[bool, list]:
|
||||
""" Display a mixedform box. """
|
||||
more_kwargs: dict = {}
|
||||
|
||||
|
@ -54,12 +54,12 @@ class DialogBox(Configs):
|
|||
|
||||
return code, tags
|
||||
|
||||
def msgbox(self, text: str, height: int, width: int):
|
||||
def msgbox(self, text: str, height: int, width: int) -> None:
|
||||
""" Display a message box. """
|
||||
if self.dialog:
|
||||
self.d.msgbox(text, height, width)
|
||||
|
||||
def textbox(self, text: Union[str, Path], height: int, width: int):
|
||||
def textbox(self, text: Union[str, Path], height: int, width: int) -> None:
|
||||
""" Display a text box. """
|
||||
if self.dialog:
|
||||
self.d.textbox(text, height, width)
|
||||
|
|
|
@ -6,52 +6,64 @@ import shutil
|
|||
from pathlib import Path
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.downloader import Downloader
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
class Download(Configs, Utilities):
|
||||
class Download(Configs):
|
||||
""" Download the slackbuilds with the sources only. """
|
||||
|
||||
def __init__(self, directory: str, flags: list):
|
||||
def __init__(self, directory: Path, flags: list):
|
||||
super(Configs, self).__init__()
|
||||
super(Utilities, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.directory: str = directory
|
||||
self.directory: Path = directory
|
||||
|
||||
self.repos = Repositories()
|
||||
self.utils = Utilities()
|
||||
self.session = Session
|
||||
|
||||
self.flag_directory: list = ['-z=', '--directory=']
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
def packages(self, slackbuilds: list) -> None:
|
||||
def packages(self, packages: list, repo=None) -> None:
|
||||
""" Download the package only. """
|
||||
view = ViewMessage(self.flags)
|
||||
view.download_packages(slackbuilds, self.directory)
|
||||
packages: list = self.utils.apply_package_pattern(self.flags, packages, repo)
|
||||
view = ViewMessage(self.flags, repo)
|
||||
view.download_packages(packages, self.directory)
|
||||
view.question()
|
||||
|
||||
download_path: str = self.download_only_path
|
||||
if self.is_option(self.flag_directory, self.flags):
|
||||
download_path: str = self.directory
|
||||
download_path: Path = self.download_only_path
|
||||
if self.utils.is_option(self.flag_directory, self.flags):
|
||||
download_path: Path = self.directory
|
||||
|
||||
start: float = time.time()
|
||||
for sbo in slackbuilds:
|
||||
location: str = SBoQueries(sbo).location()
|
||||
urls: list = []
|
||||
for pkg in packages:
|
||||
|
||||
if self.ponce_repo:
|
||||
ponce_repo_path_package = Path(self.ponce_repo_path, location, sbo)
|
||||
shutil.copytree(ponce_repo_path_package, f'{download_path}{sbo}')
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
mirror: str = BinQueries(pkg, repo).mirror()
|
||||
location: str = BinQueries(pkg, repo).location()
|
||||
package: str = BinQueries(pkg, repo).package_bin()
|
||||
urls.append(f'{mirror}{location}/{package}')
|
||||
else:
|
||||
file: str = f'{sbo}{self.sbo_tar_suffix}'
|
||||
url: list = [f'{self.sbo_repo_url}{location}/{file}']
|
||||
down_sbo = Downloader(download_path, url, self.flags)
|
||||
down_sbo.download()
|
||||
location: str = SBoQueries(pkg).location()
|
||||
sources = SBoQueries(pkg).sources()
|
||||
urls += sources
|
||||
|
||||
sources = SBoQueries(sbo).sources()
|
||||
down_source = Downloader(download_path, sources, self.flags)
|
||||
down_source.download()
|
||||
if self.repos.ponce_repo:
|
||||
ponce_repo_path_package = Path(self.repos.ponce_repo_path, location, pkg)
|
||||
shutil.copytree(ponce_repo_path_package, Path(download_path, pkg))
|
||||
else:
|
||||
file: str = f'{pkg}{self.repos.sbo_repo_tar_suffix}'
|
||||
urls += [f'{self.repos.sbo_repo_mirror}{location}/{file}']
|
||||
|
||||
down = Downloader(download_path, urls, self.flags)
|
||||
down.download()
|
||||
|
||||
elapsed_time: float = time.time() - start
|
||||
self.finished_time(elapsed_time)
|
||||
self.utils.finished_time(elapsed_time)
|
||||
|
|
|
@ -22,7 +22,7 @@ class Downloader(Configs):
|
|||
|
||||
self.flag_parallel: list = ['-P', '--parallel']
|
||||
|
||||
def download(self):
|
||||
def download(self) -> None:
|
||||
""" Starting the processing for downloading. """
|
||||
process: list = []
|
||||
|
||||
|
@ -50,7 +50,7 @@ class Downloader(Configs):
|
|||
command: str = f'{self.downloader} {self.curl_options} "{url}" --output {self.path}/{filename}'
|
||||
|
||||
elif self.downloader == 'lftp':
|
||||
command: str = f'lftp {self.lftp_get_options} {url} -o {self.path}'
|
||||
command: str = f'{self.downloader} {self.lftp_get_options} {url} -o {self.path}'
|
||||
|
||||
else:
|
||||
self.utils.raise_error_message(f"Downloader '{self.downloader}' not supported")
|
||||
|
|
|
@ -5,13 +5,14 @@ from slpkg.configs import Configs
|
|||
from slpkg.utilities import Utilities
|
||||
|
||||
|
||||
class FindInstalled(Configs, Utilities):
|
||||
class FindInstalled(Configs):
|
||||
""" Find installed packages. """
|
||||
|
||||
def __init__(self):
|
||||
super(Configs, self).__init__()
|
||||
super(Utilities, self).__init__()
|
||||
|
||||
self.color = self.colour()
|
||||
self.utils = Utilities()
|
||||
|
||||
self.yellow: str = self.color['yellow']
|
||||
self.cyan: str = self.color['cyan']
|
||||
|
@ -20,19 +21,20 @@ class FindInstalled(Configs, Utilities):
|
|||
self.endc: str = self.color['endc']
|
||||
self.grey: str = self.color['grey']
|
||||
|
||||
def find(self, packages: list, pattern: str) -> None:
|
||||
self.installed: list = self.utils.installed_packages
|
||||
|
||||
def find(self, packages: list) -> None:
|
||||
""" Find the packages. """
|
||||
matching: list = []
|
||||
|
||||
installed: list = list(self.all_installed(pattern))
|
||||
|
||||
print(f'The list below shows the installed packages '
|
||||
f'that contains \'{", ".join([p for p in packages])}\' files:\n')
|
||||
|
||||
for pkg in packages:
|
||||
for package in installed:
|
||||
for package in self.installed:
|
||||
if pkg in package:
|
||||
matching.append(package)
|
||||
|
||||
self.matched(matching)
|
||||
|
||||
def matched(self, matching: list) -> None:
|
||||
|
|
|
@ -21,7 +21,7 @@ class FormConfigs(Configs):
|
|||
self.orig_configs: list = []
|
||||
self.config_file = Path(self.etc_path, f'{self.prog_name}.toml')
|
||||
|
||||
def is_dialog_enabled(self):
|
||||
def is_dialog_enabled(self) -> None:
|
||||
""" Checking if the dialog box is enabled by the user. """
|
||||
if not self.dialog:
|
||||
self.utils.raise_error_message(f"You should enable the dialog "
|
||||
|
@ -31,7 +31,7 @@ class FormConfigs(Configs):
|
|||
""" Read and write the configuration file. """
|
||||
self.is_dialog_enabled()
|
||||
elements: list = []
|
||||
height: int = 35
|
||||
height: int = 30
|
||||
width: int = 74
|
||||
text: str = f'Edit the configuration file: {self.config_file}'
|
||||
title: str = ' Configuration File '
|
||||
|
@ -69,8 +69,14 @@ class FormConfigs(Configs):
|
|||
|
||||
def check_configs(self, tags: list) -> bool:
|
||||
""" Check for true of false values. """
|
||||
keys: list = ['COLORS', 'DIALOG', 'SILENT_MODE', 'ASCII_CHARACTERS',
|
||||
'PONCE_REPO', 'ASK_QUESTION', 'PARALLEL_DOWNLOADS']
|
||||
keys: list = [
|
||||
'COLORS',
|
||||
'DIALOG',
|
||||
'SILENT_MODE',
|
||||
'ASCII_CHARACTERS',
|
||||
'ASK_QUESTION',
|
||||
'PARALLEL_DOWNLOADS'
|
||||
]
|
||||
values: list = ['true', 'false']
|
||||
|
||||
for key, value in zip(self.configs['CONFIGS'].keys(), tags):
|
||||
|
@ -102,9 +108,14 @@ class FormConfigs(Configs):
|
|||
if line.lstrip().startswith(f'{key} ='):
|
||||
line = f' {key} = "{value}"\n'
|
||||
|
||||
if line.lstrip().startswith(('COLORS =', 'DIALOG =', 'SILENT_MODE =',
|
||||
'ASCII_CHARACTERS =', 'PONCE_REPO =',
|
||||
'ASK_QUESTION =', 'PARALLEL_DOWNLOADS =')):
|
||||
if line.lstrip().startswith(
|
||||
|
||||
('COLORS =', 'DIALOG =',
|
||||
'SILENT_MODE =',
|
||||
'ASCII_CHARACTERS =',
|
||||
'ASK_QUESTION =',
|
||||
'PARALLEL_DOWNLOADS =')
|
||||
):
|
||||
line = line.replace('"', '')
|
||||
|
||||
patch_toml.write(line)
|
||||
|
|
File diff suppressed because it is too large
Load diff
300
slpkg/main.py
300
slpkg/main.py
|
@ -9,7 +9,7 @@ from slpkg.checks import Check
|
|||
from slpkg.upgrade import Upgrade
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.tracking import Tracking
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.repo_info import RepoInfo
|
||||
from slpkg.dependees import Dependees
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.search import SearchPackage
|
||||
|
@ -17,11 +17,15 @@ from slpkg.views.cli_menu import Usage
|
|||
from slpkg.dialog_box import DialogBox
|
||||
from slpkg.views.version import Version
|
||||
from slpkg.download_only import Download
|
||||
from slpkg.slackbuild import Slackbuilds
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.form_configs import FormConfigs
|
||||
from slpkg.views.help_commands import Help
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.install import Packages
|
||||
from slpkg.check_updates import CheckUpdates
|
||||
from slpkg.sbos.slackbuild import Slackbuilds
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
from slpkg.find_installed import FindInstalled
|
||||
from slpkg.views.view_package import ViewPackage
|
||||
from slpkg.remove_packages import RemovePackages
|
||||
|
@ -39,24 +43,19 @@ class Argparse(Configs):
|
|||
self.dialogbox = DialogBox()
|
||||
self.utils = Utilities()
|
||||
self.usage = Usage()
|
||||
self.check = Check()
|
||||
self.form_configs = FormConfigs()
|
||||
self.color = self.colour()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.bold: str = self.color['bold']
|
||||
self.red: str = self.color['red']
|
||||
self.endc: str = self.color['endc']
|
||||
self.bred: str = f'{self.bold}{self.red}'
|
||||
|
||||
self.file_pattern: str = f'*{self.repo_tag}'
|
||||
if self.file_pattern_conf:
|
||||
self.file_pattern = self.file_pattern_conf
|
||||
self.binary_repo = None
|
||||
|
||||
if len(self.args) == 0 or '' in self.args:
|
||||
self.usage.help_short(1)
|
||||
|
||||
self.check.is_blacklist(self.args)
|
||||
|
||||
self.flag_yes: str = '--yes'
|
||||
self.flag_short_yes: str = '-y'
|
||||
self.flag_jobs: str = '--jobs'
|
||||
|
@ -79,12 +78,13 @@ class Argparse(Configs):
|
|||
self.flag_short_generate: str = '-G'
|
||||
self.flag_parallel: str = '--parallel'
|
||||
self.flag_short_parallel: str = '-P'
|
||||
self.flag_bin_repository: str = '--bin-repo='
|
||||
self.flag_short_bin_repository: str = '-B='
|
||||
self.flag_directory: str = '--directory='
|
||||
self.flag_short_directory: str = '-z='
|
||||
self.flag_file_pattern: str = '--file-pattern='
|
||||
self.flag_short_file_pattern: str = '-F='
|
||||
|
||||
self.flag_searches: list = [self.flag_short_search, self.flag_search]
|
||||
self.flag_binaries: list = [self.flag_short_bin_repository, self.flag_bin_repository]
|
||||
|
||||
self.options: list = [
|
||||
self.flag_yes,
|
||||
|
@ -109,12 +109,12 @@ class Argparse(Configs):
|
|||
self.flag_short_generate,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_directory,
|
||||
self.flag_short_directory,
|
||||
self.flag_file_pattern,
|
||||
self.flag_short_file_pattern
|
||||
]
|
||||
|
||||
|
||||
self.commands: dict = {
|
||||
'--help': [],
|
||||
'--version': [],
|
||||
|
@ -124,8 +124,10 @@ class Argparse(Configs):
|
|||
self.flag_short_yes,
|
||||
self.flag_generate,
|
||||
self.flag_short_generate,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel,
|
||||
self.flag_short_parallel
|
||||
],
|
||||
'upgrade': [
|
||||
self.flag_yes,
|
||||
|
@ -138,12 +140,16 @@ class Argparse(Configs):
|
|||
self.flag_short_reinstall,
|
||||
self.flag_no_silent,
|
||||
self.flag_short_no_silent,
|
||||
self.flag_file_pattern,
|
||||
self.flag_short_file_pattern,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel,
|
||||
self.flag_short_parallel
|
||||
],
|
||||
'check-updates': [],
|
||||
'check-updates': [
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository
|
||||
],
|
||||
'repo-info': [],
|
||||
'configs': [],
|
||||
'clean-logs': [
|
||||
self.flag_yes,
|
||||
|
@ -166,7 +172,7 @@ class Argparse(Configs):
|
|||
self.flag_no_silent,
|
||||
self.flag_short_no_silent,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel,
|
||||
self.flag_short_parallel
|
||||
],
|
||||
'install': [
|
||||
self.flag_yes,
|
||||
|
@ -183,22 +189,22 @@ class Argparse(Configs):
|
|||
self.flag_short_search,
|
||||
self.flag_no_silent,
|
||||
self.flag_short_no_silent,
|
||||
self.flag_file_pattern,
|
||||
self.flag_short_file_pattern,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel,
|
||||
self.flag_short_parallel
|
||||
],
|
||||
'download': [
|
||||
self.flag_yes,
|
||||
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,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_parallel,
|
||||
self.flag_short_parallel,
|
||||
self.flag_short_parallel
|
||||
],
|
||||
'remove': [
|
||||
self.flag_resolve_off,
|
||||
|
@ -207,14 +213,10 @@ class Argparse(Configs):
|
|||
self.flag_short_search,
|
||||
self.flag_no_silent,
|
||||
self.flag_short_no_silent,
|
||||
self.flag_file_pattern,
|
||||
self.flag_short_file_pattern
|
||||
],
|
||||
'find': [
|
||||
self.flag_search,
|
||||
self.flag_short_search,
|
||||
self.flag_file_pattern,
|
||||
self.flag_short_file_pattern
|
||||
],
|
||||
'view': [
|
||||
self.flag_search,
|
||||
|
@ -225,12 +227,16 @@ class Argparse(Configs):
|
|||
'search': [
|
||||
self.flag_search,
|
||||
self.flag_short_search,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository
|
||||
],
|
||||
'dependees': [
|
||||
self.flag_full_reverse,
|
||||
self.flag_short_full_reverse,
|
||||
self.flag_search,
|
||||
self.flag_short_search,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository,
|
||||
self.flag_pkg_version,
|
||||
self.flag_short_pkg_version
|
||||
],
|
||||
|
@ -238,7 +244,9 @@ class Argparse(Configs):
|
|||
self.flag_search,
|
||||
self.flag_short_search,
|
||||
self.flag_pkg_version,
|
||||
self.flag_short_pkg_version
|
||||
self.flag_short_pkg_version,
|
||||
self.flag_bin_repository,
|
||||
self.flag_short_bin_repository
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -247,6 +255,7 @@ class Argparse(Configs):
|
|||
self.commands['-u'] = self.commands['update']
|
||||
self.commands['-U'] = self.commands['upgrade']
|
||||
self.commands['-c'] = self.commands['check-updates']
|
||||
self.commands['-I'] = self.commands['repo-info']
|
||||
self.commands['-g'] = self.commands['configs']
|
||||
self.commands['-L'] = self.commands['clean-logs']
|
||||
self.commands['-D'] = self.commands['clean-tmp']
|
||||
|
@ -266,36 +275,48 @@ class Argparse(Configs):
|
|||
self.move_options()
|
||||
self.invalid_options()
|
||||
|
||||
def invalid_options(self):
|
||||
self.check = Check(self.flags)
|
||||
self.check.is_blacklist(self.args[1:])
|
||||
self.check_for_bin_repositories()
|
||||
|
||||
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):
|
||||
|
||||
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:
|
||||
""" Checks for invalid options. """
|
||||
invalid: list = []
|
||||
commands: list = []
|
||||
doubles: list = []
|
||||
invalid, commands, repeat = [], [], []
|
||||
|
||||
for arg in self.args:
|
||||
if arg[0] == '-' and arg in self.commands.keys():
|
||||
commands.append(arg)
|
||||
elif arg[0] == '-' and arg not in self.options:
|
||||
invalid.append(arg)
|
||||
elif arg[0] == '--' and arg not in self.options:
|
||||
invalid.append(arg)
|
||||
elif arg[0] == '-' and arg in self.options:
|
||||
doubles.append(arg)
|
||||
|
||||
# Fixed for doubles options.
|
||||
if doubles:
|
||||
for opt in doubles:
|
||||
print(f"{self.prog_name}: invalid double option '{opt}'")
|
||||
self.usage.help_minimal()
|
||||
# Counts the recurring options.
|
||||
for opt in self.flags:
|
||||
if self.flags.count(opt) > 1:
|
||||
repeat.append(opt)
|
||||
|
||||
# Fixed for recurring options.
|
||||
if repeat:
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid recurring options '{', '.join(repeat)}'")
|
||||
|
||||
# Fixed for invalid commands combination.
|
||||
if len(commands) > 1:
|
||||
print(f"{self.prog_name}: invalid commands combination '{', '.join(commands)}'")
|
||||
self.usage.help_minimal()
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid commands combination '{', '.join(commands)}'")
|
||||
|
||||
# Fixed for correct options by command.
|
||||
try:
|
||||
options = self.commands[self.args[0]]
|
||||
options: list = self.commands[self.args[0]]
|
||||
for opt in self.flags:
|
||||
if opt not in options:
|
||||
invalid.append(opt)
|
||||
|
@ -304,9 +325,7 @@ class Argparse(Configs):
|
|||
|
||||
# Prints error for invalid options.
|
||||
if invalid:
|
||||
for opt in invalid:
|
||||
print(f"{self.prog_name}: invalid option '{opt}'")
|
||||
self.usage.help_minimal()
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid options '{','.join(invalid)}'")
|
||||
|
||||
def split_options(self) -> None:
|
||||
""" Split options and commands, like: -iyjR
|
||||
|
@ -336,29 +355,34 @@ class Argparse(Configs):
|
|||
"""
|
||||
for arg in self.args:
|
||||
if arg.startswith(self.flag_directory):
|
||||
self.directory = arg.split('=')[1]
|
||||
self.directory: str = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_directory
|
||||
|
||||
if arg.startswith(self.flag_short_directory):
|
||||
self.directory = arg.split('=')[1]
|
||||
self.directory: str = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_short_directory
|
||||
|
||||
if arg.startswith(self.flag_file_pattern):
|
||||
self.file_pattern = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_file_pattern
|
||||
if arg.startswith(self.flag_bin_repository):
|
||||
self.binary_repo: str = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_bin_repository
|
||||
|
||||
if arg.startswith(self.flag_short_file_pattern):
|
||||
self.file_pattern = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_short_file_pattern
|
||||
if arg.startswith(self.flag_short_bin_repository):
|
||||
self.binary_repo: str = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_short_bin_repository
|
||||
|
||||
def move_options(self) -> None:
|
||||
""" Move options to the flags and removes from the arguments. """
|
||||
for opt in self.options:
|
||||
if opt in self.args:
|
||||
self.args.remove(opt)
|
||||
self.flags.append(opt)
|
||||
new_args: list = []
|
||||
|
||||
def is_file_list_packages(self):
|
||||
for arg in self.args:
|
||||
if arg in self.options:
|
||||
self.flags.append(arg)
|
||||
else:
|
||||
new_args.append(arg)
|
||||
|
||||
self.args: list = new_args
|
||||
|
||||
def is_file_list_packages(self) -> list:
|
||||
""" Checks if the arg is filelist.pkgs. """
|
||||
if self.args[1].endswith(self.file_list_suffix):
|
||||
file = Path(self.args[1])
|
||||
|
@ -375,43 +399,54 @@ class Argparse(Configs):
|
|||
list_height: int = 0
|
||||
choices: list = []
|
||||
title: str = f' Choose packages you want to {method} '
|
||||
repo_packages: list = SBoQueries('').sbos()
|
||||
|
||||
installed: list = list(self.utils.all_installed(self.file_pattern))
|
||||
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_by_repo()
|
||||
|
||||
installed: list = self.utils.installed_packages
|
||||
|
||||
if method in ['remove', 'find']:
|
||||
|
||||
for package in installed:
|
||||
name: str = self.utils.split_installed_pkg(package)[0]
|
||||
version: str = self.utils.split_installed_pkg(package)[1]
|
||||
split_package: list = self.utils.split_binary_pkg(package)
|
||||
|
||||
for pkg in packages:
|
||||
if pkg in name:
|
||||
choices += [(name, version, False, f'Package: {package}')]
|
||||
if pkg in split_package[0]:
|
||||
choices += [(split_package[0], split_package[1], False, f'Package: {package}')]
|
||||
|
||||
elif method == 'upgrade':
|
||||
for pkg in packages:
|
||||
for package in repo_packages:
|
||||
|
||||
if pkg == package:
|
||||
repo_ver: str = SBoQueries(package).version()
|
||||
inst_pkg: str = self.utils.is_package_installed(package, self.file_pattern)
|
||||
inst_ver: str = self.utils.split_installed_pkg(inst_pkg)[1]
|
||||
|
||||
repo_build_tag = self.utils.read_build_tag(package)
|
||||
inst_build_tag = self.utils.split_installed_pkg(inst_pkg)[3]
|
||||
inst_pkg: str = self.utils.is_package_installed(package)
|
||||
split_inst_pkg: list = self.utils.split_binary_pkg(inst_pkg)
|
||||
|
||||
choices += [(package, f'{inst_ver} -> {repo_ver}', True,
|
||||
f'Installed: {package}-{inst_ver} Build: {inst_build_tag} -> '
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
repo_ver: str = BinQueries(package, self.binary_repo).version()
|
||||
bin_pkg: str = BinQueries(package, self.binary_repo).package_bin()
|
||||
repo_build_tag: str = self.utils.split_binary_pkg(bin_pkg[:-4])[3]
|
||||
else:
|
||||
repo_ver: str = SBoQueries(package).version()
|
||||
repo_build_tag: str = self.utils.read_sbo_build_tag(package)
|
||||
|
||||
choices += [(package, f'{split_inst_pkg[1]} -> {repo_ver}', True,
|
||||
f'Installed: {package}-{split_inst_pkg[1]} Build: {split_inst_pkg[3]} -> '
|
||||
f'Available: {repo_ver} Build: {repo_build_tag}')]
|
||||
|
||||
else:
|
||||
for pkg in packages:
|
||||
for package in repo_packages:
|
||||
|
||||
if pkg in package:
|
||||
repo_ver = SBoQueries(package).version()
|
||||
choices += [(package, repo_ver, False, f'Package: {package}-{repo_ver}')]
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
repo_ver: str = BinQueries(package, self.binary_repo).version()
|
||||
repo: str = BinQueries(package, self.binary_repo).repository()
|
||||
else:
|
||||
repo_ver: str = SBoQueries(package).version()
|
||||
repo: str = self.repos.sbo_enabled_repository
|
||||
choices += [(package, repo_ver, False, f'Package: {package}-{repo_ver} '
|
||||
f'> {repo}')]
|
||||
|
||||
if not choices:
|
||||
return packages
|
||||
|
@ -419,16 +454,15 @@ class Argparse(Configs):
|
|||
text: str = f'There are {len(choices)} packages:'
|
||||
code, tags = self.dialogbox.checklist(text, packages, title, height,
|
||||
width, list_height, choices)
|
||||
|
||||
if not code:
|
||||
return packages
|
||||
|
||||
os.system('clear')
|
||||
|
||||
if not tags:
|
||||
if code == 'cancel':
|
||||
raise SystemExit()
|
||||
|
||||
return tags
|
||||
if not tags:
|
||||
return packages
|
||||
|
||||
return list(set(tags))
|
||||
|
||||
def help(self) -> None:
|
||||
if len(self.args) == 1:
|
||||
|
@ -444,8 +478,8 @@ class Argparse(Configs):
|
|||
|
||||
def update(self) -> None:
|
||||
if len(self.args) == 1:
|
||||
update = UpdateRepository(self.flags)
|
||||
update.repository()
|
||||
update = UpdateRepository(self.flags, self.binary_repo)
|
||||
update.repositories()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
@ -455,7 +489,7 @@ class Argparse(Configs):
|
|||
if len(self.args) == 1:
|
||||
self.check.is_empty_database()
|
||||
|
||||
upgrade = Upgrade(self.file_pattern)
|
||||
upgrade = Upgrade(self.flags, self.binary_repo)
|
||||
packages: list = list(upgrade.packages())
|
||||
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
@ -464,19 +498,29 @@ class Argparse(Configs):
|
|||
print('\nEverything is up-to-date.\n')
|
||||
raise SystemExit()
|
||||
|
||||
install = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
|
||||
install.execute()
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
install = Packages(packages, self.flags, self.binary_repo, mode=command)
|
||||
install.execute()
|
||||
else:
|
||||
install = Slackbuilds(packages, self.flags, mode=command)
|
||||
install.execute()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
def check_updates(self) -> None:
|
||||
if len(self.args) == 1:
|
||||
self.check.is_empty_database()
|
||||
check = CheckUpdates()
|
||||
check = CheckUpdates(self.flags, self.binary_repo)
|
||||
check.updates()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
def repo_info(self) -> None:
|
||||
if len(self.args) == 1:
|
||||
repo = RepoInfo()
|
||||
repo.info()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
def edit_configs(self) -> None:
|
||||
if len(self.args) == 1:
|
||||
self.form_configs.edit()
|
||||
|
@ -502,7 +546,7 @@ class Argparse(Configs):
|
|||
views = ViewMessage(self.flags)
|
||||
views.question()
|
||||
|
||||
self.utils.remove_folder_if_exists(f'{self.tmp_path}{self.prog_name}')
|
||||
self.utils.remove_folder_if_exists(Path(self.tmp_path, self.prog_name))
|
||||
self.utils.create_folder(path=self.tmp_slpkg, folder='build')
|
||||
print(f"The folder '{self.tmp_path}{self.prog_name}' was cleaned!")
|
||||
|
||||
|
@ -511,7 +555,7 @@ class Argparse(Configs):
|
|||
|
||||
def clean_data(self) -> None:
|
||||
if len(self.args) == 1:
|
||||
update = UpdateRepository(self.flags)
|
||||
update = UpdateRepository(self.flags, self.binary_repo)
|
||||
update.drop_the_tables()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
@ -521,16 +565,16 @@ 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):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.is_empty_database()
|
||||
self.check.exists_in_the_database(packages)
|
||||
self.check.is_package_unsupported(packages)
|
||||
|
||||
build = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
|
||||
build = Slackbuilds(packages, self.flags, mode=command)
|
||||
build.execute()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
@ -540,17 +584,23 @@ 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):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.is_empty_database()
|
||||
self.check.exists_in_the_database(packages)
|
||||
self.check.is_package_unsupported(packages)
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
self.check.exists_in_the_database(packages, self.binary_repo)
|
||||
|
||||
install = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
|
||||
install.execute()
|
||||
install = Packages(packages, self.flags, self.binary_repo, mode=command)
|
||||
install.execute()
|
||||
else:
|
||||
self.check.exists_in_the_database(packages)
|
||||
self.check.is_package_unsupported(packages)
|
||||
|
||||
install = Slackbuilds(packages, self.flags, mode=command)
|
||||
install.execute()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
@ -559,15 +609,15 @@ 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):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.is_empty_database()
|
||||
self.check.exists_in_the_database(packages)
|
||||
self.check.exists_in_the_database(packages, self.binary_repo)
|
||||
download = Download(self.directory, self.flags)
|
||||
download.packages(packages)
|
||||
download.packages(packages, self.binary_repo)
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
@ -581,10 +631,9 @@ class Argparse(Configs):
|
|||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.is_empty_database()
|
||||
self.check.is_installed(packages, self.file_pattern)
|
||||
self.check.is_installed(packages)
|
||||
|
||||
remove = RemovePackages(packages, self.flags, self.file_pattern)
|
||||
remove = RemovePackages(packages, self.flags)
|
||||
remove.remove()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
@ -594,15 +643,14 @@ 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):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.is_empty_database()
|
||||
|
||||
find = FindInstalled()
|
||||
find.find(packages, self.file_pattern)
|
||||
find.find(packages)
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
@ -611,12 +659,12 @@ 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):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.is_empty_database()
|
||||
self.check.exists_in_the_database(packages)
|
||||
|
||||
view = ViewPackage(self.flags)
|
||||
|
@ -629,15 +677,14 @@ 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):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.is_empty_database()
|
||||
|
||||
search = SearchPackage()
|
||||
search.package(packages)
|
||||
search = SearchPackage(self.flags)
|
||||
search.package(packages, self.binary_repo)
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
@ -646,16 +693,16 @@ 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):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.is_empty_database()
|
||||
self.check.exists_in_the_database(packages)
|
||||
self.check.exists_in_the_database(packages, self.binary_repo)
|
||||
|
||||
dependees = Dependees(packages, self.flags)
|
||||
dependees.slackbuilds()
|
||||
dependees.find(self.binary_repo)
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
@ -664,24 +711,27 @@ 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):
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
||||
self.check.is_empty_database()
|
||||
self.check.exists_in_the_database(packages)
|
||||
self.check.exists_in_the_database(packages, self.binary_repo)
|
||||
|
||||
tracking = Tracking(self.flags)
|
||||
tracking.packages(packages)
|
||||
tracking.packages(packages, self.binary_repo)
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
def help_for_commands(self) -> None:
|
||||
""" Extra help information for commands. """
|
||||
if len(self.args) == 2:
|
||||
flags = self.commands[self.args[1]]
|
||||
Help(self.args[1], flags).view()
|
||||
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)
|
||||
|
||||
|
@ -705,6 +755,8 @@ def main():
|
|||
'-U': argparse.upgrade,
|
||||
'check-updates': argparse.check_updates,
|
||||
'-c': argparse.check_updates,
|
||||
'repo-info': argparse.repo_info,
|
||||
'-I': argparse.repo_info,
|
||||
'configs': argparse.edit_configs,
|
||||
'-g': argparse.edit_configs,
|
||||
'clean-logs': argparse.clean_logs,
|
||||
|
|
|
@ -25,17 +25,17 @@ class SBoTable(Base):
|
|||
|
||||
__tablename__ = 'sbotable'
|
||||
|
||||
id: int = Column(Integer, primary_key=True) # type: ignore
|
||||
name: str = Column(Text) # type: ignore
|
||||
location: str = Column(Text) # type: ignore
|
||||
files: str = Column(Text) # type: ignore
|
||||
version: str = Column(Text) # type: ignore
|
||||
download: str = Column(Text) # type: ignore
|
||||
download64: str = Column(Text) # type: ignore
|
||||
md5sum: str = Column(Text) # type: ignore
|
||||
md5sum64: str = Column(Text) # type: ignore
|
||||
requires: str = Column(Text) # type: ignore
|
||||
short_description: str = Column(Text) # type: ignore
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
name: str = Column(Text)
|
||||
location: str = Column(Text)
|
||||
files: str = Column(Text)
|
||||
version: str = Column(Text)
|
||||
download: str = Column(Text)
|
||||
download64: str = Column(Text)
|
||||
md5sum: str = Column(Text)
|
||||
md5sum64: str = Column(Text)
|
||||
requires: str = Column(Text)
|
||||
short_description: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -44,17 +44,39 @@ class PonceTable(Base):
|
|||
|
||||
__tablename__ = 'poncetable'
|
||||
|
||||
id: int = Column(Integer, primary_key=True) # type: ignore
|
||||
name: str = Column(Text) # type: ignore
|
||||
location: str = Column(Text) # type: ignore
|
||||
files: str = Column(Text) # type: ignore
|
||||
version: str = Column(Text) # type: ignore
|
||||
download: str = Column(Text) # type: ignore
|
||||
download64: str = Column(Text) # type: ignore
|
||||
md5sum: str = Column(Text) # type: ignore
|
||||
md5sum64: str = Column(Text) # type: ignore
|
||||
requires: str = Column(Text) # type: ignore
|
||||
short_description: str = Column(Text) # type: ignore
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
name: str = Column(Text)
|
||||
location: str = Column(Text)
|
||||
files: str = Column(Text)
|
||||
version: str = Column(Text)
|
||||
download: str = Column(Text)
|
||||
download64: str = Column(Text)
|
||||
md5sum: str = Column(Text)
|
||||
md5sum64: str = Column(Text)
|
||||
requires: str = Column(Text)
|
||||
short_description: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
class BinariesTable(Base):
|
||||
""" The main table for the SBo repository. """
|
||||
|
||||
__tablename__ = 'binariestable'
|
||||
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
repo: str = Column(Text)
|
||||
name: str = Column(Text)
|
||||
version: str = Column(Text)
|
||||
package: str = Column(Text)
|
||||
mirror: str = Column(Text)
|
||||
location: str = Column(Text)
|
||||
size_comp: str = Column(Text)
|
||||
size_uncomp: str = Column(Text)
|
||||
required: str = Column(Text)
|
||||
conflicts: str = Column(Text)
|
||||
suggests: str = Column(Text)
|
||||
description: str = Column(Text)
|
||||
checksum: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -63,9 +85,20 @@ class LogsDependencies(Base):
|
|||
|
||||
__tablename__ = 'logsdependencies'
|
||||
|
||||
id: int = Column(Integer, primary_key=True) # type: ignore
|
||||
name: str = Column(Text) # type: ignore
|
||||
requires: str = Column(Text) # type: ignore
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
name: str = Column(Text)
|
||||
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)
|
||||
|
|
|
@ -16,11 +16,10 @@ from slpkg.models.models import session as Session
|
|||
class RemovePackages(Configs):
|
||||
""" Removes installed packages. """
|
||||
|
||||
def __init__(self, packages: list, flags: list, file_pattern: str):
|
||||
def __init__(self, packages: list, flags: list):
|
||||
super(Configs, self).__init__()
|
||||
self.packages: list = packages
|
||||
self.flags: list = flags
|
||||
self.file_pattern: str = file_pattern
|
||||
|
||||
self.session = Session
|
||||
self.color = self.colour()
|
||||
|
@ -46,8 +45,7 @@ class RemovePackages(Configs):
|
|||
""" Removes package with dependencies. """
|
||||
view = ViewMessage(self.flags)
|
||||
|
||||
self.installed_packages, self.dependencies = view.remove_packages(
|
||||
self.packages, self.file_pattern)
|
||||
self.installed_packages, self.dependencies = view.remove_packages(self.packages)
|
||||
|
||||
view.question()
|
||||
|
||||
|
@ -84,7 +82,7 @@ class RemovePackages(Configs):
|
|||
LogsDependencies.name == pkg).delete()
|
||||
self.session.commit()
|
||||
|
||||
def multi_process(self, command: str, package: str):
|
||||
def multi_process(self, command: str, package: str) -> None:
|
||||
""" Starting multiprocessing remove process. """
|
||||
if self.silent_mode and not self.utils.is_option(self.flag_no_silent, self.flags):
|
||||
|
||||
|
|
75
slpkg/repo_info.py
Normal file
75
slpkg/repo_info.py
Normal file
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import shutil
|
||||
|
||||
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):
|
||||
|
||||
def __init__(self):
|
||||
super(Configs, self).__init__()
|
||||
|
||||
self.utils = Utilities()
|
||||
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']
|
||||
self.red: str = self.color['red']
|
||||
self.cyan: str = self.color['cyan']
|
||||
self.grey: str = self.color['grey']
|
||||
self.yellow: str = self.color['yellow']
|
||||
self.byellow: str = f'{self.bold}{self.yellow}'
|
||||
self.endc: str = self.color['endc']
|
||||
|
||||
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)
|
||||
|
||||
for repo, value in self.repos.repositories.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.session.query(
|
||||
LastRepoUpdated.date).where(
|
||||
LastRepoUpdated.repo == repo).first()
|
||||
|
||||
if last is None:
|
||||
last: tuple = ('',)
|
||||
|
||||
if value[0]:
|
||||
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[0]:<35}"
|
||||
f"{self.yellow}{count:>12}{self.endc}")
|
||||
|
||||
print('=' * self.columns)
|
||||
print(f"{self.grey}Total of {enabled}/{len(self.repos.repositories)} "
|
||||
f"repositories are enabled with {total_packages} packages available.\n")
|
372
slpkg/repositories.py
Normal file
372
slpkg/repositories.py
Normal file
|
@ -0,0 +1,372 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import tomli
|
||||
from pathlib import Path
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
@dataclass
|
||||
class Repositories:
|
||||
config = Configs
|
||||
color = config.colour()
|
||||
bold: str = color['bold']
|
||||
red: str = color['red']
|
||||
cyan: str = color['cyan']
|
||||
endc: str = color['endc']
|
||||
bred: str = f'{bold}{red}'
|
||||
|
||||
repositories_file_toml = Path(config.etc_path, 'repositories.toml')
|
||||
|
||||
repos_config = {}
|
||||
repositories = {}
|
||||
bin_repos_name = []
|
||||
bin_enabled_repos = []
|
||||
sbo_enabled_repo: 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'
|
||||
|
||||
ponce_repo: bool = False
|
||||
ponce_repo_name: str = 'ponce'
|
||||
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'
|
||||
|
||||
slack_repo: bool = False
|
||||
slack_repo_name: str = 'slack'
|
||||
slack_repo_path: Path = Path(config.lib_path, 'repositories', slack_repo_name)
|
||||
slack_repo_mirror: str = 'https://slackware.uk/slackware/slackware64-15.0/'
|
||||
slack_repo_packages: str = 'PACKAGES.TXT'
|
||||
slack_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
slack_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
slack_extra_repo: bool = False
|
||||
slack_extra_repo_name: str = 'slack_extra'
|
||||
slack_extra_repo_path: Path = Path(config.lib_path, 'repositories', slack_extra_repo_name)
|
||||
slack_extra_repo_mirror: str = 'https://slackware.uk/slackware/slackware64-15.0/'
|
||||
slack_extra_packages_mirror: str = 'https://slackware.uk/slackware/slackware64-15.0/extra/'
|
||||
slack_extra_repo_packages: str = 'PACKAGES.TXT'
|
||||
slack_extra_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
slack_extra_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
slack_patches_repo: bool = False
|
||||
slack_patches_repo_name: str = 'slack_patches'
|
||||
slack_patches_repo_path: Path = Path(config.lib_path, 'repositories', slack_patches_repo_name)
|
||||
slack_patches_repo_mirror: str = 'https://slackware.uk/slackware/slackware64-15.0/'
|
||||
slack_patches_packages_mirror: str = 'https://slackware.uk/slackware/slackware64-15.0/patches/'
|
||||
slack_patches_repo_packages: str = 'PACKAGES.TXT'
|
||||
slack_patches_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
slack_patches_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
alien_repo: bool = False
|
||||
alien_repo_name: str = 'alien'
|
||||
alien_repo_path: Path = Path(config.lib_path, 'repositories', alien_repo_name)
|
||||
alien_repo_mirror: str = 'http://slackware.uk/people/alien/sbrepos/'
|
||||
alien_repo_packages_mirror: str = 'http://slackware.uk/people/alien/sbrepos/15.0/x86_64/'
|
||||
alien_repo_packages: str = 'PACKAGES.TXT'
|
||||
alien_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
alien_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
multilib_repo: bool = False
|
||||
multilib_repo_name: str = 'multilib'
|
||||
multilib_repo_path: Path = Path(config.lib_path, 'repositories', multilib_repo_name)
|
||||
multilib_repo_mirror: str = 'https://slackware.nl/people/alien/multilib/'
|
||||
multilib_repo_packages_mirror: str = 'https://slackware.nl/people/alien/multilib/15.0/'
|
||||
multilib_repo_packages: str = 'PACKAGES.TXT'
|
||||
multilib_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
multilib_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
restricted_repo: bool = False
|
||||
restricted_repo_name: str = 'restricted'
|
||||
restricted_repo_path: Path = Path(config.lib_path, 'repositories', restricted_repo_name)
|
||||
restricted_repo_mirror: str = 'https://slackware.nl/people/alien/restricted_sbrepos/'
|
||||
restricted_repo_packages_mirror: str = 'https://slackware.nl/people/alien/restricted_sbrepos/15.0/x86_64/'
|
||||
restricted_repo_packages: str = 'PACKAGES.TXT'
|
||||
restricted_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
restricted_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
gnome_repo: bool = False
|
||||
gnome_repo_name: str = 'gnome'
|
||||
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'
|
||||
|
||||
msb_repo: bool = False
|
||||
msb_repo_name: str = 'msb'
|
||||
msb_repo_path: Path = Path(config.lib_path, 'repositories', msb_repo_name)
|
||||
msb_repo_mirror: str = 'https://slackware.uk/msb/'
|
||||
msb_repo_packages_mirror: str = 'https://slackware.uk/msb/15.0/1.26/x86_64/'
|
||||
msb_repo_packages: str = 'PACKAGES.TXT'
|
||||
msb_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
msb_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
csb_repo: bool = False
|
||||
csb_repo_name: str = 'csb'
|
||||
csb_repo_path: Path = Path(config.lib_path, 'repositories', csb_repo_name)
|
||||
csb_repo_mirror: str = 'https://slackware.uk/csb/'
|
||||
csb_repo_packages_mirror: str = 'https://slackware.uk/csb/15.0/x86_64/'
|
||||
csb_repo_packages: str = 'PACKAGES.TXT'
|
||||
csb_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
csb_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
conraid_repo: bool = False
|
||||
conraid_repo_name: str = 'conraid'
|
||||
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'
|
||||
|
||||
slackonly_repo: bool = False
|
||||
slackonly_repo_name: str = 'slackonly'
|
||||
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'
|
||||
|
||||
salixos_repo: bool = False
|
||||
salixos_repo_name: str = 'salixos'
|
||||
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: bool = False
|
||||
salixos_extra_repo_name: str = 'salixos_extra'
|
||||
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'
|
||||
|
||||
salixos_patches_repo: bool = False
|
||||
salixos_patches_repo_name: str = 'salixos_patches'
|
||||
salixos_patches_repo_path: Path = Path(config.lib_path, 'repositories', salixos_patches_repo_name)
|
||||
salixos_patches_repo_mirror: str = 'https://download.salixos.org/x86_64/slackware-15.0/'
|
||||
salixos_patches_repo_packages_mirror: str = 'https://download.salixos.org/x86_64/slackware-15.0/patches/'
|
||||
salixos_patches_repo_packages: str = 'PACKAGES.TXT'
|
||||
salixos_patches_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
salixos_patches_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
slackel_repo: bool = False
|
||||
slackel_repo_name: str = 'slackel'
|
||||
slackel_repo_path: Path = Path(config.lib_path, 'repositories', slackel_repo_name)
|
||||
slackel_repo_mirror: str = 'http://www.slackel.gr/repo/x86_64/current/'
|
||||
slackel_repo_packages: str = 'PACKAGES.TXT'
|
||||
slackel_repo_checksums: str = 'CHECKSUMS.md5'
|
||||
slackel_repo_changelog: str = 'ChangeLog.txt'
|
||||
|
||||
slint_repo: bool = False
|
||||
slint_repo_name: str = 'slint'
|
||||
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
|
||||
|
||||
# The default enabled sbo repository.
|
||||
sbo_enabled_repository: str = sbo_repo_name
|
||||
|
||||
try:
|
||||
if repositories_file_toml.is_file():
|
||||
with open(repositories_file_toml, 'rb') as repo:
|
||||
repos_config = tomli.load(repo)['REPOSITORIES']
|
||||
|
||||
sbo_repo_name: str = repos_config['SBO_REPO_NAME']
|
||||
sbo_repo_mirror: str = repos_config['SBO_REPO_MIRROR']
|
||||
sbo_repo_slackbuilds: str = repos_config['SBO_REPO_SLACKBUILDS']
|
||||
sbo_repo_changelog: str = repos_config['SBO_REPO_CHANGELOG']
|
||||
sbo_repo_tar_suffix: str = repos_config['SBO_REPO_TAR_SUFFIX']
|
||||
sbo_repo_tag: str = repos_config['SBO_REPO_TAG']
|
||||
|
||||
ponce_repo: bool = repos_config['PONCE_REPO']
|
||||
ponce_repo_name: str = repos_config['PONCE_REPO_NAME']
|
||||
ponce_repo_mirror: str = repos_config['PONCE_REPO_MIRROR']
|
||||
ponce_repo_slackbuilds: str = repos_config['PONCE_REPO_SLACKBUILDS']
|
||||
ponce_repo_changelog: str = repos_config['PONCE_REPO_CHANGELOG']
|
||||
ponce_repo_tag: str = repos_config['PONCE_REPO_TAG']
|
||||
|
||||
slack_repo: bool = repos_config['SLACK_REPO']
|
||||
slack_repo_name: str = repos_config['SLACK_REPO_NAME']
|
||||
slack_repo_mirror: str = repos_config['SLACK_REPO_MIRROR']
|
||||
slack_repo_packages: str = repos_config['SLACK_REPO_PACKAGES']
|
||||
slack_repo_checksums: str = repos_config['SLACK_REPO_CHECKSUMS']
|
||||
slack_repo_changelog: str = repos_config['SLACK_REPO_CHANGELOG']
|
||||
|
||||
slack_extra_repo: bool = repos_config['SLACK_EXTRA_REPO']
|
||||
slack_extra_repo_name: str = repos_config['SLACK_EXTRA_REPO_NAME']
|
||||
slack_extra_repo_mirror: str = repos_config['SLACK_EXTRA_REPO_MIRROR']
|
||||
slack_extra_repo_packages_mirror: str = repos_config['SLACK_EXTRA_REPO_PACKAGES_MIRROR']
|
||||
slack_extra_repo_packages: str = repos_config['SLACK_EXTRA_REPO_PACKAGES']
|
||||
slack_extra_repo_checksums: str = repos_config['SLACK_EXTRA_REPO_CHECKSUMS']
|
||||
slack_extra_repo_changelog: str = repos_config['SLACK_EXTRA_REPO_CHANGELOG']
|
||||
|
||||
slack_patches_repo: bool = repos_config['SLACK_PATCHES_REPO']
|
||||
slack_patches_repo_name: str = repos_config['SLACK_PATCHES_REPO_NAME']
|
||||
slack_patches_repo_mirror: str = repos_config['SLACK_PATCHES_REPO_MIRROR']
|
||||
slack_patches_repo_packages_mirror: str = repos_config['SLACK_PATCHES_REPO_PACKAGES_MIRROR']
|
||||
slack_patches_repo_packages: str = repos_config['SLACK_PATCHES_REPO_PACKAGES']
|
||||
slack_patches_repo_checksums: str = repos_config['SLACK_PATCHES_REPO_CHECKSUMS']
|
||||
slack_patches_repo_changelog: str = repos_config['SLACK_PATCHES_REPO_CHANGELOG']
|
||||
|
||||
alien_repo: bool = repos_config['ALIEN_REPO']
|
||||
alien_repo_name: str = repos_config['ALIEN_REPO_NAME']
|
||||
alien_repo_mirror: str = repos_config['ALIEN_REPO_MIRROR']
|
||||
alien_repo_packages_mirror: str = repos_config['ALIEN_REPO_PACKAGES_MIRROR']
|
||||
alien_repo_packages: str = repos_config['ALIEN_REPO_PACKAGES']
|
||||
alien_repo_checksums: str = repos_config['ALIEN_REPO_CHECKSUMS']
|
||||
alien_repo_changelog: str = repos_config['ALIEN_REPO_CHANGELOG']
|
||||
|
||||
multilib_repo: bool = repos_config['MULTILIB_REPO']
|
||||
multilib_repo_name: str = repos_config['MULTILIB_REPO_NAME']
|
||||
multilib_repo_mirror: str = repos_config['MULTILIB_REPO_MIRROR']
|
||||
multilib_repo_packages_mirror: str = repos_config['MULTILIB_REPO_PACKAGES_MIRROR']
|
||||
multilib_repo_packages: str = repos_config['MULTILIB_REPO_PACKAGES']
|
||||
multilib_repo_checksums: str = repos_config['MULTILIB_REPO_CHECKSUMS']
|
||||
multilib_repo_changelog: str = repos_config['MULTILIB_REPO_CHANGELOG']
|
||||
|
||||
restricted_repo: bool = repos_config['RESTRICTED_REPO']
|
||||
restricted_repo_name: str = repos_config['RESTRICTED_REPO_NAME']
|
||||
restricted_repo_mirror: str = repos_config['RESTRICTED_REPO_MIRROR']
|
||||
restricted_repo_packages_mirror: str = repos_config['RESTRICTED_REPO_PACKAGES_MIRROR']
|
||||
restricted_repo_packages: str = repos_config['RESTRICTED_REPO_PACKAGES']
|
||||
restricted_repo_checksums: str = repos_config['RESTRICTED_REPO_CHECKSUMS']
|
||||
restricted_repo_changelog: str = repos_config['RESTRICTED_REPO_CHANGELOG']
|
||||
|
||||
gnome_repo: bool = repos_config['GNOME_REPO']
|
||||
gnome_repo_name: str = repos_config['GNOME_REPO_NAME']
|
||||
gnome_repo_mirror: str = repos_config['GNOME_REPO_MIRROR']
|
||||
gnome_repo_packages: str = repos_config['GNOME_REPO_PACKAGES']
|
||||
gnome_repo_checksums: str = repos_config['GNOME_REPO_CHECKSUMS']
|
||||
gnome_repo_changelog: str = repos_config['GNOME_REPO_CHANGELOG']
|
||||
|
||||
msb_repo: bool = repos_config['MSB_REPO']
|
||||
msb_repo_name: str = repos_config['MSB_REPO_NAME']
|
||||
msb_repo_mirror: str = repos_config['MSB_REPO_MIRROR']
|
||||
msb_repo_packages_mirror: str = repos_config['MSB_REPO_PACKAGES_MIRROR']
|
||||
msb_repo_packages: str = repos_config['MSB_REPO_PACKAGES']
|
||||
msb_repo_checksums: str = repos_config['MSB_REPO_CHECKSUMS']
|
||||
msb_repo_changelog: str = repos_config['MSB_REPO_CHANGELOG']
|
||||
|
||||
csb_repo: bool = repos_config['CSB_REPO']
|
||||
csb_repo_name: str = repos_config['CSB_REPO_NAME']
|
||||
csb_repo_mirror: str = repos_config['CSB_REPO_MIRROR']
|
||||
csb_repo_packages_mirror: str = repos_config['CSB_REPO_PACKAGES_MIRROR']
|
||||
csb_repo_packages: str = repos_config['CSB_REPO_PACKAGES']
|
||||
csb_repo_checksums: str = repos_config['CSB_REPO_CHECKSUMS']
|
||||
csb_repo_changelog: str = repos_config['CSB_REPO_CHANGELOG']
|
||||
|
||||
conraid_repo: bool = repos_config['CONRAID_REPO']
|
||||
conraid_repo_name: str = repos_config['CONRAID_REPO_NAME']
|
||||
conraid_repo_mirror: str = repos_config['CONRAID_REPO_MIRROR']
|
||||
conraid_repo_packages: str = repos_config['CONRAID_REPO_PACKAGES']
|
||||
conraid_repo_checksums: str = repos_config['CONRAID_REPO_CHECKSUMS']
|
||||
conraid_repo_changelog: str = repos_config['CONRAID_REPO_CHANGELOG']
|
||||
|
||||
slackonly_repo: bool = repos_config['SLACKONLY_REPO']
|
||||
slackonly_repo_name: str = repos_config['SLACKONLY_REPO_NAME']
|
||||
slackonly_repo_mirror: str = repos_config['SLACKONLY_REPO_MIRROR']
|
||||
slackonly_repo_packages: str = repos_config['SLACKONLY_REPO_PACKAGES']
|
||||
slackonly_repo_checksums: str = repos_config['SLACKONLY_REPO_CHECKSUMS']
|
||||
slackonly_repo_changelog: str = repos_config['SLACKONLY_REPO_CHANGELOG']
|
||||
|
||||
salixos_repo: bool = repos_config['SALIXOS_REPO']
|
||||
salixos_repo_name: str = repos_config['SALIXOS_REPO_NAME']
|
||||
salixos_repo_mirror: str = repos_config['SALIXOS_REPO_MIRROR']
|
||||
salixos_repo_packages: str = repos_config['SALIXOS_REPO_PACKAGES']
|
||||
salixos_repo_checksums: str = repos_config['SALIXOS_REPO_CHECKSUMS']
|
||||
salixos_repo_changelog: str = repos_config['SALIXOS_REPO_CHANGELOG']
|
||||
|
||||
salixos_extra_repo: bool = repos_config['SALIXOS_EXTRA_REPO']
|
||||
salixos_extra_repo_name: str = repos_config['SALIXOS_EXTRA_REPO_NAME']
|
||||
salixos_extra_repo_mirror: str = repos_config['SALIXOS_EXTRA_REPO_MIRROR']
|
||||
salixos_extra_repo_packages_mirror: str = repos_config['SALIXOS_EXTRA_REPO_PACKAGES_MIRROR']
|
||||
salixos_extra_repo_packages: str = repos_config['SALIXOS_EXTRA_REPO_PACKAGES']
|
||||
salixos_extra_repo_checksums: str = repos_config['SALIXOS_EXTRA_REPO_CHECKSUMS']
|
||||
salixos_extra_repo_changelog: str = repos_config['SALIXOS_EXTRA_REPO_CHANGELOG']
|
||||
|
||||
salixos_patches_repo: bool = repos_config['SALIXOS_PATCHES_REPO']
|
||||
salixos_patches_repo_name: str = repos_config['SALIXOS_PATCHES_REPO_NAME']
|
||||
salixos_patches_repo_mirror: str = repos_config['SALIXOS_PATCHES_REPO_MIRROR']
|
||||
salixos_patches_repo_packages_mirror: str = repos_config['SALIXOS_PATCHES_REPO_PACKAGES_MIRROR']
|
||||
salixos_patches_repo_packages: str = repos_config['SALIXOS_PATCHES_REPO_PACKAGES']
|
||||
salixos_patches_repo_checksums: str = repos_config['SALIXOS_PATCHES_REPO_CHECKSUMS']
|
||||
salixos_patches_repo_changelog: str = repos_config['SALIXOS_PATCHES_REPO_CHANGELOG']
|
||||
|
||||
slackel_repo: bool = repos_config['SLACKEL_REPO']
|
||||
slackel_repo_name: str = repos_config['SLACKEL_REPO_NAME']
|
||||
slackel_repo_mirror: str = repos_config['SLACKEL_REPO_MIRROR']
|
||||
slackel_repo_packages: str = repos_config['SLACKEL_REPO_PACKAGES']
|
||||
slackel_repo_checksums: str = repos_config['SLACKEL_REPO_CHECKSUMS']
|
||||
slackel_repo_changelog: str = repos_config['SLACKEL_REPO_CHANGELOG']
|
||||
|
||||
slint_repo: bool = repos_config['SLINT_REPO']
|
||||
slint_repo_name: str = repos_config['SLINT_REPO_NAME']
|
||||
slint_repo_mirror: str = repos_config['SLINT_REPO_MIRROR']
|
||||
slint_repo_packages: str = repos_config['SLINT_REPO_PACKAGES']
|
||||
slint_repo_checksums: str = repos_config['SLINT_REPO_CHECKSUMS']
|
||||
slint_repo_changelog: str = repos_config['SLINT_REPO_CHANGELOG']
|
||||
|
||||
except (tomli.TOMLDecodeError, KeyError) as error:
|
||||
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")
|
||||
|
||||
# Switch to ponce repository if is true.
|
||||
if ponce_repo:
|
||||
sbo_enabled_repository: str = ponce_repo_name
|
||||
repo_tag: str = ponce_repo_tag
|
||||
sbo_enabled_repo: bool = False
|
||||
|
||||
# List of repositories.
|
||||
repositories = {
|
||||
sbo_repo_name: [sbo_enabled_repo, sbo_repo_path, sbo_repo_changelog],
|
||||
ponce_repo_name: [ponce_repo, ponce_repo_path, ponce_repo_changelog],
|
||||
slack_repo_name: [slack_repo, slack_repo_path, slack_repo_changelog],
|
||||
slack_extra_repo_name: [slack_extra_repo, slack_extra_repo_path, slack_extra_repo_changelog],
|
||||
slack_patches_repo_name: [slack_patches_repo, slack_patches_repo_path, slack_patches_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],
|
||||
csb_repo_name: [csb_repo, csb_repo_path, csb_repo_changelog],
|
||||
conraid_repo_name: [conraid_repo, conraid_repo_path, conraid_repo_changelog],
|
||||
slackonly_repo_name: [slackonly_repo, slackonly_repo_path, slackonly_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],
|
||||
salixos_patches_repo_name: [salixos_patches_repo_name, salixos_patches_repo_path,
|
||||
salixos_patches_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(repositories.keys())[2:]
|
||||
|
||||
# All the enabled binary repositories names.
|
||||
for repo, enabled in repositories.items():
|
||||
if repo not in [sbo_repo_name, ponce_repo_name]:
|
||||
if enabled[0]:
|
||||
bin_enabled_repos.append(repo)
|
0
slpkg/sbos/__init__.py
Normal file
0
slpkg/sbos/__init__.py
Normal file
33
slpkg/sbos/dependencies.py
Normal file
33
slpkg/sbos/dependencies.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
|
||||
|
||||
class Requires:
|
||||
""" Creates a list of dependencies with
|
||||
the right order to install. """
|
||||
|
||||
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()
|
||||
|
||||
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_requires: list[str] = SBoQueries(req).requires()
|
||||
for sub in sub_requires:
|
||||
requires.append(sub)
|
||||
|
||||
requires.reverse()
|
||||
|
||||
return list(dict.fromkeys(requires))
|
|
@ -2,9 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Union
|
||||
from sqlalchemy import inspect
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.blacklist import Blacklist
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import session as Session
|
||||
from slpkg.models.models import SBoTable, PonceTable
|
||||
|
||||
|
@ -16,6 +18,7 @@ class SBoQueries(Configs):
|
|||
super(Configs, self).__init__()
|
||||
self.name: str = name
|
||||
self.session = Session
|
||||
self.repos = Repositories()
|
||||
|
||||
self.black = Blacklist()
|
||||
if self.name in self.black.packages():
|
||||
|
@ -23,9 +26,25 @@ class SBoQueries(Configs):
|
|||
|
||||
# Switch between sbo and ponce repository.
|
||||
self.sbo_table = SBoTable
|
||||
if self.ponce_repo:
|
||||
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)
|
||||
repo = self.repos.sbo_repo_name
|
||||
if table.tables[0].name == 'poncetable':
|
||||
repo = self.repos.ponce_repo_name
|
||||
|
||||
return repo
|
||||
|
||||
def sbos(self) -> list:
|
||||
""" Returns all the slackbuilds. """
|
||||
sbos: tuple = self.session.query(self.sbo_table.name).all() # type: ignore
|
||||
|
@ -62,8 +81,8 @@ class SBoQueries(Configs):
|
|||
|
||||
def requires(self) -> Union[str, list]:
|
||||
""" Returns the requirements of a slackbuild. """
|
||||
requires: tuple = self.session.query( # type: ignore
|
||||
self.sbo_table.requires).filter( # type: ignore
|
||||
requires: tuple = self.session.query(
|
||||
self.sbo_table.requires).filter(
|
||||
self.sbo_table.name == self.name).first()
|
||||
|
||||
if requires:
|
||||
|
@ -114,3 +133,10 @@ class SBoQueries(Configs):
|
|||
if files:
|
||||
return files[0]
|
||||
return ''
|
||||
|
||||
def all_sbo_and_requires(self) -> list:
|
||||
""" Returns all package with the dependencies. """
|
||||
requires: list = self.session.query(
|
||||
self.sbo_table.name, self.sbo_table.requires).all()
|
||||
|
||||
return requires
|
|
@ -7,19 +7,20 @@ import shutil
|
|||
import subprocess
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
from collections import OrderedDict
|
||||
from multiprocessing import Process, cpu_count
|
||||
|
||||
from slpkg.checksum import Md5sum
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.upgrade import Upgrade
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.dialog_box import DialogBox
|
||||
from slpkg.dependencies import Requires
|
||||
from slpkg.downloader import Downloader
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.progress_bar import ProgressBar
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.sbos.dependencies import Requires
|
||||
from slpkg.models.models import LogsDependencies
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
@ -27,24 +28,24 @@ from slpkg.models.models import session as Session
|
|||
class Slackbuilds(Configs):
|
||||
""" Download build and install the SlackBuilds. """
|
||||
|
||||
def __init__(self, slackbuilds: list, flags: list, file_pattern, mode: str):
|
||||
def __init__(self, slackbuilds: list, flags: list, mode: str):
|
||||
super(Configs, self).__init__()
|
||||
self.slackbuilds: list = slackbuilds
|
||||
self.flags: list = flags
|
||||
self.file_pattern: str = file_pattern
|
||||
self.mode: str = mode
|
||||
|
||||
self.session = Session
|
||||
self.repos = Repositories()
|
||||
self.utils = Utilities()
|
||||
self.progress = ProgressBar()
|
||||
self.dialogbox = DialogBox()
|
||||
self.upgrade = Upgrade(self.flags)
|
||||
self.view_message = ViewMessage(self.flags)
|
||||
self.color = self.colour()
|
||||
|
||||
self.install_order: list = []
|
||||
self.dependencies: list = []
|
||||
self.sbos: dict = {}
|
||||
self.output: int = 0
|
||||
self.stderr = None
|
||||
self.stdout = None
|
||||
self.process_message: str = ''
|
||||
|
@ -61,15 +62,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_dependencies_for_build()
|
||||
self.creating_main_for_build()
|
||||
|
||||
self.view_before_build()
|
||||
|
||||
start: float = time.time()
|
||||
|
@ -82,25 +81,19 @@ class Slackbuilds(Configs):
|
|||
def creating_dictionary(self) -> None:
|
||||
""" Dictionary with the main slackbuilds and dependencies. """
|
||||
for sbo in self.slackbuilds:
|
||||
self.sbos[sbo] = Requires(sbo).resolve()
|
||||
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:
|
||||
""" List with the dependencies. """
|
||||
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.ponce_repo:
|
||||
location: str = SBoQueries(dep).location()
|
||||
path_ponce_repo_package = Path(self.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, self.file_pattern)):
|
||||
self.utils.is_package_installed(dep)):
|
||||
continue
|
||||
|
||||
self.dependencies.append(dep)
|
||||
|
@ -133,11 +126,19 @@ class Slackbuilds(Configs):
|
|||
|
||||
self.view_message.question()
|
||||
|
||||
def is_not_for_skipped(self, sbo) -> Literal[True]:
|
||||
""" Condition to check if slackbuild is for skipped. """
|
||||
return (not self.utils.is_package_installed(sbo, self.file_pattern) or
|
||||
self.utils.is_package_upgradeable(sbo, self.file_pattern) 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. """
|
||||
|
@ -146,32 +147,35 @@ class Slackbuilds(Configs):
|
|||
|
||||
for sbo in self.install_order:
|
||||
|
||||
if self.is_not_for_skipped(sbo):
|
||||
if self.continue_build_or_install(sbo):
|
||||
|
||||
self.utils.remove_folder_if_exists(f'{self.build_path}{sbo}')
|
||||
build_path: Path = Path(self.build_path, sbo)
|
||||
|
||||
self.utils.remove_folder_if_exists(build_path)
|
||||
location: str = SBoQueries(sbo).location()
|
||||
slackbuild = Path(self.build_path, sbo, f'{sbo}.SlackBuild')
|
||||
|
||||
# Copy slackbuilds to the build folder.
|
||||
if self.ponce_repo:
|
||||
path_ponce_repo_package = Path(self.ponce_repo_path, location, sbo)
|
||||
shutil.copytree(path_ponce_repo_package, f'{self.build_path}{sbo}')
|
||||
if self.repos.ponce_repo:
|
||||
path_ponce_repo_package = Path(self.repos.ponce_repo_path, location, sbo)
|
||||
shutil.copytree(path_ponce_repo_package, build_path)
|
||||
else:
|
||||
path_sbo_repo_package = Path(self.sbo_repo_path, location, sbo)
|
||||
shutil.copytree(path_sbo_repo_package, f'{self.build_path}{sbo}')
|
||||
path_sbo_repo_package = Path(self.repos.sbo_repo_path, location, sbo)
|
||||
shutil.copytree(path_sbo_repo_package, build_path)
|
||||
|
||||
os.chmod(slackbuild, 0o775)
|
||||
sources[sbo] = SBoQueries(sbo).sources()
|
||||
sources_urls += SBoQueries(sbo).sources()
|
||||
|
||||
# Download the sources.
|
||||
down_urls = Downloader(self.build_path, sources_urls, self.flags)
|
||||
down_urls.download()
|
||||
if sources:
|
||||
down_urls = Downloader(self.build_path, sources_urls, self.flags)
|
||||
down_urls.download()
|
||||
|
||||
print() # New line here.
|
||||
print() # New line here.
|
||||
|
||||
self.move_sources(sources)
|
||||
self.checksum_downloads()
|
||||
self.move_sources(sources)
|
||||
self.checksum_downloads()
|
||||
|
||||
def move_sources(self, sources: dict) -> None:
|
||||
""" Move the sources into the folders for build. """
|
||||
|
@ -196,19 +200,19 @@ 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):
|
||||
self.logging_installed_dependencies(sbo)
|
||||
else:
|
||||
package: str = self.utils.is_package_installed(sbo, self.file_pattern)
|
||||
version: str = self.utils.split_installed_pkg(package)[1]
|
||||
package: str = self.utils.is_package_installed(sbo)
|
||||
version: str = self.utils.split_binary_pkg(package)[1]
|
||||
self.view_message.view_skipping_packages(sbo, version)
|
||||
|
||||
def patch_sbo_tag(self, sbo: str) -> None:
|
||||
|
@ -222,12 +226,12 @@ class Slackbuilds(Configs):
|
|||
with open(sbo_script, 'w') as script:
|
||||
for line in lines:
|
||||
if line.startswith('TAG=$'):
|
||||
line: str = f'TAG=${{TAG:-{self.repo_tag}}}\n'
|
||||
line: str = f'TAG=${{TAG:-{self.repos.repo_tag}}}\n'
|
||||
script.write(line)
|
||||
|
||||
def logging_installed_dependencies(self, name: str) -> None:
|
||||
""" Logging installed dependencies and used for remove. """
|
||||
exist = self.session.query(LogsDependencies.name).filter( # type: ignore
|
||||
exist = self.session.query(LogsDependencies.name).filter(
|
||||
LogsDependencies.name == name).first()
|
||||
|
||||
requires: list = Requires(name).resolve()
|
||||
|
@ -246,15 +250,15 @@ class Slackbuilds(Configs):
|
|||
|
||||
def install_package(self, package: str) -> None:
|
||||
""" Install the packages that before created in the tmp directory. """
|
||||
pkg: str = self.utils.split_installed_pkg(package)[0]
|
||||
pkg: str = self.utils.split_binary_pkg(package)[0]
|
||||
|
||||
execute: str = self.installpkg
|
||||
if (self.utils.is_option(self.flag_reinstall, self.flags) and
|
||||
self.utils.is_package_installed(pkg, self.file_pattern)):
|
||||
self.utils.is_package_installed(pkg)):
|
||||
execute: str = self.reinstall
|
||||
|
||||
message: str = f'{self.cyan}Installing{self.endc}'
|
||||
self.process_message: str = f"'{pkg}' to install"
|
||||
self.process_message: str = f"package '{pkg}' to install"
|
||||
|
||||
if self.mode == 'upgrade':
|
||||
self.process_message: str = f"package '{pkg}' to upgrade"
|
||||
|
@ -264,19 +268,23 @@ 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. """
|
||||
package_to_install: str = ''
|
||||
version: str = SBoQueries(name).version()
|
||||
|
||||
pattern: str = f'{name}-{version}*{self.repo_tag}*'
|
||||
pattern: str = f'{name}-{version}*{self.repos.repo_tag}*'
|
||||
|
||||
tmp = Path(self.tmp_path)
|
||||
packages: list = [file.name for file in tmp.glob(pattern)]
|
||||
|
||||
return max(packages)
|
||||
try:
|
||||
package_to_install: str = max(packages)
|
||||
except ValueError:
|
||||
self.utils.raise_error_message(f"Package '{name}' not found for install")
|
||||
|
||||
def build_the_script(self, path: str, name: str) -> None:
|
||||
return package_to_install
|
||||
|
||||
def build_the_script(self, path: Path, name: str) -> None:
|
||||
""" Run the .SlackBuild script. """
|
||||
folder: str = f'{Path(path, name)}/'
|
||||
execute: str = f'{folder}./{name}.SlackBuild'
|
||||
|
@ -322,11 +330,10 @@ class Slackbuilds(Configs):
|
|||
if not p1.is_alive():
|
||||
|
||||
if p1.exitcode != 0:
|
||||
done: str = f' {self.bred} Failed{self.endc}'
|
||||
self.output: int = p1.exitcode # type: ignore
|
||||
done: str = f'{self.bred}Failed: {self.endc}{self.process_message}.'
|
||||
|
||||
print(f'{self.endc}{done}', end='')
|
||||
p2.terminate()
|
||||
print(f'{self.endc}{done}', end='')
|
||||
|
||||
# Wait until process 2 finish
|
||||
p2.join()
|
||||
|
@ -336,13 +343,6 @@ class Slackbuilds(Configs):
|
|||
else:
|
||||
self.utils.process(command, self.stderr, self.stdout)
|
||||
|
||||
self.print_error()
|
||||
|
||||
def print_error(self) -> None:
|
||||
""" Stop the process and print the error message. """
|
||||
if self.output != 0:
|
||||
self.utils.raise_error_message(f"{self.output}: {self.process_message}")
|
||||
|
||||
def choose_dependencies(self, dependencies: list) -> list:
|
||||
""" Choose packages for install. """
|
||||
height: int = 10
|
||||
|
@ -357,17 +357,15 @@ class Slackbuilds(Configs):
|
|||
repo_ver: str = SBoQueries(package).version()
|
||||
description: str = SBoQueries(package).description()
|
||||
help_text: str = f'Description: {description}'
|
||||
upgradable: bool = self.upgrade.is_package_upgradeable(package)
|
||||
|
||||
if self.mode == 'build':
|
||||
status: bool = True
|
||||
|
||||
if self.mode == 'upgrade' and self.utils.is_package_upgradeable(package, self.file_pattern):
|
||||
if self.mode == 'upgrade' and upgradable:
|
||||
status: bool = True
|
||||
|
||||
if self.mode == 'install' and not self.utils.is_package_installed(package, self.file_pattern):
|
||||
status: bool = True
|
||||
|
||||
if self.mode == 'install' and self.utils.is_package_upgradeable(package, self.file_pattern):
|
||||
if self.mode == 'install' and upgradable:
|
||||
status: bool = True
|
||||
|
||||
choices += [(package, repo_ver, status, help_text)]
|
|
@ -2,15 +2,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
class SearchPackage(Configs):
|
||||
""" Search slackbuilds from the repository. """
|
||||
""" Search packages from the repositories. """
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, flags=None):
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
|
||||
self.color = self.colour()
|
||||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.yellow: str = self.color['yellow']
|
||||
self.cyan: str = self.color['cyan']
|
||||
|
@ -18,22 +25,64 @@ class SearchPackage(Configs):
|
|||
self.grey: str = self.color['grey']
|
||||
self.endc: str = self.color['endc']
|
||||
|
||||
def package(self, packages: list) -> None:
|
||||
""" Searching and print the matched slackbuilds. """
|
||||
matching: int = 0
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
names: list = SBoQueries('').sbos()
|
||||
def package(self, packages: list, repo=None) -> None:
|
||||
""" Searching and print the matched packages. """
|
||||
matching: int = 0
|
||||
repository: str = ''
|
||||
|
||||
print(f'The list below shows the repo '
|
||||
f'packages that contains \'{", ".join([p for p in packages])}\':\n')
|
||||
|
||||
for name in names:
|
||||
for package in packages:
|
||||
if package in name:
|
||||
matching += 1
|
||||
desc: str = SBoQueries(name).description().replace(name, '')
|
||||
print(f'{self.cyan}{name}{self.endc}-{self.yellow}{SBoQueries(name).version()}{self.endc}'
|
||||
f'{self.green}{desc}{self.endc}')
|
||||
# Searching for binaries.
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
if repo == '*':
|
||||
pkg_repo: tuple = BinQueries('', repo).all_package_names_from_repositories()
|
||||
|
||||
for pkg in packages:
|
||||
for pr in pkg_repo:
|
||||
|
||||
if pkg in pr[0] or pkg == '*':
|
||||
matching += 1
|
||||
|
||||
desc: str = BinQueries(pr[0], pr[1]).description()
|
||||
version: str = BinQueries(pr[0], pr[1]).version()
|
||||
|
||||
if repo == '*':
|
||||
repository: str = f'{pr[1]}: '
|
||||
|
||||
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()
|
||||
for name in names:
|
||||
for package in packages:
|
||||
|
||||
if package in name or package == '*':
|
||||
matching += 1
|
||||
|
||||
desc: str = SBoQueries(name).description().replace(name, '')
|
||||
version: str = SBoQueries(name).version()
|
||||
|
||||
print(f'{self.cyan}{name}{self.endc}-{self.yellow}'
|
||||
f'{version}{self.endc}{self.green}{desc}{self.endc}')
|
||||
|
||||
if not matching:
|
||||
print('\nDoes not match any package.\n')
|
||||
|
|
|
@ -3,21 +3,23 @@
|
|||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.views.ascii import Ascii
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.dependencies import Requires
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.sbos.dependencies import Requires
|
||||
from slpkg.binaries.required import Required
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
class Tracking(Configs, Utilities):
|
||||
class Tracking(Configs):
|
||||
""" Tracking of the package dependencies. """
|
||||
|
||||
def __init__(self, flags: list):
|
||||
super(Configs, self).__init__()
|
||||
super(Utilities, self).__init__()
|
||||
self.flags: list = flags
|
||||
|
||||
self.ascii = Ascii()
|
||||
self.color = self.colour()
|
||||
self.utils = Utilities()
|
||||
|
||||
self.llc: str = self.ascii.lower_left_corner
|
||||
self.hl: str = self.ascii.horizontal_line
|
||||
|
@ -27,36 +29,55 @@ class Tracking(Configs, Utilities):
|
|||
self.yellow: str = self.color['yellow']
|
||||
self.endc: str = self.color['endc']
|
||||
self.flag_pkg_version: list = ['-p', '--pkg-version']
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
def packages(self, packages: list) -> None:
|
||||
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.is_option(self.flag_pkg_version, self.flags):
|
||||
pkg = f'{self.yellow}{package}-{SBoQueries(package).version()}{self.endc}'
|
||||
if self.utils.is_option(self.flag_pkg_version, self.flags):
|
||||
|
||||
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}'
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
requires: list = Required(package, repo).resolve()
|
||||
else:
|
||||
requires: list = Requires(package).resolve()
|
||||
|
||||
requires: list = Requires(package).resolve()
|
||||
how_many: int = len(requires)
|
||||
|
||||
if not requires:
|
||||
requires = ['No dependencies']
|
||||
|
||||
print(pkg)
|
||||
print(char, end='')
|
||||
for i, req in enumerate(requires, start=1):
|
||||
require: str = f'{self.cyan}{req}{self.endc}'
|
||||
|
||||
if self.is_option(self.flag_pkg_version, self.flags):
|
||||
require: str = f'{self.cyan}{req}{self.endc}-{self.yellow}{SBoQueries(req).version()}{self.endc}'
|
||||
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 i == 1:
|
||||
print(f' {require}')
|
||||
else:
|
||||
print(f'{sp}{require}')
|
||||
if self.utils.is_option(self.flag_pkg_version, self.flags):
|
||||
|
||||
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}"
|
||||
|
||||
require: str = f'{self.cyan}{req}{self.endc}{version}'
|
||||
|
||||
if i == 1:
|
||||
print(f' {require}')
|
||||
else:
|
||||
print(f'{sp}{require}')
|
||||
|
||||
print(f'\n{self.grey}{how_many} dependencies for {package}{self.endc}\n')
|
||||
|
|
|
@ -7,29 +7,41 @@ from multiprocessing import Process, Queue
|
|||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.install_data import CreateData
|
||||
from slpkg.downloader import Downloader
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.progress_bar import ProgressBar
|
||||
from slpkg.install_data import InstallData
|
||||
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)
|
||||
PonceTable, BinariesTable,
|
||||
LastRepoUpdated)
|
||||
|
||||
|
||||
class UpdateRepository(Configs):
|
||||
""" Deletes and install the data. """
|
||||
|
||||
def __init__(self, flags: list):
|
||||
def __init__(self, flags: list, repo: str):
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.repo: str = repo
|
||||
self.session = Session
|
||||
self.view = ViewMessage(self.flags)
|
||||
|
||||
self.repos = Repositories()
|
||||
self.progress = ProgressBar()
|
||||
self.utils = Utilities()
|
||||
self.color = self.colour()
|
||||
self.data = InstallData()
|
||||
self.check_updates = CheckUpdates(
|
||||
self.flags, self.repo
|
||||
)
|
||||
|
||||
self.update: int = 0
|
||||
if not self.repo:
|
||||
self.repo = self.repos.sbo_enabled_repository
|
||||
|
||||
self.repos_for_update: dict = {}
|
||||
self.bold: str = self.color['bold']
|
||||
self.green: str = self.color['green']
|
||||
self.red: str = self.color['red']
|
||||
|
@ -38,65 +50,563 @@ class UpdateRepository(Configs):
|
|||
self.bred: str = f'{self.bold}{self.red}'
|
||||
self.endc: str = self.color['endc']
|
||||
self.flag_generate: list = ['-G', '--generate-only']
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
def update_the_repository(self) -> None:
|
||||
""" Updated the sbo repository. """
|
||||
if self.update == 0:
|
||||
def update_the_repositories(self) -> None:
|
||||
if not self.repos_for_update.values() or self.repo not in self.repos_for_update.keys():
|
||||
self.view.question()
|
||||
else:
|
||||
print()
|
||||
|
||||
if self.ponce_repo:
|
||||
bin_repositories: dict = {
|
||||
self.repos.slack_repo_name: self.slack_repository,
|
||||
self.repos.slack_extra_repo_name: self.slack_extra_repository,
|
||||
self.repos.slack_patches_repo_name: self.slack_patches_repository,
|
||||
self.repos.alien_repo_name: self.alien_repository,
|
||||
self.repos.multilib_repo_name: self.multilib_repository,
|
||||
self.repos.restricted_repo_name: self.restricted_repository,
|
||||
self.repos.gnome_repo_name: self.gnome_repository,
|
||||
self.repos.msb_repo_name: self.msb_repository,
|
||||
self.repos.csb_repo_name: self.csb_repository,
|
||||
self.repos.conraid_repo_name: self.conraid_repository,
|
||||
self.repos.slackonly_repo_name: self.slackonly_repository,
|
||||
self.repos.salixos_repo_name: self.salixos_repository,
|
||||
self.repos.salixos_extra_repo_name: self.salixos_extra_repository,
|
||||
self.repos.salixos_patches_repo_name: self.salixos_patches_repository,
|
||||
self.repos.slackel_repo_name: self.slackel_repository,
|
||||
self.repos.slint_repo_name: self.slint_repository
|
||||
}
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
|
||||
for repo in bin_repositories.keys():
|
||||
|
||||
if repo == self.repo:
|
||||
bin_repositories[repo]()
|
||||
break
|
||||
|
||||
if self.repo == '*':
|
||||
bin_repositories[repo]()
|
||||
else:
|
||||
self.slackbuild_repositories()
|
||||
|
||||
def slack_repository(self):
|
||||
if self.repos.slack_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.slack_repo_name}{self.endc}"
|
||||
f"' repository, please wait...\n")
|
||||
self.make_dirs(self.repos.slack_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.slack_repo_mirror}{self.repos.slack_repo_packages}')
|
||||
urls.append(f'{self.repos.slack_repo_mirror}{self.repos.slack_repo_changelog}')
|
||||
urls.append(f'{self.repos.slack_repo_mirror}{self.repos.slack_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.slack_repo_path, self.repos.slack_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.slack_repo_path, self.repos.slack_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.slack_repo_path, self.repos.slack_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.slack_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.slack_repo_name)
|
||||
self.delete_last_updated(self.repos.slack_repo_name)
|
||||
self.data.install_slack_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.slack_repo_name)
|
||||
|
||||
def slack_extra_repository(self):
|
||||
if self.repos.slack_extra_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.slack_extra_repo_name}{self.endc}"
|
||||
f"' repository, please wait...\n")
|
||||
self.make_dirs(self.repos.slack_extra_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.slack_extra_repo_packages_mirror}{self.repos.slack_extra_repo_packages}')
|
||||
urls.append(f'{self.repos.slack_extra_repo_mirror}{self.repos.slack_extra_repo_changelog}')
|
||||
urls.append(f'{self.repos.slack_extra_repo_mirror}{self.repos.slack_extra_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.slack_extra_repo_path,
|
||||
self.repos.slack_extra_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.slack_extra_repo_path,
|
||||
self.repos.slack_extra_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.slack_extra_repo_path,
|
||||
self.repos.slack_extra_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.slack_extra_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.slack_extra_repo_name)
|
||||
self.delete_last_updated(self.repos.slack_extra_repo_name)
|
||||
self.data.install_slack_extra_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.slack_extra_repo_name)
|
||||
|
||||
def slack_patches_repository(self):
|
||||
if self.repos.slack_patches_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.slack_patches_repo_name}{self.endc}"
|
||||
f"' repository, please wait...\n")
|
||||
self.make_dirs(self.repos.slack_patches_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.slack_patches_repo_packages_mirror}{self.repos.slack_patches_repo_packages}')
|
||||
urls.append(f'{self.repos.slack_patches_repo_mirror}{self.repos.slack_patches_repo_changelog}')
|
||||
urls.append(f'{self.repos.slack_patches_repo_mirror}{self.repos.slack_patches_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.slack_patches_repo_path,
|
||||
self.repos.slack_patches_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.slack_patches_repo_path,
|
||||
self.repos.slack_patches_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.slack_patches_repo_path,
|
||||
self.repos.slack_patches_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.slack_patches_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.slack_patches_repo_name)
|
||||
self.delete_last_updated(self.repos.slack_patches_repo_name)
|
||||
self.data.install_slack_patches_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.slack_patches_repo_name)
|
||||
|
||||
def alien_repository(self):
|
||||
if self.repos.alien_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.alien_repo_name}{self.endc}' repository, please wait...\n")
|
||||
self.make_dirs(self.repos.alien_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.alien_repo_packages_mirror}{self.repos.alien_repo_packages}')
|
||||
urls.append(f'{self.repos.alien_repo_mirror}{self.repos.alien_repo_changelog}')
|
||||
urls.append(f'{self.repos.alien_repo_packages_mirror}{self.repos.alien_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.alien_repo_path, self.repos.alien_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.alien_repo_path, self.repos.alien_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.alien_repo_path, self.repos.alien_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.alien_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
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) -> None:
|
||||
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_packages_mirror}{self.repos.multilib_repo_packages}')
|
||||
urls.append(f'{self.repos.multilib_repo_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) -> None:
|
||||
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_packages_mirror}{self.repos.restricted_repo_packages}')
|
||||
urls.append(f'{self.repos.restricted_repo_mirror}{self.repos.restricted_repo_changelog}')
|
||||
urls.append(f'{self.repos.restricted_repo_packages_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) -> None:
|
||||
if self.repos.gnome_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.gnome_repo_name}{self.endc}' repository, please wait...\n")
|
||||
self.make_dirs(self.repos.gnome_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.gnome_repo_mirror}{self.repos.gnome_repo_packages}')
|
||||
urls.append(f'{self.repos.gnome_repo_mirror}{self.repos.gnome_repo_changelog}')
|
||||
urls.append(f'{self.repos.gnome_repo_mirror}{self.repos.gnome_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.gnome_repo_path, self.repos.gnome_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.gnome_repo_path, self.repos.gnome_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.gnome_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
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) -> None:
|
||||
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_packages_mirror}{self.repos.msb_repo_packages}')
|
||||
urls.append(f'{self.repos.msb_repo_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 csb_repository(self) -> None:
|
||||
if self.repos.csb_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.csb_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.csb_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.csb_repo_packages_mirror}{self.repos.csb_repo_packages}')
|
||||
urls.append(f'{self.repos.csb_repo_mirror}{self.repos.csb_repo_changelog}')
|
||||
urls.append(f'{self.repos.csb_repo_mirror}{self.repos.csb_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.csb_repo_path,
|
||||
self.repos.csb_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.csb_repo_path,
|
||||
self.repos.csb_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.csb_repo_path,
|
||||
self.repos.csb_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.csb_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.csb_repo_name)
|
||||
self.delete_last_updated(self.repos.csb_repo_name)
|
||||
self.data.install_csb_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.csb_repo_name)
|
||||
|
||||
def conraid_repository(self) -> None:
|
||||
if self.repos.conraid_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.conraid_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.conraid_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.conraid_repo_mirror}{self.repos.conraid_repo_packages}')
|
||||
urls.append(f'{self.repos.conraid_repo_mirror}{self.repos.conraid_repo_changelog}')
|
||||
urls.append(f'{self.repos.conraid_repo_mirror}{self.repos.conraid_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.conraid_repo_path, self.repos.conraid_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.conraid_repo_path, self.repos.conraid_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.conraid_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
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:
|
||||
self.not_enabled_message(self.repos.conraid_repo_name)
|
||||
|
||||
def slackonly_repository(self) -> None:
|
||||
if self.repos.slackonly_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.slackonly_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.slackonly_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.slackonly_repo_mirror}{self.repos.slackonly_repo_packages}')
|
||||
urls.append(f'{self.repos.slackonly_repo_mirror}{self.repos.slackonly_repo_changelog}')
|
||||
urls.append(f'{self.repos.slackonly_repo_mirror}{self.repos.slackonly_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.slackonly_repo_path, self.repos.slackonly_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.slackonly_repo_path, self.repos.slackonly_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.slackonly_repo_path, self.repos.slackonly_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.slackonly_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
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 salixos_repository(self) -> None:
|
||||
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) -> None:
|
||||
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 salixos_patches_repository(self) -> None:
|
||||
if self.repos.salixos_patches_repo:
|
||||
urls: list = []
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.salixos_patches_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.salixos_patches_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.salixos_patches_repo_packages_mirror}{self.repos.salixos_patches_repo_packages}')
|
||||
urls.append(f'{self.repos.salixos_patches_repo_mirror}{self.repos.salixos_patches_repo_changelog}')
|
||||
urls.append(f'{self.repos.salixos_patches_repo_mirror}{self.repos.salixos_patches_repo_checksums}')
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.salixos_patches_repo_path,
|
||||
self.repos.salixos_patches_repo_packages)
|
||||
self.utils.remove_file_if_exists(self.repos.salixos_patches_repo_path,
|
||||
self.repos.salixos_patches_repo_changelog)
|
||||
self.utils.remove_file_if_exists(self.repos.salixos_patches_repo_path,
|
||||
self.repos.salixos_patches_repo_checksums)
|
||||
|
||||
down = Downloader(self.repos.salixos_patches_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_binaries_data(self.repos.salixos_patches_repo_name)
|
||||
self.delete_last_updated(self.repos.salixos_patches_repo_name)
|
||||
self.data.install_salixos_patches_data()
|
||||
print()
|
||||
else:
|
||||
self.not_enabled_message(self.repos.salixos_patches_repo_name)
|
||||
|
||||
def slackel_repository(self) -> None:
|
||||
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) -> None:
|
||||
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) -> None:
|
||||
""" Update the slackbuild repositories. """
|
||||
if self.repos.ponce_repo:
|
||||
self.make_dirs(self.repos.gnome_repo_name)
|
||||
if not self.utils.is_option(self.flag_generate, self.flags):
|
||||
print('Updating the packages list.\n')
|
||||
print(f"Downloading the '{self.green}ponce{self.endc}' repository, please wait...\n")
|
||||
self.delete_file(self.ponce_repo_path, self.ponce_chglog_txt)
|
||||
lftp_command: str = f'lftp {self.lftp_mirror_options} {self.ponce_repo_url} {self.ponce_repo_path}'
|
||||
print('Updating the packages list...\n')
|
||||
print(f"Downloading the '{self.green}{self.repos.ponce_repo_name}"
|
||||
f"{self.endc}' repository, please wait...\n")
|
||||
self.utils.remove_file_if_exists(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
|
||||
lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.ponce_repo_mirror} '
|
||||
f'{self.repos.ponce_repo_path}')
|
||||
self.utils.process(lftp_command)
|
||||
|
||||
# Remove the SLACKBUILDS.TXT file before generating the new one.
|
||||
sbo_file_txt = Path(self.ponce_repo_path, self.ponce_txt)
|
||||
sbo_file_txt = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
|
||||
if sbo_file_txt.is_file():
|
||||
sbo_file_txt.unlink()
|
||||
|
||||
# Generating the ponce SLACKBUILDS.TXT file.
|
||||
print(f'Generating the {self.ponce_txt} file... ', end='', flush=True)
|
||||
os.chdir(self.ponce_repo_path)
|
||||
gen_command: str = f'./gen_sbo_txt.sh > {self.ponce_txt}'
|
||||
print(f'Generating the {self.repos.ponce_repo_slackbuilds} file... ', end='', flush=True)
|
||||
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:
|
||||
print('Updating the packages list.\n')
|
||||
self.make_dirs(self.repos.sbo_repo_name)
|
||||
print('Updating the packages list...\n')
|
||||
|
||||
self.delete_file(self.sbo_repo_path, self.sbo_txt)
|
||||
self.delete_file(self.sbo_repo_path, self.sbo_chglog_txt)
|
||||
self.utils.remove_file_if_exists(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds)
|
||||
self.utils.remove_file_if_exists(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog)
|
||||
|
||||
print(f"Downloading the '{self.green}sbo{self.endc}' repository, please wait...\n")
|
||||
lftp_command: str = f'lftp {self.lftp_mirror_options} {self.sbo_repo_url} {self.sbo_repo_path}'
|
||||
print(f"Downloading the '{self.green}{self.repos.sbo_repo_name}{self.endc}' repository, please wait...\n")
|
||||
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()
|
||||
data = CreateData()
|
||||
data.install_sbo_table()
|
||||
self.data.install_sbos_data()
|
||||
|
||||
def check(self, q) -> None:
|
||||
check_updates = CheckUpdates()
|
||||
is_update: int = 0
|
||||
if not check_updates.check():
|
||||
def not_enabled_message(self, repo: str) -> None:
|
||||
print(f"{self.prog_name}: The repository '{self.green}{repo}{self.endc}' is not enabled.")
|
||||
|
||||
def make_dirs(self, repo) -> None:
|
||||
path = Path(self.lib_path, 'repositories', repo)
|
||||
if not os.path.isdir(path):
|
||||
os.makedirs(path)
|
||||
|
||||
def check(self, queue) -> None:
|
||||
compare = self.check_updates.check()
|
||||
is_update: dict = {}
|
||||
|
||||
for repo, comp in compare.items():
|
||||
if comp:
|
||||
print(f"\n\n{self.green}There are new updates available for the{self.endc} "
|
||||
f"'{self.bgreen}{repo}{self.endc}'{self.green} repository!{self.endc}")
|
||||
is_update[repo] = comp
|
||||
|
||||
if True not in compare.values():
|
||||
print(f'\n\n{self.endc}{self.yellow}No changes in ChangeLog.txt between your '
|
||||
f'last update and now.{self.endc}')
|
||||
else:
|
||||
print(f'\n\n{self.bgreen}There are new updates available!{self.endc}')
|
||||
is_update: int = 1
|
||||
|
||||
return q.put(is_update)
|
||||
return queue.put(is_update)
|
||||
|
||||
def repository(self) -> None:
|
||||
""" Starting multiprocessing download process. """
|
||||
def repositories(self) -> None:
|
||||
queue = Queue()
|
||||
message = f'Checking for news in the Changelog.txt file...'
|
||||
message = f'Checking for news, please wait...'
|
||||
|
||||
# Starting multiprocessing
|
||||
p1 = Process(target=self.check, args=(queue,))
|
||||
|
@ -118,31 +628,38 @@ class UpdateRepository(Configs):
|
|||
# Restore the terminal cursor
|
||||
print('\x1b[?25h', self.endc, end='')
|
||||
|
||||
self.update = queue.get()
|
||||
self.update_the_repository()
|
||||
|
||||
@staticmethod
|
||||
def delete_file(folder: str, txt_file: str) -> None:
|
||||
""" Delete the file. """
|
||||
file = Path(folder, txt_file)
|
||||
if file.exists():
|
||||
file.unlink()
|
||||
self.repos_for_update = queue.get()
|
||||
self.update_the_repositories()
|
||||
|
||||
def delete_sbo_data(self) -> None:
|
||||
""" Delete all the data from a table of the database. """
|
||||
if self.ponce_repo:
|
||||
if self.repos.ponce_repo:
|
||||
self.session.query(PonceTable).delete()
|
||||
else:
|
||||
self.session.query(SBoTable).delete()
|
||||
self.session.commit()
|
||||
|
||||
def drop_the_tables(self):
|
||||
def delete_binaries_data(self, repo) -> None:
|
||||
""" Delete the repository data from a table of the database. """
|
||||
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) -> None:
|
||||
""" 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!')
|
||||
self.view.question()
|
||||
|
||||
tables: list = [PonceTable.__table__,
|
||||
SBoTable.__table__]
|
||||
tables: list = [
|
||||
PonceTable.__table__,
|
||||
SBoTable.__table__,
|
||||
BinariesTable.__table__,
|
||||
LastRepoUpdated.__table__
|
||||
]
|
||||
|
||||
Base.metadata.drop_all(bind=engine, tables=tables)
|
||||
print("Successfully cleared!\n\nYou need to run 'slpkg update' now.")
|
||||
|
|
|
@ -2,39 +2,55 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Generator
|
||||
from packaging.version import parse
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.dependencies import Requires
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
class Upgrade(Configs, Utilities):
|
||||
class Upgrade(Configs):
|
||||
""" Upgrade the installed packages. """
|
||||
|
||||
def __init__(self, file_pattern):
|
||||
def __init__(self, flags: list, repo=None):
|
||||
super(Configs, self).__init__()
|
||||
super(Utilities, self).__init__()
|
||||
self.file_pattern: str = file_pattern
|
||||
self.flags: list = flags
|
||||
self.repo: str = repo
|
||||
self.utils = Utilities()
|
||||
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
self.all_installed: list = self.utils.installed_packages
|
||||
|
||||
def packages(self) -> Generator[str, None, None]:
|
||||
""" Compares version of packages and returns the maximum. """
|
||||
upgrade: list = []
|
||||
requires: list = []
|
||||
repo_packages: list = SBoQueries('').sbos()
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
repo_packages: list = BinQueries('', self.repo).all_package_names_by_repo()
|
||||
else:
|
||||
repo_packages: list = SBoQueries('').sbos()
|
||||
|
||||
installed: list = list(self.all_installed(self.file_pattern))
|
||||
for pkg in self.all_installed:
|
||||
inst_package: str = self.utils.split_binary_pkg(pkg)[0]
|
||||
|
||||
for pkg in installed:
|
||||
inst_pkg_name: str = self.split_installed_pkg(pkg)[0]
|
||||
if inst_package in repo_packages:
|
||||
|
||||
if inst_pkg_name in repo_packages:
|
||||
if self.is_package_upgradeable(inst_package):
|
||||
yield inst_package
|
||||
|
||||
if self.is_package_upgradeable(inst_pkg_name, self.file_pattern):
|
||||
requires += Requires(inst_pkg_name).resolve()
|
||||
upgrade.append(inst_pkg_name)
|
||||
def is_package_upgradeable(self, name: str) -> bool:
|
||||
""" Checks for installed and upgradeable packages. """
|
||||
inst_package: str = self.utils.is_package_installed(name)
|
||||
|
||||
# Clean the packages if they are dependencies
|
||||
for pkg in upgrade:
|
||||
if pkg not in requires:
|
||||
yield pkg
|
||||
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(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(name).version()
|
||||
repo_build: str = self.utils.read_sbo_build_tag(name)
|
||||
|
||||
return parse(repo_version + repo_build) > parse(inst_version + inst_build)
|
||||
|
|
|
@ -6,13 +6,13 @@ import time
|
|||
import shutil
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import Generator, Any, Union
|
||||
from distutils.version import LooseVersion
|
||||
# from packaging.version import Version
|
||||
from typing import Generator, Union
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.blacklist import Blacklist
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
class Utilities:
|
||||
|
@ -22,80 +22,85 @@ class Utilities:
|
|||
self.colors = self.configs.colour
|
||||
self.color = self.colors()
|
||||
self.black = Blacklist()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.bold: str = self.color['bold']
|
||||
self.yellow: str = self.color['yellow']
|
||||
self.cyan: str = self.color['cyan']
|
||||
self.endc: str = self.color['endc']
|
||||
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=']
|
||||
|
||||
def is_package_installed(self, name: str, pattern: str) -> str:
|
||||
self.installed_packages: list = list(self.all_installed())
|
||||
self.installed_package_names: list = list(self.all_installed_names())
|
||||
|
||||
def is_package_installed(self, name: str) -> str:
|
||||
""" Returns the installed package name. """
|
||||
installed: list = list(self.all_installed(pattern))
|
||||
for package in self.installed_packages:
|
||||
pkg_name: str = self.split_binary_pkg(package)[0]
|
||||
|
||||
for package in installed:
|
||||
pkg: str = self.split_installed_pkg(package)[0]
|
||||
|
||||
if pkg == name:
|
||||
if pkg_name == name:
|
||||
return package
|
||||
|
||||
return ''
|
||||
|
||||
def all_installed(self, pattern: str) -> Generator:
|
||||
def all_installed(self) -> Generator:
|
||||
""" Return all installed packages from /val/log/packages folder. """
|
||||
var_log_packages = Path(self.configs.log_packages)
|
||||
|
||||
try:
|
||||
for file in var_log_packages.glob(pattern):
|
||||
package_name = self.split_installed_pkg(file.name)[0]
|
||||
for file in var_log_packages.glob(self.configs.file_pattern):
|
||||
package_name = self.split_binary_pkg(file.name)[0]
|
||||
|
||||
if package_name not in self.black.packages():
|
||||
yield file.name
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
def all_installed_names(self, pattern: str) -> Generator:
|
||||
def all_installed_names(self) -> Generator:
|
||||
""" Return all installed packages names from /val/log/packages folder. """
|
||||
var_log_packages = Path(self.configs.log_packages)
|
||||
|
||||
try:
|
||||
for file in var_log_packages.glob(pattern):
|
||||
package_name = self.split_installed_pkg(file.name)[0]
|
||||
for file in var_log_packages.glob(self.configs.file_pattern):
|
||||
package_name = self.split_binary_pkg(file.name)[0]
|
||||
|
||||
if package_name not in self.black.packages():
|
||||
yield self.split_installed_pkg(file.name)[0]
|
||||
yield package_name
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def remove_file_if_exists(path: str, file: str) -> None:
|
||||
def remove_file_if_exists(path: Path, file: str) -> None:
|
||||
""" Clean the old files. """
|
||||
archive = Path(path, file)
|
||||
if archive.is_file():
|
||||
archive.unlink()
|
||||
|
||||
@staticmethod
|
||||
def remove_folder_if_exists(folder: str) -> None:
|
||||
def remove_folder_if_exists(folder: Path) -> None:
|
||||
""" Clean the old folders. """
|
||||
directory = Path(folder)
|
||||
if directory.exists():
|
||||
shutil.rmtree(directory)
|
||||
|
||||
@staticmethod
|
||||
def create_folder(path: str, folder: str) -> None:
|
||||
def create_folder(path: Path, folder: str) -> None:
|
||||
""" Creates folder. """
|
||||
directory = Path(path, folder)
|
||||
if not directory.exists():
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def split_installed_pkg(self, package: str) -> list:
|
||||
@staticmethod
|
||||
def split_binary_pkg(package: str) -> list:
|
||||
""" Split the package by the name, version, arch, build and tag. """
|
||||
name: str = '-'.join(package.split('-')[:-3])
|
||||
version: str = ''.join(package[len(name):].split('-')[:-2])
|
||||
arch: str = ''.join(package[len(name + version) + 2:].split('-')[:-1])
|
||||
build: str = ''.join(package[len(name + version + arch) + 3:].split('-')).replace(self.configs.repo_tag, '')
|
||||
tag: str = ''.join(package[len(name + version + arch + build) + 4:].split('-'))
|
||||
build_tag: str = package.split('-')[-1]
|
||||
build: str = ''.join(re.findall(r'\d+', build_tag[:2]))
|
||||
tag: str = build_tag[len(build):].replace('_', '')
|
||||
|
||||
return [name, version, arch, build, tag]
|
||||
|
||||
|
@ -105,33 +110,10 @@ class Utilities:
|
|||
time.strftime(f'[{self.cyan}%H:%M:%S{self.endc}]',
|
||||
time.gmtime(elapsed_time)))
|
||||
|
||||
def is_package_upgradeable(self, package: str, file_pattern: str) -> Any:
|
||||
""" Checks if the package is installed and if it is upgradeable, returns true. """
|
||||
installed_version: str = '0'
|
||||
installed = self.is_package_installed(package, file_pattern)
|
||||
repository_version = str(SBoQueries(package).version())
|
||||
|
||||
repo_build_tag: str = self.read_build_tag(package)
|
||||
if not repo_build_tag:
|
||||
repo_build_tag: str = ''
|
||||
|
||||
inst_build_tag: str = self.split_installed_pkg(installed)[3]
|
||||
if not inst_build_tag:
|
||||
inst_build_tag: str = ''
|
||||
|
||||
if not repository_version:
|
||||
repository_version: str = '0'
|
||||
|
||||
if installed:
|
||||
installed_version: str = self.split_installed_pkg(installed)[1]
|
||||
|
||||
return (str(LooseVersion(repository_version + repo_build_tag)) >
|
||||
str(LooseVersion(installed_version + inst_build_tag)))
|
||||
|
||||
def read_build_tag(self, sbo: str) -> str:
|
||||
def read_sbo_build_tag(self, sbo: str) -> str:
|
||||
""" Patching SBo TAG from the configuration file. """
|
||||
location: str = SBoQueries(sbo).location()
|
||||
sbo_script = Path(self.configs.sbo_repo_path, location, sbo, f'{sbo}.SlackBuild')
|
||||
sbo_script = Path(self.repos.sbo_repo_path, location, sbo, f'{sbo}.SlackBuild')
|
||||
|
||||
if sbo_script.is_file():
|
||||
with open(sbo_script, 'r', encoding='utf-8') as f:
|
||||
|
@ -142,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. """
|
||||
|
@ -160,23 +144,57 @@ 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()
|
||||
|
||||
def process(self, command: str, stderr=None, stdout=None):
|
||||
@staticmethod
|
||||
def process(command: str, stderr=None, stdout=None) -> None:
|
||||
""" Handle the processes. """
|
||||
try:
|
||||
output = subprocess.call(command, shell=True, stderr=stderr, stdout=stdout)
|
||||
if output != 0:
|
||||
self.raise_error_message(str(output))
|
||||
except KeyboardInterrupt:
|
||||
raise SystemExit(1)
|
||||
except (KeyboardInterrupt, subprocess.CalledProcessError) as err:
|
||||
raise SystemExit(err)
|
||||
|
||||
if output != 0:
|
||||
raise SystemExit(output)
|
||||
|
||||
def raise_error_message(self, message: str) -> None:
|
||||
""" A general method to raise an error message and exit. """
|
||||
raise SystemExit(f"\n{self.configs.prog_name}: {self.bred}Error{self.endc}: {message}.\n")
|
||||
|
||||
@staticmethod
|
||||
def get_file_size(file):
|
||||
""" Get the file size and converted to units. """
|
||||
unit: str = 'KB'
|
||||
file_size = Path(file).stat().st_size
|
||||
mb = file_size / 1024 ** 2
|
||||
gb = file_size / 1024 ** 3
|
||||
|
||||
if mb >= 0.1:
|
||||
file_size = mb
|
||||
unit: str = 'MB'
|
||||
|
||||
if gb >= 0.1:
|
||||
file_size = mb
|
||||
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
|
||||
|
|
|
@ -49,13 +49,9 @@ class Ascii(Configs):
|
|||
self.bgreen: str = f'{self.bold}{self.green}'
|
||||
self.bred: str = f'{self.bold}{self.red}'
|
||||
|
||||
self.repo: str = 'sbo'
|
||||
if self.ponce_repo:
|
||||
self.repo: str = 'ponce'
|
||||
|
||||
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,14 +66,19 @@ class Ascii(Configs):
|
|||
|
||||
self.draw_middle_line()
|
||||
|
||||
print(f'{self.bgreen}{self.vertical_line}{self.endc} Package:' + ' ' * 27 + 'Version:' +
|
||||
' ' * (self.columns - 57) + f'Repository{self.bgreen} {self.vertical_line}{self.endc}')
|
||||
print(f'{self.bgreen}{self.vertical_line}{self.endc} Package:' + ' ' * 22 + 'Version:' +
|
||||
' ' * (self.columns - 65) + 'Size:' + ' ' * 13 + f'Repo:{self.bgreen} {self.vertical_line}{self.endc}')
|
||||
|
||||
def draw_view_package(self, package: str, version: str, color: str) -> None:
|
||||
def draw_view_package(self, package: str, version: str, size: str, color: str, repo: str) -> None:
|
||||
""" Draw nad print the packages. """
|
||||
print(f'{self.bgreen}{self.vertical_line} {self.bold}{color}{package}{self.endc}' + ' ' * (35 - len(package)) +
|
||||
f'{self.bgreen}{version}' + ' ' * ((self.columns - 39) - len(version) - len(self.repo)) +
|
||||
f'{self.blue}{self.repo} {self.bgreen}{self.vertical_line}{self.endc}')
|
||||
if self.columns <= 80 and len(version) >= 11:
|
||||
version: str = f'{version[:10]}...'
|
||||
if self.columns <= 80 and len(package) >= 25:
|
||||
package: str = f'{package[:24]}...'
|
||||
print(f'{self.bgreen}{self.vertical_line} {self.bold}{color}{package}{self.endc}' + ' ' * (30 - len(package)) +
|
||||
f'{self.bgreen}{version}' + ' ' * ((self.columns - 53) - len(version) - len(size)) +
|
||||
f'{self.endc}{size}' + ' ' * (19 - len(repo)) +
|
||||
f'{self.blue}{repo} {self.bgreen}{self.vertical_line}{self.endc}')
|
||||
|
||||
def draw_log_package(self, package: str) -> None:
|
||||
""" Drawing and print logs packages. """
|
||||
|
|
|
@ -17,10 +17,11 @@ class Usage(Configs):
|
|||
self.yellow: str = color['yellow']
|
||||
self.endc: str = color['endc']
|
||||
|
||||
def help_minimal(self):
|
||||
def help_minimal(self, message: str) -> NoReturn:
|
||||
""" Prints the minimal help menu. """
|
||||
args = (
|
||||
f'\nUsage: {self.prog_name} [{self.yellow}OPTIONS{self.endc}] [{self.cyan}COMMAND{self.endc}] '
|
||||
print(message)
|
||||
args: str = (
|
||||
f'\nUsage: {self.prog_name} [{self.cyan}COMMAND{self.endc}] [{self.yellow}OPTIONS{self.endc}]'
|
||||
f'[FILELIST|PACKAGES...]\n'
|
||||
f"\nTry '{self.prog_name} --help' for more options.\n")
|
||||
|
||||
|
@ -30,9 +31,9 @@ class Usage(Configs):
|
|||
def help_short(self, status: int) -> NoReturn:
|
||||
""" Prints the short menu. """
|
||||
args = (
|
||||
f'Usage: {self.prog_name} [{self.yellow}OPTIONS{self.endc}] [{self.cyan}COMMAND{self.endc}] '
|
||||
f'Usage: {self.prog_name} [{self.cyan}COMMAND{self.endc}] [{self.yellow}OPTIONS{self.endc}] '
|
||||
f'[FILELIST|PACKAGES...]\n'
|
||||
f'\n slpkg [{self.cyan}COMMAND{self.endc}] [-u, update, -U, upgrade, -c, check-updates]\n'
|
||||
f'\n slpkg [{self.cyan}COMMAND{self.endc}] [-u, update, -U, upgrade, -c, check-updates, -I, repo-info]\n'
|
||||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-L, clean-logs, -T, clean-data, -D, clean-tmp, -g, configs]\n'
|
||||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-b, build, -i, install, -d, download [packages...]]\n'
|
||||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-R, remove, -f, find, -w, view [packages...]]\n'
|
||||
|
@ -40,8 +41,8 @@ class Usage(Configs):
|
|||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-y, --yes, -j, --jobs, -o, --resolve-off, -r, --reinstall]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-k, --skip-installed, -E, --full-reverse, -S, --search]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-n, --no-silent, -p, --pkg-version, -G, --generate-only]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-P, --parallel, -z, --directory=[PATH]]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-F, --file-pattern=[PATTERN]]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-P, --parallel, -B, --bin-repo=[REPO]]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-z, --directory=[PATH]]\n'
|
||||
" \nIf you need more information please try 'slpkg --help'.")
|
||||
|
||||
print(args)
|
||||
|
@ -50,13 +51,14 @@ class Usage(Configs):
|
|||
def help(self, status: int) -> NoReturn:
|
||||
""" Prints the main menu. """
|
||||
args: str = (
|
||||
f'{self.bold}USAGE:{self.endc} {self.prog_name} [{self.yellow}OPTIONS{self.endc}] '
|
||||
f'[{self.cyan}COMMAND{self.endc}] [FILELIST|PACKAGES...]\n'
|
||||
f'{self.bold}USAGE:{self.endc} {self.prog_name} [{self.cyan}COMMAND{self.endc}] '
|
||||
f'[{self.yellow}OPTIONS{self.endc}] [FILELIST|PACKAGES...]\n'
|
||||
f'\n{self.bold}DESCRIPTION:{self.endc} Package manager utility for Slackware.\n'
|
||||
f'\n{self.bold}COMMANDS:{self.endc}\n'
|
||||
f' {self.red}-u, update{self.endc} Update the package lists.\n'
|
||||
f' {self.cyan}-U, upgrade{self.endc} Upgrade all the packages.\n'
|
||||
f' {self.cyan}-c, check-updates{self.endc} Check for news on ChangeLog.txt.\n'
|
||||
f' {self.cyan}-I, repo-info{self.endc} Prints the repositories information.\n'
|
||||
f' {self.cyan}-g, configs{self.endc} Edit the configuration file.\n'
|
||||
f' {self.cyan}-L, clean-logs{self.endc} Clean dependencies log tracking.\n'
|
||||
f' {self.cyan}-T, clean-data{self.endc} Clean all the repositories data.\n'
|
||||
|
@ -68,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'
|
||||
|
@ -82,8 +84,8 @@ class Usage(Configs):
|
|||
f' {self.yellow}-p, --pkg-version{self.endc} Print the repository package version.\n'
|
||||
f' {self.yellow}-G, --generate-only{self.endc} Generates only the SLACKBUILDS.TXT file.\n'
|
||||
f' {self.yellow}-P, --parallel{self.endc} Download files in parallel.\n'
|
||||
f' {self.yellow}-B, --bin-repo={self.endc}[REPO] Set a binary repository.\n'
|
||||
f' {self.yellow}-z, --directory={self.endc}[PATH] Download files to a specific path.\n'
|
||||
f' {self.yellow}-F, --file-pattern={self.endc}[PATTERN] Include specific installed files.\n'
|
||||
'\n -h, --help Show this message and exit.\n'
|
||||
' -v, --version Print version and exit.\n'
|
||||
"\nIf you need more information try to use slpkg manpage.\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']
|
||||
|
@ -67,3 +70,4 @@ class Help(Configs):
|
|||
print(f"{self.bold}COMMAND{self.endc}: {self.cyan}{self.command}{self.endc}")
|
||||
print(f"{self.bold}OPTIONS:{self.endc} {self.yellow}{', '.join(self.flags)}{self.endc}\n")
|
||||
print('If you need more information try to use slpkg manpage.\n')
|
||||
raise SystemExit()
|
||||
|
|
|
@ -5,7 +5,7 @@ class Version:
|
|||
""" Print the version. """
|
||||
|
||||
def __init__(self):
|
||||
self.version_info: tuple = (4, 6, 1)
|
||||
self.version_info: tuple = ('r', 'c', 3)
|
||||
self.version: str = '{0}.{1}.{2}'.format(*self.version_info)
|
||||
self.license: str = 'MIT License'
|
||||
self.author: str = 'Dimitris Zlatanidis (dslackw)'
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
from pathlib import Path
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
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
|
||||
|
||||
|
@ -18,18 +19,19 @@ class ViewPackage(Configs):
|
|||
self.flags: list = flags
|
||||
|
||||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
self.session = Session
|
||||
self.flag_pkg_version: list = ['-p', '--pkg-version']
|
||||
|
||||
# Switch between sbo and ponce repository.
|
||||
self.sbo_table = SBoTable
|
||||
self.repo_url: str = self.sbo_repo_url
|
||||
self.repo_path: str = self.sbo_repo_path
|
||||
self.repo_tar_suffix: str = self.sbo_tar_suffix
|
||||
if self.ponce_repo:
|
||||
self.repo_url: str = self.repos.sbo_repo_mirror
|
||||
self.repo_path: Path = self.repos.sbo_repo_path
|
||||
self.repo_tar_suffix: str = self.repos.sbo_repo_tar_suffix
|
||||
if self.repos.ponce_repo:
|
||||
self.sbo_table = PonceTable
|
||||
self.repo_url: str = self.ponce_repo_url
|
||||
self.repo_path: str = self.ponce_repo_path
|
||||
self.repo_url: str = self.repos.ponce_repo_mirror
|
||||
self.repo_path: Path = self.repos.ponce_repo_path
|
||||
self.repo_tar_suffix: str = ''
|
||||
|
||||
def package(self, packages: list) -> None:
|
||||
|
@ -42,19 +44,21 @@ 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(
|
||||
self.sbo_table.name, # type: ignore
|
||||
self.sbo_table.version, # type: ignore
|
||||
self.sbo_table.requires, # type: ignore
|
||||
self.sbo_table.download, # type: ignore
|
||||
self.sbo_table.download64, # type: ignore
|
||||
self.sbo_table.md5sum, # type: ignore
|
||||
self.sbo_table.md5sum64, # type: ignore
|
||||
self.sbo_table.files, # type: ignore
|
||||
self.sbo_table.short_description, # type: ignore
|
||||
self.sbo_table.location # type: ignore
|
||||
self.sbo_table.name,
|
||||
self.sbo_table.version,
|
||||
self.sbo_table.requires,
|
||||
self.sbo_table.download,
|
||||
self.sbo_table.download64,
|
||||
self.sbo_table.md5sum,
|
||||
self.sbo_table.md5sum64,
|
||||
self.sbo_table.files,
|
||||
self.sbo_table.short_description,
|
||||
self.sbo_table.location
|
||||
).filter(self.sbo_table.name == package).first()
|
||||
|
||||
path = Path(self.repo_path, info[9], info[0], 'README')
|
||||
|
@ -63,10 +67,10 @@ class ViewPackage(Configs):
|
|||
path = Path(self.repo_path, info[9], info[0], f'{info[0]}.info')
|
||||
info_file = self.utils.read_file(path)
|
||||
|
||||
repo_build_tag = self.utils.read_build_tag(info[0])
|
||||
repo_build_tag = self.utils.read_sbo_build_tag(info[0])
|
||||
|
||||
maintainer, email, homepage = '', '', ''
|
||||
for line in info_file: # type: ignore
|
||||
for line in info_file:
|
||||
if line.startswith('HOMEPAGE'):
|
||||
homepage: str = line[10:-2].strip()
|
||||
if line.startswith('MAINTAINER'):
|
||||
|
|
|
@ -3,12 +3,16 @@
|
|||
|
||||
import os
|
||||
from typing import Any
|
||||
from pathlib import Path
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.upgrade import Upgrade
|
||||
from slpkg.views.ascii import Ascii
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.dialog_box import DialogBox
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
from slpkg.models.models import LogsDependencies
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
@ -16,15 +20,18 @@ from slpkg.models.models import session as Session
|
|||
class ViewMessage(Configs):
|
||||
""" Print some messages before. """
|
||||
|
||||
def __init__(self, flags: list):
|
||||
def __init__(self, flags: list, repo=None):
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.repo: str = repo
|
||||
|
||||
self.session = Session
|
||||
self.utils = Utilities()
|
||||
self.dialogbox = DialogBox()
|
||||
self.ascii = Ascii()
|
||||
self.upgrade = Upgrade(self.flags, self.repo)
|
||||
self.color = self.colour()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.yellow: str = self.color['yellow']
|
||||
self.cyan: str = self.color['cyan']
|
||||
|
@ -37,13 +44,21 @@ class ViewMessage(Configs):
|
|||
self.flag_resolve_off: list = ['-o', '--resolve-off']
|
||||
self.flag_reinstall: list = ['-r', '--reinstall']
|
||||
self.flag_yes: list = ['-y', '--yes']
|
||||
self.file_pattern: str = f'*{self.repo_tag}'
|
||||
self.all_installed: list = list(self.utils.all_installed_names(self.file_pattern))
|
||||
self.flag_bin_repository: list = ['-B=', '--bin-repo=']
|
||||
|
||||
def view_packages(self, package, version, mode):
|
||||
def view_packages(self, package: str, mode: str) -> None:
|
||||
""" Printing the main packages. """
|
||||
size: str = ''
|
||||
color: str = self.red
|
||||
|
||||
if self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||
version: str = BinQueries(package, self.repo).version()
|
||||
size: str = BinQueries(package, self.repo).size_comp()
|
||||
repo = BinQueries(package, self.repo).repository()
|
||||
else:
|
||||
version: str = SBoQueries(package).version()
|
||||
repo: str = SBoQueries('').repo_name()
|
||||
|
||||
if mode in ['install', 'download']:
|
||||
color: str = self.cyan
|
||||
if mode == 'build':
|
||||
|
@ -51,81 +66,78 @@ class ViewMessage(Configs):
|
|||
if mode == 'upgrade':
|
||||
color: str = self.violet
|
||||
|
||||
# If the package is installed and not upgradeable change the color to gray.
|
||||
if (package in self.all_installed and mode == 'install' and
|
||||
not self.utils.is_package_upgradeable(package, self.file_pattern)):
|
||||
# If the package is installed and change the color to gray.
|
||||
if package in self.utils.installed_package_names and mode == 'install':
|
||||
color = self.grey
|
||||
|
||||
self.ascii.draw_view_package(package, version, color)
|
||||
self.ascii.draw_view_package(package, version, size, color, repo)
|
||||
|
||||
def view_skipping_packages(self, sbo: str, version: str) -> None:
|
||||
def view_skipping_packages(self, package: str, version: str) -> None:
|
||||
""" Print the skipping packages. """
|
||||
print(f'[{self.yellow}Skipping{self.endc}] {sbo}-{version} {self.red}(already installed){self.endc}')
|
||||
print(f'[{self.yellow}Skipping{self.endc}] {package}-{version} {self.red}(already installed){self.endc}')
|
||||
|
||||
def build_packages(self, slackbuilds: list, dependencies: list) -> None:
|
||||
""" View packages for build only. """
|
||||
self.ascii.draw_package_title_box('The following packages will be build:', 'Build Packages')
|
||||
|
||||
for sbo in slackbuilds:
|
||||
version: str = SBoQueries(sbo).version()
|
||||
self.view_packages(sbo, version, mode='build')
|
||||
self.view_packages(sbo, mode='build')
|
||||
|
||||
if dependencies:
|
||||
self.ascii.draw_middle_line()
|
||||
self.ascii.draw_dependency_line()
|
||||
|
||||
for sbo in dependencies:
|
||||
version: str = SBoQueries(sbo).version()
|
||||
self.view_packages(sbo, version, mode='build')
|
||||
self.view_packages(sbo, mode='build')
|
||||
|
||||
self.summary(slackbuilds, dependencies, option='build')
|
||||
|
||||
def install_packages(self, slackbuilds: list, dependencies: list, mode: str) -> None:
|
||||
def install_packages(self, packages: list, dependencies: list, mode: str) -> None:
|
||||
""" View packages for install. """
|
||||
title: str = 'Install Packages'
|
||||
if dependencies is None:
|
||||
dependencies: list = []
|
||||
|
||||
title: str = 'Slpkg Install Packages'
|
||||
if mode == 'upgrade':
|
||||
title: str = 'Upgrade Packages'
|
||||
title: str = 'Slpkg Upgrade Packages'
|
||||
|
||||
self.ascii.draw_package_title_box('The following packages will be installed or upgraded:', title)
|
||||
|
||||
for sbo in slackbuilds:
|
||||
version: str = SBoQueries(sbo).version()
|
||||
self.view_packages(sbo, version, mode=mode)
|
||||
for pkg in packages:
|
||||
self.view_packages(pkg, mode)
|
||||
|
||||
if dependencies:
|
||||
self.ascii.draw_middle_line()
|
||||
self.ascii.draw_dependency_line()
|
||||
|
||||
for sbo in dependencies:
|
||||
version: str = SBoQueries(sbo).version()
|
||||
self.view_packages(sbo, version, mode=mode)
|
||||
for pkg in dependencies:
|
||||
self.view_packages(pkg, mode)
|
||||
|
||||
self.summary(slackbuilds, dependencies, option=mode)
|
||||
self.summary(packages, dependencies, option=mode)
|
||||
|
||||
def download_packages(self, slackbuilds: list, directory: str) -> None:
|
||||
def download_packages(self, slackbuilds: list, directory: Path) -> None:
|
||||
""" View downloaded packages. """
|
||||
self.ascii.draw_package_title_box('The following packages will be downloaded:', 'Download Packages')
|
||||
mode = 'download'
|
||||
|
||||
self.ascii.draw_package_title_box('The following packages will be downloaded:', 'Slpkg Download Packages')
|
||||
|
||||
if directory:
|
||||
self.download_only: str = directory
|
||||
self.download_only: Path = directory
|
||||
|
||||
for sbo in slackbuilds:
|
||||
version: str = SBoQueries(sbo).version()
|
||||
self.view_packages(sbo, version, mode='download')
|
||||
self.view_packages(sbo, mode)
|
||||
|
||||
self.summary(slackbuilds, dependencies=[], option='download')
|
||||
|
||||
def remove_packages(self, packages: list, file_pattern: str) -> Any:
|
||||
def remove_packages(self, packages: list) -> Any:
|
||||
""" View remove packages. """
|
||||
if file_pattern:
|
||||
self.file_pattern: str = file_pattern
|
||||
pkgs, dependencies = [], []
|
||||
|
||||
slackbuilds, dependencies = [], []
|
||||
for pkg in packages:
|
||||
slackbuilds.append(pkg)
|
||||
pkgs.append(pkg)
|
||||
|
||||
requires = self.session.query(
|
||||
LogsDependencies.requires).filter( # type: ignore
|
||||
LogsDependencies.requires).filter(
|
||||
LogsDependencies.name == pkg).first()
|
||||
|
||||
if requires:
|
||||
|
@ -134,9 +146,9 @@ class ViewMessage(Configs):
|
|||
if dependencies and not self.utils.is_option(self.flag_resolve_off, self.flags):
|
||||
dependencies: list = self.choose_dependencies_for_remove(list(set(dependencies)))
|
||||
|
||||
self.ascii.draw_package_title_box('The following packages will be removed:', 'Remove Packages')
|
||||
self.ascii.draw_package_title_box('The following packages will be removed:', 'Slpkg Remove Packages')
|
||||
|
||||
for pkg in slackbuilds:
|
||||
for pkg in pkgs:
|
||||
if pkg not in dependencies:
|
||||
self._view_removed(pkg)
|
||||
|
||||
|
@ -149,21 +161,19 @@ class ViewMessage(Configs):
|
|||
else:
|
||||
dependencies: list = []
|
||||
|
||||
self.summary(slackbuilds, dependencies, option='remove')
|
||||
self.summary(pkgs, dependencies, option='remove')
|
||||
|
||||
return self.installed_packages, dependencies
|
||||
|
||||
def _view_removed(self, name: str) -> None:
|
||||
""" View and creates list with packages for remove. """
|
||||
installed = self.utils.all_installed(self.file_pattern)
|
||||
installed = self.utils.is_package_installed(name)
|
||||
|
||||
if self.utils.is_package_installed(name, self.file_pattern):
|
||||
for package in installed:
|
||||
pkg: str = self.utils.split_installed_pkg(package)[0]
|
||||
if pkg == name:
|
||||
self.installed_packages.append(package)
|
||||
version = self.utils.split_installed_pkg(package)[1]
|
||||
self.view_packages(pkg, version, mode='remove')
|
||||
if installed:
|
||||
pkg: list = self.utils.split_binary_pkg(installed)
|
||||
self.installed_packages.append(installed)
|
||||
size: str = self.utils.get_file_size(f'{self.log_packages}/{installed}')
|
||||
self.ascii.draw_view_package(pkg[0], pkg[1], size, self.red, '')
|
||||
|
||||
def choose_dependencies_for_remove(self, dependencies: list) -> list:
|
||||
""" Choose packages for remove using the dialog box. """
|
||||
|
@ -175,7 +185,7 @@ class ViewMessage(Configs):
|
|||
|
||||
for package in dependencies:
|
||||
repo_ver: str = SBoQueries(package).version()
|
||||
inst_pkg: str = self.utils.is_package_installed(package, self.file_pattern)
|
||||
inst_pkg: str = self.utils.is_package_installed(package)
|
||||
choices += [(package, repo_ver, True, f'Package: {inst_pkg}')]
|
||||
|
||||
text: str = f'There are {len(choices)} dependencies:'
|
||||
|
@ -189,22 +199,27 @@ class ViewMessage(Configs):
|
|||
os.system('clear')
|
||||
return tags
|
||||
|
||||
def summary(self, slackbuilds: list, dependencies: list, option: str) -> None:
|
||||
def summary(self, packages: list, dependencies: list, option: str) -> None:
|
||||
""" View the status of the packages action. """
|
||||
slackbuilds.extend(dependencies)
|
||||
packages.extend(dependencies)
|
||||
install = upgrade = remove = 0
|
||||
reinstall: bool = self.utils.is_option(self.flag_reinstall, self.flags)
|
||||
|
||||
for sbo in slackbuilds:
|
||||
installed: str = self.utils.is_package_installed(sbo, self.file_pattern)
|
||||
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:
|
||||
install += 1
|
||||
elif installed and self.utils.is_option(self.flag_reinstall, self.flags):
|
||||
elif installed and reinstall:
|
||||
upgrade += 1
|
||||
elif (installed and self.utils.is_package_upgradeable(sbo, self.file_pattern) and
|
||||
self.utils.is_option(self.flag_reinstall, self.flags)):
|
||||
elif installed and upgradeable and reinstall:
|
||||
upgrade += 1
|
||||
elif installed and self.utils.is_package_upgradeable(sbo, self.file_pattern):
|
||||
elif installed and upgradeable:
|
||||
upgrade += 1
|
||||
elif installed and option == 'remove':
|
||||
remove += 1
|
||||
|
@ -216,7 +231,7 @@ class ViewMessage(Configs):
|
|||
f'installed and {upgrade} will be upgraded.{self.endc}')
|
||||
|
||||
elif option == 'build':
|
||||
print(f'{self.grey}Total {len(slackbuilds)} packages '
|
||||
print(f'{self.grey}Total {len(packages)} packages '
|
||||
f'will be build in {self.tmp_path} folder.{self.endc}')
|
||||
|
||||
elif option == 'remove':
|
||||
|
@ -224,7 +239,7 @@ class ViewMessage(Configs):
|
|||
f'will be removed.{self.endc}')
|
||||
|
||||
elif option == 'download':
|
||||
print(f'{self.grey}{len(slackbuilds)} packages '
|
||||
print(f'{self.grey}{len(packages)} packages '
|
||||
f'will be downloaded in {self.download_only} folder.{self.endc}')
|
||||
|
||||
def logs_packages(self, dependencies: list) -> None:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import unittest
|
||||
from slpkg.checks import Check
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.repositories import Repositories
|
||||
|
||||
|
||||
class TestPkgInstalled(unittest.TestCase):
|
||||
|
@ -8,7 +9,7 @@ class TestPkgInstalled(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.check = Check()
|
||||
self.configs = Configs()
|
||||
self.file_pattern = f'*{self.configs.sbo_repo_tag}'
|
||||
self.repos = Repositories()
|
||||
self.packages = ['fish', 'ranger', 'pycharm']
|
||||
|
||||
def test_check_exists(self):
|
||||
|
@ -17,9 +18,6 @@ class TestPkgInstalled(unittest.TestCase):
|
|||
def test_check_unsupported(self):
|
||||
self.assertIsNone(self.check.is_package_unsupported(self.packages))
|
||||
|
||||
def test_check_installed(self):
|
||||
self.assertListEqual(self.packages, self.check.is_installed(self.packages, self.file_pattern))
|
||||
|
||||
def test_check_blacklist(self):
|
||||
self.assertIsNone(self.check.is_blacklist(self.packages))
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
import unittest
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.repositories import Repositories
|
||||
|
||||
|
||||
class TestConfigs(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.sbo_txt = Configs.sbo_txt
|
||||
self.sbo_tar_suffix = Configs.sbo_tar_suffix
|
||||
self.sbo_repo_tag = Configs.sbo_repo_tag
|
||||
self.repos = Repositories()
|
||||
self.sbo_txt = self.repos.sbo_repo_slackbuilds
|
||||
self.sbo_tar_suffix = self.repos.sbo_repo_tar_suffix
|
||||
self.sbo_repo_tag = self.repos.sbo_repo_tag
|
||||
self.os_arch = Configs.os_arch
|
||||
|
||||
def test_sbo_txt(self):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import unittest
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
|
||||
|
||||
class TestSBoQueries(unittest.TestCase):
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import unittest
|
||||
from slpkg.utilities import Utilities
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.repositories import Repositories
|
||||
|
||||
|
||||
class TestUtilities(unittest.TestCase):
|
||||
|
@ -8,27 +10,27 @@ class TestUtilities(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.utils = Utilities()
|
||||
self.configs = Configs()
|
||||
self.file_pattern = f'*{self.configs.sbo_repo_tag}'
|
||||
self.repos = Repositories()
|
||||
self.build_path = Configs.build_path
|
||||
self.package = 'fish-3.6.0-x86_64-1_SBo'
|
||||
|
||||
def test_ins_installed(self):
|
||||
self.assertEqual(self.package, self.utils.is_package_installed('fish', self.file_pattern))
|
||||
self.assertEqual(self.package, self.utils.is_package_installed('fish'))
|
||||
|
||||
def test_split_name(self):
|
||||
self.assertEqual('fish', self.utils.split_installed_pkg(self.package)[0])
|
||||
self.assertEqual('fish', self.utils.split_binary_pkg(self.package)[0])
|
||||
|
||||
def test_split_version(self):
|
||||
self.assertEqual('3.6.0', self.utils.split_installed_pkg(self.package)[1])
|
||||
self.assertEqual('3.6.0', self.utils.split_binary_pkg(self.package)[1])
|
||||
|
||||
def test_split_arch(self):
|
||||
self.assertEqual('x86_64', self.utils.split_installed_pkg(self.package)[2])
|
||||
self.assertEqual('x86_64', self.utils.split_binary_pkg(self.package)[2])
|
||||
|
||||
def test_split_build(self):
|
||||
self.assertEqual('1', self.utils.split_installed_pkg(self.package)[3])
|
||||
self.assertEqual('1', self.utils.split_binary_pkg(self.package)[3])
|
||||
|
||||
def test_split_tag(self):
|
||||
self.assertEqual('SBo', self.utils.split_installed_pkg(self.package)[4])
|
||||
self.assertEqual('SBo', self.utils.split_binary_pkg(self.package)[4])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Reference in a new issue