Added slackware extra repository

This commit is contained in:
Dimitris Zlatanidis 2023-04-02 11:05:51 +03:00
parent 5190867c2e
commit 264c4eded2
5 changed files with 124 additions and 1 deletions

View file

@ -46,7 +46,7 @@
# For Slackware patches x86_64 -current:
# https://slackware.uk/slackware/slackware64-current/extra/
SLACK_EXTRA_REPO = false
SLACK_EXTRA_REPO_NAME = "slack_patches"
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"

View file

@ -38,6 +38,7 @@ class CheckUpdates(Configs):
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,
@ -76,6 +77,11 @@ class CheckUpdates(Configs):
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}'

View file

@ -174,6 +174,91 @@ class InstallData(Configs):
self.session.commit()
def install_slack_extra_data(self) -> None:
""" Install the data for slackware extra repository. """
checksums_dict: dict = {}
pkg_tag = [
'PACKAGE NAME:',
'PACKAGE MIRROR:',
'PACKAGE LOCATION:',
'PACKAGE SIZE (compressed):',
'PACKAGE SIZE (uncompressed):',
'PACKAGE DESCRIPTION:'
]
path_packages: Path = Path(self.repos.slack_extra_repo_path, self.repos.slack_extra_repo_packages)
path_checksums: Path = Path(self.repos.slack_extra_repo_path, self.repos.slack_extra_repo_checksums)
path_changelog: Path = Path(self.repos.slack_extra_repo_path, self.repos.slack_extra_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
for line in checksums_md5:
line = line.strip()
if line.endswith(('.txz', '.tgz')):
file: str = line.split('./')[1].split('/')[-1].strip()
checksum: str = line.split('./')[0].strip()
checksums_dict[file] = checksum
cache: list = [] # init cache
print('Creating the database... ', end='', flush=True)
for line in packages_txt:
if line.startswith(pkg_tag[0]):
package_name = line.replace(pkg_tag[0], '').strip()
split_package: list = self.utils.split_binary_pkg(package_name)
cache.append(split_package[0]) # package name
cache.append(split_package[1]) # package version
cache.append(package_name)
cache.append(self.repos.slack_extra_repo_mirror)
try:
cache.append(checksums_dict[package_name])
except KeyError:
cache.append('error checksum')
if line.startswith(pkg_tag[2]):
package_location = line.replace(pkg_tag[2], '').strip()
cache.append(package_location[2:]) # Do not install (.) dot
if line.startswith(pkg_tag[3]):
package_size_comp = line.replace(pkg_tag[3], '').strip()
cache.append(f'{package_size_comp}B')
if line.startswith(pkg_tag[4]):
package_size_uncomp = line.replace(pkg_tag[4], '').strip()
cache.append(f'{package_size_uncomp}B')
if line.startswith(pkg_tag[5]):
package_description = line.replace(pkg_tag[5], '').strip()
cache.append(package_description)
if len(cache) == 9:
data: str = BinariesTable(
repo=self.repos.slack_extra_repo_name,
name=cache[0],
version=cache[1],
package=cache[2],
mirror=cache[3],
checksum=cache[4],
location=cache[5],
size_comp=cache[6],
size_uncomp=cache[7],
description=cache[8],
required=''
)
self.session.add(data)
cache: list = [] # reset cache
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.slack_extra_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}')
self.session.commit()
def install_slack_patches_data(self) -> None:
""" Install the data for slackware patches repository. """
checksums_dict: dict = {}

View file

@ -327,6 +327,7 @@ class 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],

View file

@ -60,6 +60,7 @@ class UpdateRepository(Configs):
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,
@ -115,6 +116,36 @@ class UpdateRepository(Configs):
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_patches_repo_name)
def slack_patches_repository(self):
if self.repos.slack_patches_repo:
urls: list = []