Added pprkut repository #175

This commit is contained in:
Dimitris Zlatanidis 2023-11-29 20:49:53 +02:00
parent 3f982aa89e
commit 760cbe2074
5 changed files with 183 additions and 15 deletions

View file

@ -1,6 +1,6 @@
# This is the general repositories configuration file of slpkg:
# /etc/slpkg/repositories.toml
# Date: 26/04/2023, Version: 4.8.3
# Date: 29/11/2023, Version: 4.9.3
# Set 'true' to the variable {NAME}_REPO to enable a repository.
@ -32,7 +32,7 @@
# Make sure you have enabled it before.
DEFAULT_REPOSITORY = "sbo"
# SBo Repository for Slackware 15.0 stable.
# SBo repository for Slackware 15.0 stable.
SBO_REPO = true
SBO_REPO_NAME = "sbo"
SBO_REPO_LOCAL = [""]
@ -43,7 +43,7 @@ SBO_REPO_TAG = "_SBo" # Default repo TAG.
SBO_REPO_PATCH_TAG = "" # Patch the TAG.
SBO_REPO_TAR_SUFFIX = ".tar.gz"
# Ponce Repository for Slackware -current.
# Ponce repository for Slackware -current.
PONCE_REPO = false
PONCE_REPO_NAME = "ponce"
PONCE_REPO_LOCAL = [""]
@ -87,7 +87,7 @@ SLACK_PATCHES_REPO_CHECKSUMS = "CHECKSUMS.md5"
SLACK_PATCHES_REPO_CHANGELOG = "ChangeLog.txt"
SLACK_PATCHES_REPO_TAG = ""
# AlienBob Repository for Slackware x86_64 15.0 stable.
# AlienBob 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
@ -99,7 +99,7 @@ ALIEN_REPO_CHECKSUMS = "CHECKSUMS.md5"
ALIEN_REPO_CHANGELOG = "ChangeLog.txt"
ALIEN_REPO_TAG = "alien"
# Multilib Repository for Slackware x86_64 15.0 stable.
# Multilib repository for Slackware x86_64 15.0 stable.
# For Slackware x86_64 -current:
# ["https://slackware.nl/people/alien/multilib/", current/"]
MULTILIB_REPO = false
@ -111,7 +111,7 @@ MULTILIB_REPO_CHECKSUMS = "CHECKSUMS.md5"
MULTILIB_REPO_CHANGELOG = "ChangeLog.txt"
MULTILIB_REPO_TAG = "alien"
# Restricted Repository for Slackware x86_64 15.0 stable.
# Restricted 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
@ -123,7 +123,7 @@ RESTRICTED_REPO_CHECKSUMS = "CHECKSUMS.md5"
RESTRICTED_REPO_CHANGELOG = "ChangeLog.txt"
RESTRICTED_REPO_TAG = "alien"
# Gnome Repository for Slackware x86_64 15.0 stable.
# Gnome 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
@ -135,7 +135,7 @@ GNOME_REPO_CHECKSUMS = "CHECKSUMS.md5"
GNOME_REPO_CHANGELOG = "ChangeLog.txt"
GNOME_REPO_TAG = "gfs"
# MATE Repository for Slackware x86_64 15.0 stable.
# MATE 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
@ -147,7 +147,7 @@ MSB_REPO_CHECKSUMS = "CHECKSUMS.md5"
MSB_REPO_CHANGELOG = "ChangeLog.txt"
MSB_REPO_TAG = "msb"
# Cinnamon Repository for Slackware x86_64 15.0 stable.
# Cinnamon repository for Slackware x86_64 15.0 stable.
# For Slackware x86_64 -current:
# ["https://slackware.uk/csb/", "current/", "x86_64/"]
CSB_REPO = false
@ -159,7 +159,7 @@ CSB_REPO_CHECKSUMS = "CHECKSUMS.md5"
CSB_REPO_CHANGELOG = "ChangeLog.txt"
CSB_REPO_TAG = "csb"
# Conraid Repository for Slackware x86_64 -current.
# Conraid repository for Slackware x86_64 -current.
CONRAID_REPO = false
CONRAID_REPO_NAME = "conraid"
CONRAID_REPO_LOCAL = [""]
@ -169,7 +169,7 @@ CONRAID_REPO_CHECKSUMS = "CHECKSUMS.md5"
CONRAID_REPO_CHANGELOG = "ChangeLog.txt"
CONRAID_REPO_TAG = "cf"
# Slackonly Repository for Slackware x86_64 15.0 stable.
# Slackonly 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
@ -221,7 +221,7 @@ SLACKEL_REPO_CHECKSUMS = "CHECKSUMS.md5"
SLACKEL_REPO_CHANGELOG = "ChangeLog.txt"
SLACKEL_REPO_TAG = "dj"
# Slint Repository for Slackware x86_64 15.0 stable.
# Slint repository for Slackware x86_64 15.0 stable.
SLINT_REPO = false
SLINT_REPO_NAME = "slint"
SLINT_REPO_LOCAL = [""]
@ -230,3 +230,15 @@ SLINT_REPO_PACKAGES = "PACKAGES.TXT"
SLINT_REPO_CHECKSUMS = "CHECKSUMS.md5"
SLINT_REPO_CHANGELOG = "ChangeLog.txt"
SLINT_REPO_TAG = "slint"
# Pprkut repository for Slackware x86_64 15.0 stable.
# For Slackware x86_64 -current:
# ["https://repo.liwjatan.org/pprkut/current/x86_64/"]
PPRKUT_REPO = false
PPRKUT_REPO_NAME = "pprkut"
PPRKUT_REPO_LOCAL = [""]
PPRKUT_REPO_MIRROR = ["https://repo.liwjatan.org/pprkut/15.0/x86_64/"]
PPRKUT_REPO_PACKAGES = "PACKAGES.TXT"
PPRKUT_REPO_CHECKSUMS = "CHECKSUMS.md5"
PPRKUT_REPO_CHANGELOG = "ChangeLog.txt"
PPRKUT_REPO_TAG = "pprkut"

View file

@ -1,4 +1,4 @@
Supported Repositories:
Supported repositories:
> sbo: https://slackbuilds.org/
> ponce: https://cgit.ponce.cc/slackbuilds/
@ -18,5 +18,6 @@ Supported Repositories:
> salixos_patches: https://download.salixos.org/x86_64/slackware-15.0/patches/
> slackel: http://www.slackel.gr/repo/x86_64/current/
> slint: https://slackware.uk/slint/x86_64/slint-15.0/
> pprkut: https://repo.liwjatan.org/pprkut/15.0/x86_64/
Edit the file '/etc/slpkg/repositories.toml' file for more.

View file

@ -1652,3 +1652,93 @@ class InstallData(Configs):
self.session.commit()
self.view_done_message()
def install_pprkut_data(self) -> None:
""" Install the data for pprkut repository. """
print(f"Updating the database for '{self.cyan}{self.repos.pprkut_repo_name}{self.endc}'... ",
end='', flush=True)
checksums_dict: dict = {}
pkg_tag = [
'PACKAGE NAME:',
'PACKAGE LOCATION:',
'PACKAGE SIZE (compressed):',
'PACKAGE SIZE (uncompressed):',
'PACKAGE DESCRIPTION:'
]
path_packages: Path = Path(self.repos.pprkut_repo_path, self.repos.pprkut_repo_packages)
path_checksums: Path = Path(self.repos.pprkut_repo_path, self.repos.pprkut_repo_checksums)
path_changelog: Path = Path(self.repos.pprkut_repo_path, self.repos.pprkut_repo_changelog)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = ''.join(self.repos.pprkut_repo_mirror)
if self.repos.pprkut_repo_local[0].startswith('file'):
mirror: str = ''.join(self.repos.pprkut_repo_local)
for line in checksums_md5:
line = line.strip()
if line.endswith(('.txz', '.tgz')):
file: str = line.split('./')[1].split('/')[-1].strip()
checksum: str = line.split('./')[0].strip()
checksums_dict[file] = checksum
cache: list = [] # init cache
for line in packages_txt:
if line.startswith(pkg_tag[0]):
package = line.replace(pkg_tag[0], '').strip()
name: str = self.utils.split_package(package)['name']
version: str = self.utils.split_package(package)['version']
cache.append(name)
cache.append(version)
cache.append(package)
cache.append(mirror)
try:
cache.append(checksums_dict[package])
except KeyError:
cache.append('error checksum')
if line.startswith(pkg_tag[1]):
package_location = line.replace(pkg_tag[1], '').strip()
cache.append(package_location[2:]) # Do not install (./) dot
if line.startswith(pkg_tag[2]):
cache.append(''.join(re.findall(r'\d+', line)))
if line.startswith(pkg_tag[3]):
cache.append(''.join(re.findall(r'\d+', line)))
if line.startswith(pkg_tag[4]):
package_description = line.replace(pkg_tag[4], '').strip()
cache.append(package_description)
if len(cache) == 9:
data: str = BinariesTable(
repo=self.repos.pprkut_repo_name,
name=cache[0],
version=cache[1],
package=cache[2],
mirror=cache[3],
checksum=cache[4],
location=cache[5],
size_comp=cache[6],
size_uncomp=cache[7],
description=cache[8],
required='',
conflicts='',
suggests=''
)
self.session.add(data)
cache: list = [] # reset cache
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.pprkut_repo_name, date=last_updated)
self.session.add(date)
self.session.commit()
self.view_done_message()

View file

@ -203,6 +203,16 @@ class Repositories:
slint_repo_changelog: str = 'ChangeLog.txt'
slint_repo_tag: str = 'slint'
pprkut_repo: bool = False
pprkut_repo_name: str = 'pprkut'
pprkut_repo_path: Path = Path(repositories_path, pprkut_repo_name)
pprkut_repo_local = ['']
pprkut_repo_mirror = ['https://repo.liwjatan.org/pprkut/15.0/x86_64/']
pprkut_repo_packages: str = 'PACKAGES.TXT'
pprkut_repo_checksums: str = 'CHECKSUMS.md5'
pprkut_repo_changelog: str = 'ChangeLog.txt'
pprkut_repo_tag: str = 'pprkut'
try:
if repositories_toml_file.is_file():
with open(repositories_toml_file, 'rb') as repo:
@ -499,6 +509,22 @@ class Repositories:
except IndexError:
slint_repo_local = ['']
pprkut_repo: bool = repos_config['PPRKUT_REPO']
pprkut_repo_name: str = repos_config['PPRKUT_REPO_NAME']
pprkut_repo_local = repos_config['PPRKUT_REPO_LOCAL']
pprkut_repo_mirror = repos_config['PPRKUT_REPO_MIRROR']
pprkut_repo_packages: str = repos_config['PPRKUT_REPO_PACKAGES']
pprkut_repo_checksums: str = repos_config['PPRKUT_REPO_CHECKSUMS']
pprkut_repo_changelog: str = repos_config['PPRKUT_REPO_CHANGELOG']
pprkut_repo_tag: str = repos_config['PPRKUT_REPO_TAG']
try:
if pprkut_repo_local[0].startswith('file'):
pprkut_repo_path: Path = Path(
''.join(pprkut_repo_local).replace('file:', '')
)
except IndexError:
pprkut_repo_local = ['']
except (tomli.TOMLDecodeError, KeyError) as error:
errors.raise_toml_error_message(error, repositories_toml_file)
@ -664,5 +690,14 @@ class Repositories:
'packages_txt': slint_repo_packages,
'checksums_txt': slint_repo_checksums,
'changelog_txt': slint_repo_changelog,
'repo_tag': slint_repo_tag}
'repo_tag': slint_repo_tag},
pprkut_repo_name: {
'enable': pprkut_repo,
'path': pprkut_repo_path,
'mirror': pprkut_repo_mirror,
'packages_txt': pprkut_repo_packages,
'checksums_txt': pprkut_repo_checksums,
'changelog_txt': pprkut_repo_changelog,
'repo_tag': pprkut_repo_tag}
}

View file

@ -74,7 +74,8 @@ class UpdateRepositories(Configs):
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
self.repos.slint_repo_name: self.slint_repository,
self.repos.pprkut_repo_name: self.pprkut_repository
}
if self.option_for_repository:
@ -595,6 +596,35 @@ class UpdateRepositories(Configs):
self.delete_last_updated(self.repos.slint_repo_name)
self.data.install_slint_data()
def pprkut_repository(self) -> None:
if not self.option_for_install_data:
urls: dict = {}
self.utils.create_directory(self.repos.pprkut_repo_path)
self.utils.remove_file_if_exists(self.repos.pprkut_repo_path, self.repos.pprkut_repo_changelog)
self.utils.remove_file_if_exists(self.repos.pprkut_repo_path, self.repos.pprkut_repo_packages)
self.utils.remove_file_if_exists(self.repos.pprkut_repo_path, self.repos.pprkut_repo_checksums)
if self.repos.pprkut_repo_local[0].startswith('file'):
lftp_command: str = (
f'lftp {self.lftp_mirror_options} {self.repos.pprkut_repo_mirror[0]} '
f'{self.repos.pprkut_repo_path}'
)
self.utils.process(lftp_command)
else:
changelog: str = f'{self.repos.pprkut_repo_mirror[0]}{self.repos.pprkut_repo_changelog}'
packages: str = f'{self.repos.pprkut_repo_mirror[0]}{self.repos.pprkut_repo_packages}'
checksums: str = f'{self.repos.pprkut_repo_mirror[0]}{self.repos.pprkut_repo_checksums}'
urls[self.repos.pprkut_repo_name] = ((changelog, packages, checksums), self.repos.pprkut_repo_path)
self.download.download(urls)
print()
self.delete_bin_database_data(self.repos.pprkut_repo_name)
self.delete_last_updated(self.repos.pprkut_repo_name)
self.data.install_pprkut_data()
def ponce_repository(self) -> None:
""" Update the slackbuild repositories. """
if not self.option_for_install_data: