Added salixos repo

This commit is contained in:
Dimitris Zlatanidis 2023-03-31 12:16:18 +03:00
parent 13480d60d6
commit 873f742848
6 changed files with 164 additions and 8 deletions

View file

@ -91,3 +91,11 @@
PONCE_BIN_REPO_PACKAGES = "PACKAGES.TXT"
PONCE_BIN_REPO_CHECKSUMS = "CHECKSUMS.md5"
PONCE_BIN_REPO_CHANGELOG = "ChangeLog.txt"
# Repository for slackware 15.0 stable.
SALIXOS_REPO_NAME = "salixos"
SALIXOS_REPO = false
SALIXOS_REPO_MIRROR = "https://download.salixos.org/x86_64/slackware-15.0/"
SALIXOS_REPO_PACKAGES = "PACKAGES.TXT"
SALIXOS_REPO_CHECKSUMS = "CHECKSUMS.md5"
SALIXOS_REPO_CHANGELOG = "ChangeLog.txt"

View file

@ -76,6 +76,11 @@ class CheckUpdates(Configs):
self.repo_chg_txt: str = f'{self.repos.ponce_bin_repo_mirror}{self.repos.ponce_bin_repo_changelog}'
compare[self.repos.ponce_bin_repo_name] = self.compare_dates()
if self.repos.salixos_repo and self.repo == self.repos.salixos_repo_name or self.repo == '*':
self.local_chg_txt: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.salixos_repo_mirror}{self.repos.salixos_repo_changelog}'
compare[self.repos.salixos_repo_name] = self.compare_dates()
else:
if self.repos.ponce_repo:
self.local_chg_txt: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog)

View file

@ -701,3 +701,98 @@ class InstallData(Configs):
print(f'{self.byellow}Done{self.endc}')
self.session.commit()
def install_salixos_data(self) -> None:
""" Install the data for slackonly repository. """
checksums_dict: dict = {}
pkg_tag = [
'PACKAGE NAME:',
'PACKAGE LOCATION:',
'PACKAGE SIZE (compressed):',
'PACKAGE SIZE (uncompressed):',
'PACKAGE REQUIRED:',
'PACKAGE DESCRIPTION:'
]
path_packages: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_packages)
path_checksums: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_checksums)
path_changelog: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
for line in checksums_md5:
line = line.strip()
if line.endswith(('.txz', '.tgz')):
file: str = line.split('./')[1].split('/')[-1].strip()
checksum: str = line.split('./')[0].strip()
checksums_dict[file] = checksum
cache: list = [] # init cache
print('Creating the database... ', end='', flush=True)
for line in packages_txt:
if line.startswith(pkg_tag[0]):
package_name = line.replace(pkg_tag[0], '').strip()
split_package: list = self.utils.split_binary_pkg(package_name)
cache.append(split_package[0]) # package name
cache.append(split_package[1]) # package version
cache.append(package_name)
cache.append(self.repos.salixos_repo_mirror)
try:
cache.append(checksums_dict[package_name])
except KeyError:
cache.append('error checksum')
if line.startswith(pkg_tag[1]):
package_location = line.replace(pkg_tag[1], '').strip()
cache.append(package_location[1:]) # Do not install (.) dot
if line.startswith(pkg_tag[2]):
package_size_comp = line.replace(pkg_tag[2], '').strip()
cache.append(f'{package_size_comp}B')
if line.startswith(pkg_tag[3]):
package_size_uncomp = line.replace(pkg_tag[3], '').strip()
cache.append(f'{package_size_uncomp}B')
if line.startswith(pkg_tag[4]):
required = line.replace(
pkg_tag[4], '').replace(
',', ' ').replace(
'|', ' ').strip()
list_required: list = required.split(' ')
package_required: str = ' '.join(list(set(list_required)))
cache.append(package_required)
if line.startswith(pkg_tag[5]):
package_description = line.replace(pkg_tag[5], '').strip()
cache.append(package_description)
if len(cache) == 10:
data: str = BinariesTable(
repo=self.repos.salixos_repo_name,
name=cache[0],
version=cache[1],
package=cache[2],
mirror=cache[3],
checksum=cache[4],
location=cache[5],
size_comp=cache[6],
size_uncomp=cache[7],
required=cache[8],
description=cache[9]
)
self.session.add(data)
cache: list = [] # reset cache
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.salixos_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}')
self.session.commit()

View file

@ -67,7 +67,8 @@ class RepoInfo(Configs):
self.repos.gnome_repo_name: BinQueries('', repo).count_packages(),
self.repos.conraid_repo_name: BinQueries('', repo).count_packages(),
self.repos.slackonly_repo_name: BinQueries('', repo).count_packages(),
self.repos.ponce_bin_repo_name: BinQueries('', repo).count_packages()
self.repos.ponce_bin_repo_name: BinQueries('', repo).count_packages(),
self.repos.salixos_repo_name: BinQueries('', repo).count_packages()
}
if value[0]:

View file

@ -100,6 +100,14 @@ class Repositories:
ponce_bin_repo_checksums: str = "CHECKSUMS.md5"
ponce_bin_repo_changelog: str = "ChangeLog.txt"
salixos_repo_name: str = 'salixos'
salixos_repo: bool = False
salixos_repo_path: Path = Path(config.lib_path, 'repositories', salixos_repo_name)
salixos_repo_mirror: str = "https://download.salixos.org/x86_64/slackware-15.0/"
salixos_repo_packages: str = "PACKAGES.TXT"
salixos_repo_checksums: str = "CHECKSUMS.md5"
salixos_repo_changelog: str = "ChangeLog.txt"
# Default repository tag.
repo_tag: str = sbo_repo_tag
@ -177,6 +185,13 @@ class Repositories:
ponce_bin_repo_checksums: str = repos['PONCE_BIN_REPO_CHECKSUMS']
ponce_bin_repo_changelog: str = repos['PONCE_BIN_REPO_CHANGELOG']
salixos_repo_name: str = repos['SALIXOS_REPO_NAME']
salixos_repo: bool = repos['SALIXOS_REPO']
salixos_repo_mirror: str = repos['SALIXOS_REPO_MIRROR']
salixos_repo_packages: str = repos['SALIXOS_REPO_PACKAGES']
salixos_repo_checksums: str = repos['SALIXOS_REPO_CHECKSUMS']
salixos_repo_changelog: str = repos['SALIXOS_REPO_CHANGELOG']
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"
@ -192,7 +207,8 @@ class Repositories:
gnome_repo_name: gnome_repo,
conraid_repo_name: conraid_repo,
slackonly_repo_name: slackonly_repo,
ponce_bin_repo_name: ponce_bin_repo
ponce_bin_repo_name: ponce_bin_repo,
salixos_repo_name:salixos_repo
}
# All enabled binaries repositories.
@ -215,5 +231,6 @@ class Repositories:
gnome_repo_name: [gnome_repo, gnome_repo_path, gnome_repo_changelog],
conraid_repo_name: [conraid_repo, conraid_repo_path, conraid_repo_changelog],
slackonly_repo_name: [slackonly_repo, slackonly_repo_path, slackonly_repo_changelog],
ponce_bin_repo_name: [ponce_bin_repo, ponce_bin_repo_path, ponce_bin_repo_changelog]
ponce_bin_repo_name: [ponce_bin_repo, ponce_bin_repo_path, ponce_bin_repo_changelog],
salixos_repo_name: [salixos_repo, salixos_repo_path, salixos_repo_changelog]
}

View file

@ -57,6 +57,12 @@ class UpdateRepository(Configs):
if self.repo == self.repos.alien_repo_name or self.repo == '*':
self.alien_repository()
if self.repo == self.repos.multilib_repo_name or self.repo == '*':
self.multilib_repository()
if self.repo == self.repos.restricted_repo_name or self.repo == '*':
self.restricted_repository()
if self.repo == self.repos.gnome_repo_name or self.repo == '*':
self.gnome_repository()
@ -69,11 +75,8 @@ class UpdateRepository(Configs):
if self.repo == self.repos.ponce_bin_repo_name or self.repo == '*':
self.ponce_bin_repository()
if self.repo == self.repos.multilib_repo_name or self.repo == '*':
self.multilib_repository()
if self.repo == self.repos.restricted_repo_name or self.repo == '*':
self.restricted_repository()
if self.repo == self.repos.salixos_repo_name or self.repo == '*':
self.salixos_repository()
else:
self.slackbuild_repositories()
@ -264,6 +267,33 @@ class UpdateRepository(Configs):
else:
self.not_enabled_message(self.repos.ponce_bin_repo_name)
def salixos_repository(self):
if self.repos.salixos_repo:
urls: list = []
print('Updating the packages list...\n')
print(f"Downloading the '{self.green}{self.repos.salixos_repo_name}{self.endc}' "
f"repository, please wait...\n")
self.make_dirs(self.repos.salixos_repo_name)
urls.append(f'{self.repos.salixos_repo_mirror}{self.repos.salixos_repo_packages}')
urls.append(f'{self.repos.salixos_repo_mirror}{self.repos.salixos_repo_changelog}')
urls.append(f'{self.repos.salixos_repo_mirror}{self.repos.salixos_repo_checksums}')
self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_packages)
self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog)
self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_checksums)
down = Downloader(self.repos.salixos_repo_path, urls, self.flags)
down.download()
print()
self.delete_binaries_data(self.repos.salixos_repo_name)
self.delete_last_updated(self.repos.salixos_repo_name)
self.data.install_salixos_data()
print()
else:
self.not_enabled_message(self.repos.salixos_repo_name)
def slackbuild_repositories(self):
""" Update the slackbuild repositories. """
if self.repos.ponce_repo: