diff --git a/configs/repositories.toml b/configs/repositories.toml index 54fff846..444790b5 100644 --- a/configs/repositories.toml +++ b/configs/repositories.toml @@ -17,8 +17,7 @@ REPO = "sbo" [SBO] ENABLE = true -MIRROR = "https://slackbuilds.org/slackbuilds/" -VERSION = "15.0" +MIRROR = "https://slackbuilds.org/slackbuilds/15.0/" [PONCE] ENABLE = false @@ -26,16 +25,16 @@ MIRROR = "https://cgit.ponce.cc/slackbuilds/plain/" [SLACK] ENABLE = false -MIRROR = "https://slackware.uk/slackware/slackware64-15.0/" +MIRROR = "http://mirror.nl.leaseweb.net/slackware/slackware64-15.0/" [SLACK_EXTRA] ENABLE = false -MIRROR = "https://slackware.uk/slackware/slackware64-15.0/" +MIRROR = "http://mirror.nl.leaseweb.net/slackware/slackware64-15.0/" BRANCH = "extra" [SLACK_PATCHES] ENABLE = false -MIRROR = "https://slackware.uk/slackware/slackware64-15.0/" +MIRROR = "http://mirror.nl.leaseweb.net/slackware/slackware64-15.0/" BRANCH = "patches" [ALIEN] diff --git a/slpkg/install_data.py b/slpkg/install_data.py index bfc12426..6ed802b3 100644 --- a/slpkg/install_data.py +++ b/slpkg/install_data.py @@ -48,13 +48,13 @@ class InstallData(Configs): def view_done_message(self) -> None: print(f'{self.bgreen}{self.ascii.done}{self.endc}\n') - def install_sbo_data(self) -> None: + def install_sbo_data(self, repo: str) -> None: """ Reads the SLACKBUILDS.TXT FILE and creates a json data file. Returns: None. """ - print(f"Updating the database for '{self.cyan}{self.repos.sbo_repo_name}{self.endc}'... ", + print(f"Updating the database for '{self.cyan}{repo}{self.endc}'... ", end='', flush=True) self._import_GPG_KEY(mirror='https://www.slackbuilds.org/') @@ -74,8 +74,9 @@ class InstallData(Configs): 'SLACKBUILD SHORT DESCRIPTION:' ] - slackbuilds_txt: list = Path(self.repos.sbo_repo_path, - self.repos.sbo_repo_slackbuilds).read_text(encoding='utf-8').splitlines() + slackbuilds_txt: list = Path(self.repos.repositories[repo]['path'], + self.repos.repositories[repo]['slackbuilds_txt']).read_text( + encoding='utf-8').splitlines() for i, line in enumerate(slackbuilds_txt, 1): for tag in sbo_tags: @@ -103,7 +104,7 @@ class InstallData(Configs): } arch: str = self.os_arch - sbo_file: Path = Path(self.repos.sbo_repo_path, location, name, f'{name}.SlackBuild') + sbo_file: Path = Path(self.repos.repositories[repo]['path'], location, name, f'{name}.SlackBuild') if sbo_file.is_file(): slackbuild = sbo_file.read_text(encoding='utf-8').splitlines() for sbo_line in slackbuild: @@ -114,1785 +115,21 @@ class InstallData(Configs): data[name].update({'arch': arch}) data[name].update({'build': build}) - package: str = f'{name}-{version}-{arch}-{build}{self.repos.sbo_repo_tag}.tgz' + package: str = f"{name}-{version}-{arch}-{build}{self.repos.repositories[repo]['repo_tag']}.tgz" data[name].update({'package': package}) cache: list = [] # reset cache after 11 lines - path_changelog: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog) + path_changelog: Path = Path(self.repos.repositories[repo]['path'], + self.repos.repositories[repo]['changelog_txt']) self.write_last_update(path_changelog, self.repos.sbo_repo_name) - data_file: Path = Path(self.repos.sbo_repo_path, self.repos.data_json) + data_file: Path = Path(self.repos.repositories[repo]['path'], self.repos.data_json) data_file.write_text(json.dumps(data, indent=4)) self.view_done_message() - def install_ponce_data(self) -> None: - """ - Reads the SLACKBUILDS.TXT FILE and creates a json data file. - Returns: - None. - """ - print(f"Updating the database for '{self.cyan}{self.repos.ponce_repo_name}{self.endc}'... ", - end='', flush=True) - data: dict = {} - cache: list = [] - names: list = [] - sbo_tags: list = [ - 'SLACKBUILD NAME:', - 'SLACKBUILD LOCATION:', - 'SLACKBUILD FILES:', - 'SLACKBUILD VERSION:', - 'SLACKBUILD DOWNLOAD:', - 'SLACKBUILD DOWNLOAD_x86_64:', - 'SLACKBUILD MD5SUM:', - 'SLACKBUILD MD5SUM_x86_64:', - 'SLACKBUILD REQUIRES:', - 'SLACKBUILD SHORT DESCRIPTION:' - ] - - slackbuilds_txt: list = Path(self.repos.ponce_repo_path, - self.repos.ponce_repo_slackbuilds).read_text(encoding='utf-8').splitlines() - - for line in slackbuilds_txt: - if line.startswith(sbo_tags[0]): - names.append(line.replace(sbo_tags[0], '').strip()) - - for i, line in enumerate(slackbuilds_txt, 1): - for tag in sbo_tags: - if line.startswith(tag): - line = line.replace(tag, '').strip() - cache.append(line) - - if (i % 11) == 0: - build: str = '' - name: str = cache[0] - version: str = cache[3] - location: str = cache[1].split('/')[1] - requires: list = [item for item in cache[8].split() if item in names] - - data[name] = { - 'location': location, - 'files': cache[2].split(), - 'version': version, - 'download': cache[4].split(), - 'download64': cache[5].split(), - 'md5sum': cache[6].split(), - 'md5sum64': cache[7].split(), - 'requires': requires, - 'description': cache[9] - } - - arch: str = self.os_arch - sbo_file: Path = Path(self.repos.ponce_repo_path, location, name, f'{name}.SlackBuild') - if sbo_file.is_file(): - slackbuild = sbo_file.read_text(encoding='utf-8').splitlines() - for sbo_line in slackbuild: - if sbo_line.startswith('BUILD=$'): - build: str = ''.join(re.findall(r'\d+', sbo_line)) - if sbo_line.startswith('ARCH=noarch'): - arch: str = 'noarch' - - data[name].update({'arch': arch}) - data[name].update({'build': build}) - package: str = f'{name}-{version}-{arch}-{build}{self.repos.sbo_repo_tag}.tgz' - data[name].update({'package': package}) - - cache: list = [] # reset cache after 11 lines - - path_changelog: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog) - self.write_last_update(path_changelog, self.repos.ponce_repo_name) - - data_file: Path = Path(self.repos.ponce_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_slack_data(self) -> None: - """ Install the data for slackware repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.slack_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.slack_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - data: dict = {} - checksums_dict: dict = {} - build: str = '' - arch: str = '' - requires: list = [] - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE MIRROR:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.slack_repo_path, self.repos.slack_repo_packages) - path_checksums: Path = Path(self.repos.slack_repo_path, self.repos.slack_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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[2]): - package_location = line.replace(pkg_tag[2], '').strip() - cache.append(package_location[2:]) # Do not install (.) dot - - if line.startswith(pkg_tag[3]): - cache.append(''.join(re.findall(r'\d+', line))) - - if line.startswith(pkg_tag[4]): - cache.append(''.join(re.findall(r'\d+', line))) - - if line.startswith(pkg_tag[5]): - package_description = line.replace(pkg_tag[5], '').strip() - cache.append(package_description) - - if len(cache) == 9: - data[cache[0]] = { - 'repo': self.repos.slack_repo_name, - '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], - 'build': build, - 'arch': arch, - 'requires': requires, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.slack_repo_path, self.repos.slack_repo_changelog) - self.write_last_update(path_changelog, self.repos.slack_repo_name) - - data_file: Path = Path(self.repos.slack_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_slack_extra_data(self) -> None: - """ Install the data for slackware extra repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.slack_extra_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.slack_extra_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - requires: list = [] - 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) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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[2]): - package_location = line.replace(pkg_tag[2], '').strip() - cache.append(package_location[2:]) # Do not install (.) dot - - if line.startswith(pkg_tag[3]): - cache.append(''.join(re.findall(r'\d+', line))) - - if line.startswith(pkg_tag[4]): - cache.append(''.join(re.findall(r'\d+', line))) - - if line.startswith(pkg_tag[5]): - package_description = line.replace(pkg_tag[5], '').strip() - cache.append(package_description) - - if len(cache) == 9: - data[cache[0]] = { - 'repo': self.repos.slack_extra_repo_name, - '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], - 'build': build, - 'arch': arch, - 'requires': requires, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.slack_extra_repo_path, self.repos.slack_extra_repo_changelog) - self.write_last_update(path_changelog, self.repos.slack_extra_repo_name) - - data_file: Path = Path(self.repos.slack_extra_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_slack_patches_data(self) -> None: - """ Install the data for slackware patches repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.slack_patches_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.slack_patches_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - requires: list = [] - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE MIRROR:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.slack_patches_repo_path, self.repos.slack_patches_repo_packages) - path_checksums: Path = Path(self.repos.slack_patches_repo_path, self.repos.slack_patches_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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[2]): - package_location = line.replace(pkg_tag[2], '').strip() - cache.append(package_location[2:]) # Do not install (.) dot - - if line.startswith(pkg_tag[3]): - cache.append(''.join(re.findall(r'\d+', line))) - - if line.startswith(pkg_tag[4]): - cache.append(''.join(re.findall(r'\d+', line))) - - if line.startswith(pkg_tag[5]): - package_description = line.replace(pkg_tag[5], '').strip() - cache.append(package_description) - - if len(cache) == 9: - data[cache[0]] = { - 'repo': self.repos.slack_patches_repo_name, - '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], - 'build': build, - 'arch': arch, - 'requires': requires, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.slack_patches_repo_path, self.repos.slack_patches_repo_changelog) - self.write_last_update(path_changelog, self.repos.slack_patches_repo_name) - - data_file: Path = Path(self.repos.slack_patches_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_alien_data(self) -> None: - """ Install the data for alien repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.alien_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.alien_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE REQUIRED:', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_packages) - path_checksums: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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]): - required = line.replace(pkg_tag[4], '').strip() - package_required = required.replace(',', ' ').strip() - 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[cache[0]] = { - 'repo': self.repos.alien_repo_name, - 'version': cache[1], - 'package': cache[2], - 'mirror': cache[3], - 'checksum': cache[4], - 'location': cache[5], - 'size_comp': cache[6], - 'size_uncomp': cache[7], - 'requires': cache[8].split(), - 'description': cache[9], - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_changelog) - self.write_last_update(path_changelog, self.repos.alien_repo_name) - - data_file: Path = Path(self.repos.alien_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_multilib_data(self) -> None: - """ Install the data for multilib repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.multilib_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.multilib_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - requires: list = [] - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_packages) - path_checksums: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - cache.append(name) # package name - cache.append(version) # package 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[cache[0]] = { - 'repo': self.repos.multilib_repo_name, - '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], - 'requires': requires, - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_changelog) - self.write_last_update(path_changelog, self.repos.multilib_repo_name) - - data_file: Path = Path(self.repos.multilib_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_restricted_data(self) -> None: - """ Install the data for multilib repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.restricted_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.restricted_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - requires: list = [] - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_packages) - path_checksums: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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[cache[0]] = { - 'repo': self.repos.restricted_repo_name, - '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], - 'requires': requires, - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_changelog) - self.write_last_update(path_changelog, self.repos.restricted_repo_name) - - data_file: Path = Path(self.repos.restricted_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_gnome_data(self) -> None: - """ Install the data for gnome repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.gnome_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.gnome_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - requires: list = [] - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE MIRROR:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_packages) - path_checksums: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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[2]): - package_location = line.replace(pkg_tag[2], '').strip() - cache.append(package_location[1:]) # Do not install (.) dot - - if line.startswith(pkg_tag[3]): - cache.append(''.join(re.findall(r'\d+', line))) - - if line.startswith(pkg_tag[4]): - cache.append(''.join(re.findall(r'\d+', line))) - - if line.startswith(pkg_tag[5]): - package_description = line.replace(pkg_tag[5], '').strip() - cache.append(package_description) - - if len(cache) == 9: - data[cache[0]] = { - 'repo': self.repos.gnome_repo_name, - '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], - 'requires': requires, - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog) - self.write_last_update(path_changelog, self.repos.gnome_repo_name) - - data_file: Path = Path(self.repos.gnome_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_msb_data(self) -> None: - """ Install the data for msb repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.msb_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.msb_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - requires: list = [] - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_packages) - path_checksums: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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[cache[0]] = { - 'repo': self.repos.msb_repo_name, - '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], - 'requires': requires, - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_changelog) - self.write_last_update(path_changelog, self.repos.msb_repo_name) - - data_file: Path = Path(self.repos.msb_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_csb_data(self) -> None: - """ Install the data for csb repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.csb_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.csb_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - requires: list = [] - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.csb_repo_path, self.repos.csb_repo_packages) - path_checksums: Path = Path(self.repos.csb_repo_path, self.repos.csb_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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[cache[0]] = { - 'repo': self.repos.csb_repo_name, - '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], - 'requires': requires, - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.csb_repo_path, self.repos.csb_repo_changelog) - self.write_last_update(path_changelog, self.repos.csb_repo_name) - - data_file: Path = Path(self.repos.csb_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_conraid_data(self) -> None: - """ Install the data for conraid repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.conraid_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.conraid_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - requires: list = [] - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE MIRROR:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_packages) - path_checksums: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 = [] - - for line in packages_txt: - - if line.startswith(pkg_tag[0]): - package: str = line.replace(pkg_tag[0], '').strip() - name: str = self.utils.split_package(package)['name'] - version: str = self.utils.split_package(package)['version'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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[2]): - package_location: str = line.replace(pkg_tag[2], '').strip() - cache.append(package_location[2:]) # Do not install (./) dot - - if line.startswith(pkg_tag[3]): - cache.append(''.join(re.findall(r'\d+', line))) - - if line.startswith(pkg_tag[4]): - cache.append(''.join(re.findall(r'\d+', line))) - - if line.startswith(pkg_tag[5]): - package_description: str = line.replace(pkg_tag[5], '').strip() - cache.append(package_description) - - if len(cache) == 9: - data[cache[0]] = { - 'repo': self.repos.conraid_repo_name, - '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], - 'requires': requires, - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog) - self.write_last_update(path_changelog, self.repos.conraid_repo_name) - - data_file: Path = Path(self.repos.conraid_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_slackdce_data(self) -> None: - """ Install the data for slackdce repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.slackdce_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.slackdce_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE REQUIRED:', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.slackdce_repo_path, self.repos.slackdce_repo_packages) - path_checksums: Path = Path(self.repos.slackdce_repo_path, self.repos.slackdce_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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]): - required = line.replace(pkg_tag[4], '').strip() - package_required = required.replace(',', ' ').strip() - 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[cache[0]] = { - 'repo': self.repos.slackdce_repo_name, - 'version': cache[1], - 'package': cache[2], - 'mirror': cache[3], - 'checksum': cache[4], - 'location': cache[5], - 'size_comp': cache[6], - 'size_uncomp': cache[7], - 'requires': cache[8].split(), - 'description': cache[9], - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.slackdce_repo_path, self.repos.slackdce_repo_changelog) - self.write_last_update(path_changelog, self.repos.slackdce_repo_name) - - data_file: Path = Path(self.repos.slackdce_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_slackonly_data(self) -> None: - """ Install the data for slackonly repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.slackonly_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.slackonly_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE REQUIRED:', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_packages) - path_checksums: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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]): - required = line.replace(pkg_tag[4], '').strip() - package_required = required.replace(',', ' ').strip() - 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[cache[0]] = { - 'repo': self.repos.slackonly_repo_name, - 'version': cache[1], - 'package': cache[2], - 'mirror': cache[3], - 'checksum': cache[4], - 'location': cache[5], - 'size_comp': cache[6], - 'size_uncomp': cache[7], - 'requires': cache[8].split(), - 'description': cache[9], - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_changelog) - self.write_last_update(path_changelog, self.repos.slackonly_repo_name) - - data_file: Path = Path(self.repos.slackonly_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_salix_data(self) -> None: - """ Install the data for salix repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.salix_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.salix_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE REQUIRED:', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.salix_repo_path, self.repos.salix_repo_packages) - path_checksums: Path = Path(self.repos.salix_repo_path, self.repos.salix_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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]): - deps: list = [] - required = line.replace(pkg_tag[4], '').strip() - - for req in required.split(','): - dep = req.split('|') - if len(dep) > 1: - deps.append(dep[1]) - else: - deps.extend(dep) - - cache.append(' '.join(deps)) - - if line.startswith(pkg_tag[5]): - package_description = line.replace(pkg_tag[5], '').strip() - cache.append(package_description) - - if len(cache) == 10: - data[cache[0]] = { - 'repo': self.repos.salix_repo_name, - 'version': cache[1], - 'package': cache[2], - 'mirror': cache[3], - 'checksum': cache[4], - 'location': cache[5], - 'size_comp': cache[6], - 'size_uncomp': cache[7], - 'requires': cache[8].split(), - 'description': cache[9], - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.salix_repo_path, self.repos.salix_repo_changelog) - self.write_last_update(path_changelog, self.repos.salix_repo_name) - - data_file: Path = Path(self.repos.salix_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_salix_extra_data(self) -> None: - """ Install the data for salix_extra repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.salix_extra_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.salix_extra_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE REQUIRED:', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.salix_extra_repo_path, self.repos.salix_extra_repo_packages) - path_checksums: Path = Path(self.repos.salix_extra_repo_path, self.repos.salix_extra_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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]): - deps: list = [] - required = line.replace(pkg_tag[4], '').strip() - - for req in required.split(','): - dep = req.split('|') - if len(dep) > 1: - deps.append(dep[1]) - else: - deps.extend(dep) - - cache.append(' '.join(deps)) - - if line.startswith(pkg_tag[5]): - package_description = line.replace(pkg_tag[5], '').strip() - cache.append(package_description) - - if len(cache) == 10: - data[cache[0]] = { - 'repo': self.repos.salix_extra_repo_name, - 'version': cache[1], - 'package': cache[2], - 'mirror': cache[3], - 'checksum': cache[4], - 'location': cache[5], - 'size_comp': cache[6], - 'size_uncomp': cache[7], - 'requires': cache[8].split(), - 'description': cache[9], - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.salix_extra_repo_path, self.repos.salix_extra_repo_changelog) - self.write_last_update(path_changelog, self.repos.salix_extra_repo_name) - - data_file: Path = Path(self.repos.salix_extra_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_slackel_data(self) -> None: - """ Install the data for slackel repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.slackel_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.slackel_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE REQUIRED:', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_packages) - path_checksums: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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]): - deps: list = [] - required = line.replace(pkg_tag[4], '').strip() - - for req in required.split(','): - dep = req.split('|') - if len(dep) > 1: - deps.append(dep[1]) - else: - deps.extend(dep) - - cache.append(' '.join(deps)) - - if line.startswith(pkg_tag[5]): - package_description = line.replace(pkg_tag[5], '').strip() - cache.append(package_description) - - if len(cache) == 10: - data[cache[0]] = { - 'repo': self.repos.slackel_repo_name, - 'version': cache[1], - 'package': cache[2], - 'mirror': cache[3], - 'checksum': cache[4], - 'location': cache[5], - 'size_comp': cache[6], - 'size_uncomp': cache[7], - 'requires': cache[8].split(), - 'description': cache[9], - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_changelog) - self.write_last_update(path_changelog, self.repos.slackel_repo_name) - - data_file: Path = Path(self.repos.slackel_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_slint_data(self) -> None: - """ Install the data for slint repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.slint_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.slint_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - pkg_tag = [ - 'PACKAGE NAME:', - 'PACKAGE LOCATION:', - 'PACKAGE SIZE (compressed):', - 'PACKAGE SIZE (uncompressed):', - 'PACKAGE REQUIRED:', - 'PACKAGE DESCRIPTION:' - ] - path_packages: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_packages) - path_checksums: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_checksums) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - cache.append(name) # package name - cache.append(version) # package 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]): - deps: list = [] - required = line.replace(pkg_tag[4], '').strip() - - for req in required.split(','): - dep = req.split('|') - if len(dep) > 1: - deps.append(dep[1]) - else: - deps.extend(dep) - - cache.append(' '.join(deps)) - - if line.startswith(pkg_tag[5]): - package_description = line.replace(pkg_tag[5], '').strip() - cache.append(package_description) - - if len(cache) == 10: - data[cache[0]] = { - 'repo': self.repos.slint_repo_name, - 'version': cache[1], - 'package': cache[2], - 'mirror': cache[3], - 'checksum': cache[4], - 'location': cache[5], - 'size_comp': cache[6], - 'size_uncomp': cache[7], - 'requires': cache[8].split(), - 'description': cache[9], - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_changelog) - self.write_last_update(path_changelog, self.repos.slint_repo_name) - - data_file: Path = Path(self.repos.slint_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_pprkut_data(self) -> None: - """ Install the data for pprkut repository. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.pprkut_repo_name}{self.endc}'... ", - end='', flush=True) - - mirror: str = self.repos.pprkut_repo_mirror_packages - - self._import_GPG_KEY(mirror=mirror) - - checksums_dict: dict = {} - data: dict = {} - build: str = '' - arch: str = '' - requires: list = [] - 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) - packages_txt: list = self.utils.read_text_file(path_packages) - checksums_md5: list = self.utils.read_text_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 - - 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'] - build: str = self.utils.split_package(package)['build'] - arch: str = self.utils.split_package(package)['arch'] - 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[cache[0]] = { - 'repo': self.repos.pprkut_repo_name, - '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], - 'requires': requires, - 'build': build, - 'arch': arch, - 'conflicts': '', - 'suggests': '' - } - - cache: list = [] # reset cache - - path_changelog: Path = Path(self.repos.pprkut_repo_path, self.repos.pprkut_repo_changelog) - self.write_last_update(path_changelog, self.repos.pprkut_repo_name) - - data_file: Path = Path(self.repos.pprkut_repo_path, self.repos.data_json) - data_file.write_text(json.dumps(data, indent=4)) - - self.view_done_message() - - def install_data(self, repo: str) -> None: + def install_binary_data(self, repo: str) -> None: """ Install the data for alien repository. """ print(f"\nUpdating the database for '{self.cyan}{repo}{self.endc}'... ", end='', flush=True) diff --git a/slpkg/repositories.py b/slpkg/repositories.py index 6fa32ce7..6ab5a5ba 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -31,12 +31,15 @@ class Repositories: last_update_json: Path = Path(repositories_path, 'last_update.json') default_repository: str = 'sbo' + slackbuilds_txt: str = 'SLACKBUILDS.TXT' + packages_txt: str = 'PACKAGES.TXT' + checksums_md5: str = 'CHECKSUMS.md5' + changelog_txt: str = 'ChangeLog.txt' + sbo_repo: bool = True sbo_repo_name: str = 'sbo' sbo_repo_path: Path = Path(repositories_path, sbo_repo_name) sbo_repo_mirror: str = '' - sbo_repo_slackbuilds: str = 'slackBUILDS.TXT' - sbo_repo_changelog: str = 'ChangeLog.txt' sbo_repo_tag: str = '_SBo' sbo_repo_tar_suffix: str = '.tar.gz' @@ -44,19 +47,13 @@ class Repositories: ponce_repo_name: str = 'ponce' ponce_repo_path: Path = Path(repositories_path, ponce_repo_name) ponce_repo_mirror: str = '' - ponce_repo_slackbuilds: str = 'slackBUILDS.TXT' - ponce_repo_changelog: str = 'ChangeLog.txt' ponce_repo_tag: str = '_SBo' ponce_repo_tar_suffix: str = '.tar.gz' slack_repo: bool = False slack_repo_name: str = 'slack' slack_repo_path: Path = Path(repositories_path, slack_repo_name) - slack_repo_mirror_packages: str = '' - slack_repo_mirror_changelog: str = '' - slack_repo_packages: str = 'PACKAGES.TXT' - slack_repo_checksums: str = 'CHECKSUMS.md5' - slack_repo_changelog: str = 'ChangeLog.txt' + slack_repo_mirror: str = '' slack_repo_tag: str = '' slack_extra_repo: bool = False @@ -64,9 +61,6 @@ class Repositories: slack_extra_repo_path: Path = Path(repositories_path, slack_extra_repo_name) slack_extra_repo_mirror_packages: str = '' slack_extra_repo_mirror_changelog: str = '' - slack_extra_repo_packages: str = 'PACKAGES.TXT' - slack_extra_repo_checksums: str = 'CHECKSUMS.md5' - slack_extra_repo_changelog: str = 'ChangeLog.txt' slack_extra_repo_tag: str = '' slack_patches_repo: bool = False @@ -74,9 +68,6 @@ class Repositories: slack_patches_repo_path: Path = Path(repositories_path, slack_patches_repo_name) slack_patches_repo_mirror_packages: str = '' slack_patches_repo_mirror_changelog: str = '' - slack_patches_repo_packages: str = 'PACKAGES.TXT' - slack_patches_repo_checksums: str = 'CHECKSUMS.md5' - slack_patches_repo_changelog: str = 'ChangeLog.txt' slack_patches_repo_tag: str = '' alien_repo: bool = False @@ -84,9 +75,6 @@ class Repositories: alien_repo_path: Path = Path(repositories_path, alien_repo_name) alien_repo_mirror_packages: str = '' alien_repo_mirror_changelog: str = '' - alien_repo_packages: str = 'PACKAGES.TXT' - alien_repo_checksums: str = 'CHECKSUMS.md5' - alien_repo_changelog: str = 'ChangeLog.txt' alien_repo_tag: str = 'alien' multilib_repo: bool = False @@ -94,9 +82,6 @@ class Repositories: multilib_repo_path: Path = Path(repositories_path, multilib_repo_name) multilib_repo_mirror_packages: str = '' multilib_repo_mirror_changelog: str = '' - multilib_repo_packages: str = 'PACKAGES.TXT' - multilib_repo_checksums: str = 'CHECKSUMS.md5' - multilib_repo_changelog: str = 'ChangeLog.txt' multilib_repo_tag: str = 'alien' restricted_repo: bool = False @@ -104,19 +89,12 @@ class Repositories: restricted_repo_path: Path = Path(repositories_path, restricted_repo_name) restricted_repo_mirror_packages: str = '' restricted_repo_mirror_changelog: str = '' - restricted_repo_packages: str = 'PACKAGES.TXT' - restricted_repo_checksums: str = 'CHECKSUMS.md5' - restricted_repo_changelog: str = 'ChangeLog.txt' restricted_repo_tag: str = 'alien' gnome_repo: bool = False gnome_repo_name: str = 'gnome' gnome_repo_path: Path = Path(repositories_path, gnome_repo_name) - gnome_repo_mirror_packages: str = '' - gnome_repo_mirror_changelog: str = '' - gnome_repo_packages: str = 'PACKAGES.TXT' - gnome_repo_checksums: str = 'CHECKSUMS.md5' - gnome_repo_changelog: str = 'ChangeLog.txt' + gnome_repo_mirror: str = '' gnome_repo_tag: str = 'gfs' msb_repo: bool = False @@ -124,9 +102,6 @@ class Repositories: msb_repo_path: Path = Path(repositories_path, msb_repo_name) msb_repo_mirror_packages: str = '' msb_repo_mirror_changelog: str = '' - msb_repo_packages: str = 'PACKAGES.TXT' - msb_repo_checksums: str = 'CHECKSUMS.md5' - msb_repo_changelog: str = 'ChangeLog.txt' msb_repo_tag: str = 'msb' csb_repo: bool = False @@ -134,89 +109,54 @@ class Repositories: csb_repo_path: Path = Path(repositories_path, csb_repo_name) csb_repo_mirror_packages: str = '' csb_repo_mirror_changelog: str = '' - csb_repo_packages: str = 'PACKAGES.TXT' - csb_repo_checksums: str = 'CHECKSUMS.md5' - csb_repo_changelog: str = 'ChangeLog.txt' csb_repo_tag: str = 'csb' conraid_repo: bool = False conraid_repo_name: str = 'conraid' conraid_repo_path: Path = Path(repositories_path, conraid_repo_name) - conraid_repo_mirror_packages: str = '' - conraid_repo_mirror_changelog: str = '' - conraid_repo_packages: str = 'PACKAGES.TXT' - conraid_repo_checksums: str = 'CHECKSUMS.md5' - conraid_repo_changelog: str = 'ChangeLog.txt' + conraid_repo_mirror: str = '' conraid_repo_tag: str = 'cf' slackdce_repo: bool = False slackdce_repo_name: str = 'slackdce' slackdce_repo_path: Path = Path(repositories_path, slackdce_repo_name) - slackdce_repo_mirror_packages: str = '' - slackdce_repo_mirror_changelog: str = '' - slackdce_repo_packages: str = 'PACKAGES.TXT' - slackdce_repo_checksums: str = 'CHECKSUMS.md5' - slackdce_repo_changelog: str = 'ChangeLog.txt' + slackdce_repo_mirror: str = '' slackdce_repo_tag: str = 'dce' slackonly_repo: bool = False slackonly_repo_name: str = 'slackonly' slackonly_repo_path: Path = Path(repositories_path, slackonly_repo_name) - slackonly_repo_mirror_packages: str = '' - slackonly_repo_mirror_changelog: str = '' - slackonly_repo_packages: str = 'PACKAGES.TXT' - slackonly_repo_checksums: str = 'CHECKSUMS.md5' - slackonly_repo_changelog: str = 'ChangeLog.txt' + slackonly_repo_mirror: str = '' slackonly_repo_tag: str = 'slonly' salix_repo: bool = False salix_repo_name: str = 'salix' salix_repo_path: Path = Path(repositories_path, salix_repo_name) - salix_repo_mirror_packages: str = '' - salix_repo_mirror_changelog: str = '' - salix_repo_packages: str = 'PACKAGES.TXT' - salix_repo_checksums: str = 'CHECKSUMS.md5' - salix_repo_changelog: str = 'ChangeLog.txt' + salix_repo_mirror: str = '' salix_repo_tag: str = '' salix_extra_repo: bool = False salix_extra_repo_name: str = 'salix_extra' salix_extra_repo_path: Path = Path(repositories_path, salix_extra_repo_name) - salix_extra_repo_mirror_packages: str = '' - salix_extra_repo_mirror_changelog: str = '' - salix_extra_repo_packages: str = 'PACKAGES.TXT' - salix_extra_repo_checksums: str = 'CHECKSUMS.md5' - salix_extra_repo_changelog: str = 'ChangeLog.txt' + salix_extra_repo_mirror: str = '' salix_extra_repo_tag: str = '' slackel_repo: bool = False slackel_repo_name: str = 'slackel' slackel_repo_path: Path = Path(repositories_path, slackel_repo_name) - slackel_repo_mirror_packages: str = '' - slackel_repo_mirror_changelog: str = '' - slackel_repo_packages: str = 'PACKAGES.TXT' - slackel_repo_checksums: str = 'CHECKSUMS.md5' - slackel_repo_changelog: str = 'ChangeLog.txt' + slackel_repo_mirror: str = '' slackel_repo_tag: str = 'dj' slint_repo: bool = False slint_repo_name: str = 'slint' slint_repo_path: Path = Path(repositories_path, slint_repo_name) - slint_repo_mirror_packages: str = '' - slint_repo_mirror_changelog: str = '' - slint_repo_packages: str = 'PACKAGES.TXT' - slint_repo_checksums: str = 'CHECKSUMS.md5' - slint_repo_changelog: str = 'ChangeLog.txt' + slint_repo_mirror: str = '' 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_mirror_packages: str = '' - pprkut_repo_mirror_changelog: str = '' - pprkut_repo_packages: str = 'PACKAGES.TXT' - pprkut_repo_checksums: str = 'CHECKSUMS.md5' - pprkut_repo_changelog: str = 'ChangeLog.txt' + pprkut_repo_mirror: str = '' pprkut_repo_tag: str = 'pprkut' try: @@ -229,48 +169,25 @@ class Repositories: default_repository: str = repos_config['default']['repo'].lower() sbo_repo: bool = repos_config['sbo']['enable'] - sbo_repo_url: str = repos_config['sbo']['mirror'] - sbo_repo_version: str = repos_config['sbo']['version'] - sbo_repo_mirror: str = f'{sbo_repo_url}{sbo_repo_version}/' + sbo_repo_mirror: str = repos_config['sbo']['mirror'] ponce_repo: bool = repos_config['ponce']['enable'] ponce_repo_mirror: str = repos_config['ponce']['mirror'] slack_repo: bool = repos_config['slack']['enable'] - slack_repo_url: str = repos_config['slack']['mirror'] - slack_repo_version: str = repos_config['slack']['version'] - slack_repo_arch: str = repos_config['slack']['arch'] - slack_arch: str = '' - if slack_repo_arch == 'x86_64': - slack_arch: str = '64' - slack_repo_mirror_packages: str = f'{slack_repo_url}slackware{slack_arch}-{slack_repo_version}/' - slack_repo_mirror_changelog: str = f'{slack_repo_url}slackware{slack_arch}-{slack_repo_version}/' + slack_repo_mirror: str = repos_config['slack']['mirror'] slack_extra_repo: bool = repos_config['slack_extra']['enable'] slack_extra_repo_url: str = repos_config['slack_extra']['mirror'] - slack_extra_repo_version: str = repos_config['slack_extra']['version'] - slack_extra_repo_arch: str = repos_config['slack_extra']['arch'] - slack_extra_arch: str = '' - if slack_extra_repo_arch == 'x86_64': - slack_extra_arch: str = '64' slack_extra_repo_branch: str = repos_config['slack_extra']['branch'] - slack_extra_repo_mirror_packages: str = (f'{slack_extra_repo_url}slackware{slack_extra_arch}-' - f'{slack_extra_repo_version}/{slack_extra_repo_branch}/') - slack_extra_repo_mirror_changelog: str = (f'{slack_extra_repo_url}slackware{slack_extra_arch}-' - f'{slack_extra_repo_version}/') + slack_extra_repo_mirror_packages: str = f'{slack_extra_repo_url}{slack_extra_repo_branch}/' + slack_extra_repo_mirror_changelog: str = slack_extra_repo_url slack_patches_repo: bool = repos_config['slack_patches']['enable'] slack_patches_repo_url: str = repos_config['slack_patches']['mirror'] - slack_patches_repo_version: str = repos_config['slack_patches']['version'] - slack_patches_repo_arch: str = repos_config['slack_patches']['arch'] - slack_patches_arch: str = '' - if slack_patches_repo_arch == 'x86_64': - slack_patches_arch: str = '64' slack_patches_repo_branch: str = repos_config['slack_patches']['branch'] - slack_patches_repo_mirror_packages: str = (f'{slack_patches_repo_url}slackware{slack_patches_arch}-' - f'{slack_patches_repo_version}/{slack_patches_repo_branch}/') - slack_patches_repo_mirror_changelog: str = (f'{slack_patches_repo_url}slackware{slack_patches_arch}-' - f'{slack_patches_repo_version}/') + slack_patches_repo_mirror_packages: str = f'{slack_patches_repo_url}{slack_patches_repo_branch}/' + slack_patches_repo_mirror_changelog: str = slack_patches_repo_url alien_repo: bool = repos_config['alien']['enable'] alien_repo_url: str = repos_config['alien']['mirror'] @@ -294,11 +211,7 @@ class Repositories: restricted_repo_mirror_changelog: str = restricted_repo_url gnome_repo: bool = repos_config['gnome']['enable'] - gnome_repo_url: str = repos_config['gnome']['mirror'] - gnome_repo_version: str = repos_config['gnome']['version'] - gnome_repo_arch: str = repos_config['gnome']['arch'] - gnome_repo_mirror_packages: str = f'{gnome_repo_url}{gnome_repo_version}/{gnome_repo_arch}/' - gnome_repo_mirror_changelog: str = f'{gnome_repo_url}{gnome_repo_version}/{gnome_repo_arch}/' + gnome_repo_mirror: str = repos_config['gnome']['mirror'] msb_repo: bool = repos_config['msb']['enable'] msb_repo_url: str = repos_config['msb']['mirror'] @@ -316,67 +229,28 @@ class Repositories: csb_repo_mirror_changelog: str = csb_repo_url conraid_repo: bool = repos_config['conraid']['enable'] - conraid_repo_url: str = repos_config['conraid']['mirror'] - conraid_repo_arch: str = repos_config['conraid']['arch'] - conraid_repo_version: str = repos_config['conraid']['version'] - conraid_arch: str = '' - if conraid_repo_arch == 'x86_64': - conraid_arch: str = '64' - conraid_repo_mirror_packages: str = f'{conraid_repo_url}slackware{conraid_arch}-{conraid_repo_version}/' - conraid_repo_mirror_changelog: str = f'{conraid_repo_url}slackware{conraid_arch}-{conraid_repo_version}/' + conraid_repo_mirror: str = repos_config['conraid']['mirror'] slackdce_repo: bool = repos_config['slackdce']['enable'] - slackdce_repo_url: str = repos_config['slackdce']['mirror'] - slackdce_repo_version: str = repos_config['slackdce']['version'] - slackdce_repo_arch: str = repos_config['slackdce']['arch'] - slackdce_repo_mirror_packages: str = f'{slackdce_repo_url}{slackdce_repo_version}/{slackdce_repo_arch}/' - slackdce_repo_mirror_changelog: str = f'{slackdce_repo_url}{slackdce_repo_version}/{slackdce_repo_arch}/' + slackdce_repo_mirror: str = repos_config['slackdce']['mirror'] slackonly_repo: bool = repos_config['slackonly']['enable'] - slackonly_repo_url: str = repos_config['slackonly']['mirror'] - slackonly_repo_version: str = repos_config['slackonly']['version'] - slackonly_repo_arch: str = repos_config['slackonly']['arch'] - slackonly_repo_mirror_packages: str = f'{slackonly_repo_url}{slackonly_repo_version}-{slackonly_repo_arch}/' - slackonly_repo_mirror_changelog: str = (f'{slackonly_repo_url}{slackonly_repo_version}-' - f'{slackonly_repo_arch}/') + slackonly_repo_mirror: str = repos_config['slackonly']['mirror'] salix_repo: bool = repos_config['salix']['enable'] - salix_repo_url: str = repos_config['salix']['mirror'] - salix_repo_arch: str = repos_config['salix']['arch'] - salix_repo_version: str = repos_config['salix']['version'] - salix_repo_mirror_packages: str = f'{salix_repo_url}{salix_repo_arch}/{salix_repo_version}/' - salix_repo_mirror_changelog: str = f'{salix_repo_url}{salix_repo_arch}/{salix_repo_version}/' + salix_repo_mirror: str = repos_config['salix']['mirror'] salix_extra_repo: bool = repos_config['salix_extra']['enable'] - salix_extra_repo_url: str = repos_config['salix_extra']['mirror'] - salix_extra_repo_arch: str = repos_config['salix_extra']['arch'] - salix_extra_repo_branch: str = repos_config['salix_extra']['branch'] - salix_extra_repo_version: str = repos_config['salix_extra']['version'] - salix_extra_repo_mirror_packages: str = (f'{salix_extra_repo_url}{salix_extra_repo_arch}/' - f'{salix_extra_repo_branch}-{salix_extra_repo_version}/') - salix_extra_repo_mirror_changelog: str = (f'{salix_extra_repo_url}{salix_extra_repo_arch}/' - f'{salix_extra_repo_branch}-{salix_extra_repo_version}/') + salix_extra_repo_mirror: str = repos_config['salix_extra']['mirror'] slackel_repo: bool = repos_config['slackel']['enable'] - slackel_repo_url: str = repos_config['slackel']['mirror'] - slackel_repo_arch: str = repos_config['slackel']['arch'] - slackel_repo_version: str = repos_config['slackel']['version'] - slackel_repo_mirror_packages: str = f'{slackel_repo_url}{slackel_repo_arch}/{slackel_repo_version}/' - slackel_repo_mirror_changelog: str = f'{slackel_repo_url}{slackel_repo_arch}/{slackel_repo_version}/' + slackel_repo_mirror: str = repos_config['slackel']['mirror'] slint_repo: bool = repos_config['slint']['enable'] - slint_repo_url: str = repos_config['slint']['mirror'] - slint_repo_arch: str = repos_config['slint']['arch'] - slint_repo_version: str = repos_config['slint']['version'] - slint_repo_mirror_packages: str = f'{slint_repo_url}{slint_repo_arch}/slint-{slint_repo_version}/' - slint_repo_mirror_changelog: str = f'{slint_repo_url}{slint_repo_arch}/slint-{slint_repo_version}/' + slint_repo_mirror: str = repos_config['slint']['mirror'] pprkut_repo: bool = repos_config['pprkut']['enable'] - pprkut_repo_url: str = repos_config['pprkut']['mirror'] - pprkut_repo_version: str = repos_config['pprkut']['version'] - pprkut_repo_arch: str = repos_config['pprkut']['arch'] - pprkut_repo_mirror_packages: str = f'{pprkut_repo_url}{pprkut_repo_version}/{pprkut_repo_arch}/' - pprkut_repo_mirror_changelog: str = f'{pprkut_repo_url}{pprkut_repo_version}/{pprkut_repo_arch}/' + pprkut_repo_mirror: str = repos_config['pprkut']['mirror'] except (tomli.TOMLDecodeError, KeyError) as error: toml_errors.raise_toml_error_message(error, repositories_toml_file) @@ -387,8 +261,8 @@ class Repositories: 'path': sbo_repo_path, 'mirror_packages': sbo_repo_mirror, 'mirror_changelog': sbo_repo_mirror, - 'slackbuilds_txt': sbo_repo_slackbuilds, - 'changelog_txt': sbo_repo_changelog, + 'slackbuilds_txt': slackbuilds_txt, + 'changelog_txt': changelog_txt, 'repo_tag': sbo_repo_tag, 'tar_suffix': sbo_repo_tar_suffix}, @@ -397,19 +271,19 @@ class Repositories: 'path': ponce_repo_path, 'mirror_packages': ponce_repo_mirror, 'mirror_changelog': ponce_repo_mirror, - 'slackbuilds_txt': ponce_repo_slackbuilds, - 'changelog_txt': ponce_repo_changelog, + 'slackbuilds_txt': slackbuilds_txt, + 'changelog_txt': changelog_txt, 'repo_tag': ponce_repo_tag, 'tar_suffix': ponce_repo_tar_suffix}, slack_repo_name: { 'enable': slack_repo, 'path': slack_repo_path, - 'mirror_packages': slack_repo_mirror_packages, - 'mirror_changelog': slack_repo_mirror_changelog, - 'packages_txt': slack_repo_packages, - 'checksums_md5': slack_repo_checksums, - 'changelog_txt': slack_repo_changelog, + 'mirror_packages': slack_repo_mirror, + 'mirror_changelog': slack_repo_mirror, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': slack_repo_tag}, slack_extra_repo_name: { @@ -417,9 +291,9 @@ class Repositories: 'path': slack_extra_repo_path, 'mirror_packages': slack_extra_repo_mirror_packages, 'mirror_changelog': slack_extra_repo_mirror_changelog, - 'packages_txt': slack_extra_repo_packages, - 'checksums_md5': slack_extra_repo_checksums, - 'changelog_txt': slack_extra_repo_changelog, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': slack_extra_repo_tag}, slack_patches_repo_name: { @@ -427,9 +301,9 @@ class Repositories: 'path': slack_patches_repo_path, 'mirror_packages': slack_patches_repo_mirror_packages, 'mirror_changelog': slack_patches_repo_mirror_changelog, - 'packages_txt': slack_patches_repo_packages, - 'checksums_md5': slack_patches_repo_checksums, - 'changelog_txt': slack_patches_repo_changelog, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': slack_patches_repo_tag}, alien_repo_name: { @@ -437,9 +311,9 @@ class Repositories: 'path': alien_repo_path, 'mirror_packages': alien_repo_mirror_packages, 'mirror_changelog': alien_repo_mirror_changelog, - 'packages_txt': alien_repo_packages, - 'checksums_md5': alien_repo_checksums, - 'changelog_txt': alien_repo_changelog, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': alien_repo_tag}, multilib_repo_name: { @@ -447,9 +321,9 @@ class Repositories: 'path': multilib_repo_path, 'mirror_packages': multilib_repo_mirror_packages, 'mirror_changelog': multilib_repo_mirror_changelog, - 'packages_txt': multilib_repo_packages, - 'checksums_md5': multilib_repo_checksums, - 'changelog_txt': multilib_repo_changelog, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': multilib_repo_tag}, restricted_repo_name: { @@ -457,19 +331,19 @@ class Repositories: 'path': restricted_repo_path, 'mirror_packages': restricted_repo_mirror_packages, 'mirror_changelog': restricted_repo_mirror_changelog, - 'packages_txt': restricted_repo_packages, - 'checksums_md5': restricted_repo_checksums, - 'changelog_txt': restricted_repo_changelog, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': restricted_repo_tag}, gnome_repo_name: { 'enable': gnome_repo, 'path': gnome_repo_path, - 'mirror_packages': gnome_repo_mirror_packages, - 'mirror_changelog': gnome_repo_mirror_changelog, - 'packages_txt': gnome_repo_packages, - 'checksums_md5': gnome_repo_checksums, - 'changelog_txt': gnome_repo_changelog, + 'mirror_packages': gnome_repo_mirror, + 'mirror_changelog': gnome_repo_mirror, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': gnome_repo_tag}, msb_repo_name: { @@ -477,9 +351,9 @@ class Repositories: 'path': msb_repo_path, 'mirror_packages': msb_repo_mirror_packages, 'mirror_changelog': msb_repo_mirror_changelog, - 'packages_txt': msb_repo_packages, - 'checksums_md5': msb_repo_checksums, - 'changelog_txt': msb_repo_changelog, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': msb_repo_tag}, csb_repo_name: { @@ -487,89 +361,89 @@ class Repositories: 'path': csb_repo_path, 'mirror_packages': csb_repo_mirror_packages, 'mirror_changelog': csb_repo_mirror_changelog, - 'packages_txt': csb_repo_packages, - 'checksums_md5': csb_repo_checksums, - 'changelog_txt': csb_repo_changelog, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': csb_repo_tag}, conraid_repo_name: { 'enable': conraid_repo, 'path': conraid_repo_path, - 'mirror_packages': conraid_repo_mirror_packages, - 'mirror_changelog': conraid_repo_mirror_changelog, - 'packages_txt': conraid_repo_packages, - 'checksums_md5': conraid_repo_checksums, - 'changelog_txt': conraid_repo_changelog, + 'mirror_packages': conraid_repo_mirror, + 'mirror_changelog': conraid_repo_mirror, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': conraid_repo_tag}, slackdce_repo_name: { 'enable': slackdce_repo, 'path': slackdce_repo_path, - 'mirror_packages': slackdce_repo_mirror_packages, - 'mirror_changelog': slackdce_repo_mirror_changelog, - 'packages_txt': slackdce_repo_packages, - 'checksums_md5': slackdce_repo_checksums, - 'changelog_txt': slackdce_repo_changelog, + 'mirror_packages': slackdce_repo_mirror, + 'mirror_changelog': slackdce_repo_mirror, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': slackdce_repo_tag}, slackonly_repo_name: { 'enable': slackonly_repo, 'path': slackonly_repo_path, - 'mirror_packages': slackonly_repo_mirror_packages, - 'mirror_changelog': slackonly_repo_mirror_changelog, - 'packages_txt': slackonly_repo_packages, - 'checksums_md5': slackonly_repo_checksums, - 'changelog_txt': slackonly_repo_changelog, + 'mirror_packages': slackonly_repo_mirror, + 'mirror_changelog': slackonly_repo_mirror, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': slackonly_repo_tag}, salix_repo_name: { 'enable': salix_repo, 'path': salix_repo_path, - 'mirror_packages': salix_repo_mirror_packages, - 'mirror_changelog': salix_repo_mirror_changelog, - 'packages_txt': salix_repo_packages, - 'checksums_md5': salix_repo_checksums, - 'changelog_txt': salix_repo_changelog, + 'mirror_packages': salix_repo_mirror, + 'mirror_changelog': salix_repo_mirror, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': salix_repo_tag}, salix_extra_repo_name: { 'enable': salix_extra_repo, 'path': salix_extra_repo_path, - 'mirror_packages': salix_extra_repo_mirror_packages, - 'mirror_changelog': salix_extra_repo_mirror_changelog, - 'packages_txt': salix_extra_repo_packages, - 'checksums_md5': salix_extra_repo_checksums, - 'changelog_txt': salix_extra_repo_changelog, + 'mirror_packages': salix_extra_repo_mirror, + 'mirror_changelog': salix_extra_repo_mirror, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': salix_extra_repo_tag}, slackel_repo_name: { 'enable': slackel_repo, 'path': slackel_repo_path, - 'mirror_packages': slackel_repo_mirror_packages, - 'mirror_changelog': slackel_repo_mirror_changelog, - 'packages_txt': slackel_repo_packages, - 'checksums_md5': slackel_repo_checksums, - 'changelog_txt': slackel_repo_changelog, + 'mirror_packages': slackel_repo_mirror, + 'mirror_changelog': slackel_repo_mirror, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': slackel_repo_tag}, slint_repo_name: { 'enable': slint_repo, 'path': slint_repo_path, - 'mirror_packages': slint_repo_mirror_packages, - 'mirror_changelog': slint_repo_mirror_changelog, - 'packages_txt': slint_repo_packages, - 'checksums_md5': slint_repo_checksums, - 'changelog_txt': slint_repo_changelog, + 'mirror_packages': slint_repo_mirror, + 'mirror_changelog': slint_repo_mirror, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': slint_repo_tag}, pprkut_repo_name: { 'enable': pprkut_repo, 'path': pprkut_repo_path, - 'mirror_packages': pprkut_repo_mirror_packages, - 'mirror_changelog': pprkut_repo_mirror_changelog, - 'packages_txt': pprkut_repo_packages, - 'checksums_md5': pprkut_repo_checksums, - 'changelog_txt': pprkut_repo_changelog, + 'mirror_packages': pprkut_repo_mirror, + 'mirror_changelog': pprkut_repo_mirror, + 'packages_txt': packages_txt, + 'checksums_md5': checksums_md5, + 'changelog_txt': changelog_txt, 'repo_tag': pprkut_repo_tag} } @@ -581,10 +455,13 @@ class Repositories: if diff_repos: for repo, config in repos_config.items(): + if repo in diff_repos: changelog_mirror: str = config['mirror'] - if config['changelog']: - changelog_mirror: str = config['changelog'] + + if config['branch']: + changelog_mirror: str = config['branch'] + values = { 'enable': config['enable'], 'path': Path(repositories_path, repo), diff --git a/slpkg/update_repositories.py b/slpkg/update_repositories.py index c2de8db6..5bdd1684 100644 --- a/slpkg/update_repositories.py +++ b/slpkg/update_repositories.py @@ -79,7 +79,7 @@ class UpdateRepositories(Configs): self.download.download(urls) - self.data.install_data(repo) + self.data.install_binary_data(repo) def update_slackbuild_repos(self, repo: str) -> None: """ Updates the slackbuild repositories. """ @@ -100,9 +100,4 @@ class UpdateRepositories(Configs): self.generate.slackbuild_file(self.repos.repositories[repo]['path'], self.repos.repositories[repo]['slackbuilds_txt']) - install: dict = { - self.repos.sbo_repo_name: self.data.install_sbo_data, - self.repos.ponce_repo_name: self.data.install_ponce_data - } - - install[repo]() + self.data.install_sbo_data(repo)