diff --git a/configs/repositories.toml b/configs/repositories.toml index 0879fcff..c5fd5988 100644 --- a/configs/repositories.toml +++ b/configs/repositories.toml @@ -2,27 +2,29 @@ [REPOSITORIES] SBO_REPO_NAME = "sbo" - SBO_REPO_URL = "https://slackbuilds.org/slackbuilds/15.0/" - SBO_REPO_TXT = "SLACKBUILDS.TXT" - SBO_REPO_CHGLOG_TXT = "ChangeLog.txt" + SBO_REPO_MIRROR = "https://slackbuilds.org/slackbuilds/15.0/" + SBO_REPO_SLACKBUILDS = "SLACKBUILDS.TXT" + SBO_REPO_CHANGELOG = "ChangeLog.txt" SBO_REPO_TAR_SUFFIX = ".tar.gz" SBO_REPO_TAG = "_SBo" PONCE_REPO_NAME = "ponce" PONCE_REPO = false - PONCE_REPO_URL = "https://cgit.ponce.cc/slackbuilds/plain/" - PONCE_REPO_TXT = "SLACKBUILDS.TXT" - PONCE_REPO_CHGLOG_TXT = "ChangeLog.txt" + PONCE_REPO_MIRROR = "https://cgit.ponce.cc/slackbuilds/plain/" + PONCE_REPO_SLACKBUILDS = "SLACKBUILDS.TXT" + PONCE_REPO_CHANGELOG = "ChangeLog.txt" PONCE_REPO_TAG = "_SBo" GNOME_REPO_NAME = "gnome" GNOME_REPO = true - GNOME_REPO_URL = "https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/" - GNOME_REPO_PKG_TXT = "PACKAGES.TXT" - GNOME_REPO_CHGLOG_TXT = "ChangeLog.txt" + GNOME_REPO_MIRROR = "https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/" + GNOME_REPO_PACKAGES = "PACKAGES.TXT" + GNOME_REPO_CHECKSUMS = "CHECKSUMS.md5" + GNOME_REPO_CHANGELOG = "ChangeLog.txt" CONRAID_REPO_NAME = "conraid" CONRAID_REPO = true - CONRAID_REPO_URL = "https://slack.conraid.net/repository/slackware64-current/" - CONRAID_REPO_PKG_TXT = "PACKAGES.TXT" - CONRAID_REPO_CHGLOG_TXT = "ChangeLog.txt" + CONRAID_REPO_MIRROR = "https://slack.conraid.net/repository/slackware64-current/" + CONRAID_REPO_PACKAGES = "PACKAGES.TXT" + CONRAID_REPO_CHECKSUMS = "CHECKSUMS.md5" + CONRAID_REPO_CHANGELOG = "ChangeLog.txt" diff --git a/slpkg/check_updates.py b/slpkg/check_updates.py index 8b4755d0..4dfcdff0 100644 --- a/slpkg/check_updates.py +++ b/slpkg/check_updates.py @@ -40,24 +40,24 @@ class CheckUpdates(Configs): if self.utils.is_option(self.flag_binary, self.flags): if self.repos.gnome_repo: - self.local_chg_txt: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_chglog_pkg_txt) - self.repo_chg_txt: str = f'{self.repos.gnome_repo_url}{self.repos.gnome_repo_chglog_pkg_txt}' + self.local_chg_txt: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog) + self.repo_chg_txt: str = f'{self.repos.gnome_repo_mirror}{self.repos.gnome_repo_changelog}' compare[self.repos.gnome_repo_name] = self.compare_dates() if self.repos.conraid_repo: - self.local_chg_txt: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_chglog_pkg_txt) - self.repo_chg_txt: str = f'{self.repos.conraid_repo_url}{self.repos.conraid_repo_chglog_pkg_txt}' + self.local_chg_txt: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog) + self.repo_chg_txt: str = f'{self.repos.conraid_repo_mirror}{self.repos.conraid_repo_changelog}' compare[self.repos.conraid_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_chglog_txt) - self.repo_chg_txt: str = f'{self.repos.ponce_repo_url}{self.repos.ponce_repo_chglog_txt}' + self.local_chg_txt: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog) + self.repo_chg_txt: str = f'{self.repos.ponce_repo_mirror}{self.repos.ponce_repo_changelog}' compare[self.repos.ponce_repo_name] = self.compare_dates() else: - self.local_chg_txt: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_chglog_txt) - self.repo_chg_txt: str = f'{self.repos.sbo_repo_url}{self.repos.sbo_repo_chglog_txt}' + self.local_chg_txt: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog) + self.repo_chg_txt: str = f'{self.repos.sbo_repo_mirror}{self.repos.sbo_repo_changelog}' compare[self.repos.sbo_repo_name] = self.compare_dates() return compare diff --git a/slpkg/download_only.py b/slpkg/download_only.py index 445c8e88..e45f89ae 100644 --- a/slpkg/download_only.py +++ b/slpkg/download_only.py @@ -47,7 +47,7 @@ class Download(Configs, Utilities): shutil.copytree(ponce_repo_path_package, Path(download_path, sbo)) else: file: str = f'{sbo}{self.repos.sbo_repo_tar_suffix}' - url: list = [f'{self.repos.sbo_repo_url}{location}/{file}'] + url: list = [f'{self.repos.sbo_repo_mirror}{location}/{file}'] down_sbo = Downloader(download_path, url, self.flags) down_sbo.download() diff --git a/slpkg/install_data.py b/slpkg/install_data.py index d0aa4e0e..7bb81960 100644 --- a/slpkg/install_data.py +++ b/slpkg/install_data.py @@ -34,11 +34,11 @@ class CreateData(Configs): 'SLACKBUILD SHORT DESCRIPTION:' ] sbo_table = SBoTable - path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_txt) + path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds) if self.repos.ponce_repo: sbo_table = PonceTable - path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_txt) + path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds) slackbuilds_txt: list = self.utils.read_file(path) @@ -77,7 +77,7 @@ class CreateData(Configs): 'PACKAGE SIZE (uncompressed):', 'PACKAGE DESCRIPTION:' ] - path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_pkg_txt) + path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_packages) packages_txt: list = self.utils.read_file(path) @@ -148,7 +148,7 @@ class CreateData(Configs): 'PACKAGE SIZE (uncompressed):', 'PACKAGE DESCRIPTION:' ] - path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_pkg_txt) + path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_packages) packages_txt: list = self.utils.read_file(path) diff --git a/slpkg/repositories.py b/slpkg/repositories.py index d506e159..d53117a8 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -26,33 +26,35 @@ class Repositories: sbo_repo_name: str = 'sbo' sbo_repo_path: Path = Path(config.lib_path, 'repositories', sbo_repo_name) - sbo_repo_url: str = "https://slackbuilds.org/slackbuilds/15.0/" - sbo_repo_txt: str = "SLACKBUILDS.TXT" - sbo_repo_chglog_txt: str = "ChangeLog.txt" + sbo_repo_mirror: str = "https://slackbuilds.org/slackbuilds/15.0/" + sbo_repo_slackbuilds: str = "SLACKBUILDS.TXT" + sbo_repo_changelog: str = "ChangeLog.txt" sbo_repo_tar_suffix: str = ".tar.gz" sbo_repo_tag: str = "_SBo" ponce_repo_name: str = 'ponce' ponce_repo: bool = False ponce_repo_path: Path = Path(config.lib_path, 'repositories', ponce_repo_name) - ponce_repo_url: str = "https://cgit.ponce.cc/slackbuilds/plain/" - ponce_repo_txt: str = "SLACKBUILDS.TXT" - ponce_repo_chglog_txt: str = "ChangeLog.txt" + ponce_repo_mirror: str = "https://cgit.ponce.cc/slackbuilds/plain/" + ponce_repo_slackbuilds: str = "SLACKBUILDS.TXT" + ponce_repo_changelog: str = "ChangeLog.txt" ponce_repo_tag: str = "_SBo" gnome_repo_name: str = 'gnome' gnome_repo: bool = True gnome_repo_path: Path = Path(config.lib_path, 'repositories', gnome_repo_name) - gnome_repo_url: str = "https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/" - gnome_repo_pkg_txt: str = "PACKAGES.TXT" - gnome_repo_chglog_pkg_txt: str = "ChangeLog.txt" + gnome_repo_mirror: str = "https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/" + gnome_repo_packages: str = "PACKAGES.TXT" + gnome_repo_checksums: str = "CHECKSUMS.md5" + gnome_repo_changelog: str = "ChangeLog.txt" conraid_repo_name: str = 'conraid' conraid_repo: bool = True conraid_repo_path: Path = Path(config.lib_path, 'repositories', conraid_repo_name) - conraid_repo_url: str = "https://reddoglinux.ddns.net/linux/conraid_43.x/x86_64/" - conraid_repo_pkg_txt: str = "PACKAGES.TXT" - conraid_repo_chglog_pkg_txt: str = "ChangeLog.txt" + conraid_repo_mirror: str = "https://reddoglinux.ddns.net/linux/conraid_43.x/x86_64/" + conraid_repo_packages: str = "PACKAGES.TXT" + conraid_repo_checksums: str = "CHECKSUMS.md5" + conraid_repo_changelog: str = "ChangeLog.txt" repo_tag: str = sbo_repo_tag @@ -62,30 +64,32 @@ class Repositories: repos = tomli.load(repo)['REPOSITORIES'] sbo_repo_name: str = repos['SBO_REPO_NAME'] - sbo_repo_url: str = repos['SBO_REPO_URL'] - sbo_repo_txt: str = repos['SBO_REPO_TXT'] - sbo_repo_chglog_txt: str = repos['SBO_REPO_CHGLOG_TXT'] + sbo_repo_mirror: str = repos['SBO_REPO_MIRROR'] + sbo_repo_slackbuilds: str = repos['SBO_REPO_SLACKBUILDS'] + sbo_repo_changelog: str = repos['SBO_REPO_CHANGELOG'] sbo_repo_tar_suffix: str = repos['SBO_REPO_TAR_SUFFIX'] sbo_repo_tag: str = repos['SBO_REPO_TAG'] ponce_repo_name: str = repos['PONCE_REPO_NAME'] ponce_repo: bool = repos['PONCE_REPO'] - ponce_repo_url: str = repos['PONCE_REPO_URL'] - ponce_repo_txt: str = repos['PONCE_REPO_TXT'] - ponce_repo_chglog_txt: str = repos['PONCE_REPO_CHGLOG_TXT'] + ponce_repo_mirror: str = repos['PONCE_REPO_MIRROR'] + ponce_repo_slackbuilds: str = repos['PONCE_REPO_SLACKBUILDS'] + ponce_repo_changelog: str = repos['PONCE_REPO_CHANGELOG'] ponce_repo_tag: str = repos['PONCE_REPO_TAG'] gnome_repo_name: str = repos['GNOME_REPO_NAME'] gnome_repo: bool = repos['GNOME_REPO'] - gnome_repo_url: str = repos['GNOME_REPO_URL'] - gnome_repo_pkg_txt: str = repos['GNOME_REPO_PKG_TXT'] - gnome_repo_chglog_pkg_txt: str = repos['GNOME_REPO_CHGLOG_TXT'] + gnome_repo_mirror: str = repos['GNOME_REPO_MIRROR'] + gnome_repo_packages: str = repos['GNOME_REPO_PACKAGES'] + gnome_repo_checksums: str = repos['GNOME_REPO_CHECKSUMS'] + gnome_repo_changelog: str = repos['GNOME_REPO_CHANGELOG'] conraid_repo_name: str = repos['CONRAID_REPO_NAME'] conraid_repo: bool = repos['CONRAID_REPO'] - conraid_repo_url: str = repos['CONRAID_REPO_URL'] - conraid_repo_pkg_txt: str = repos['CONRAID_REPO_PKG_TXT'] - conraid_repo_chglog_pkg_txt: str = repos['CONRAID_REPO_CHGLOG_TXT'] + conraid_repo_mirror: str = repos['CONRAID_REPO_MIRROR'] + conraid_repo_packages: str = repos['CONRAID_REPO_PACKAGES'] + conraid_repo_checksums: str = repos['CONRAID_REPO_CHECKSUMS'] + conraid_repo_changelog: str = repos['CONRAID_REPO_CHANGELOG'] except (tomli.TOMLDecodeError, KeyError) as error: raise SystemExit(f"\n{config.prog_name} {bred}Error{endc}: {error}: in the configuration file " diff --git a/slpkg/update_repository.py b/slpkg/update_repository.py index 356d73e5..3772dd99 100644 --- a/slpkg/update_repository.py +++ b/slpkg/update_repository.py @@ -66,11 +66,12 @@ class UpdateRepository(Configs): print(f"Downloading the '{self.green}{self.repos.gnome_repo_name}{self.endc}' repository, please wait...\n") self.make_dirs(self.repos.gnome_repo_name) - urls.append(f'{self.repos.gnome_repo_url}{self.repos.gnome_repo_pkg_txt}') - urls.append(f'{self.repos.gnome_repo_url}{self.repos.gnome_repo_chglog_pkg_txt}') + urls.append(f'{self.repos.gnome_repo_mirror}{self.repos.gnome_repo_packages}') + urls.append(f'{self.repos.gnome_repo_mirror}{self.repos.gnome_repo_changelog}') + urls.append(f'{self.repos.gnome_repo_mirror}{self.repos.gnome_repo_checksums}') - self.delete_file(self.repos.gnome_repo_path, self.repos.gnome_repo_pkg_txt) - self.delete_file(self.repos.gnome_repo_path, self.repos.gnome_repo_chglog_pkg_txt) + self.delete_file(self.repos.gnome_repo_path, self.repos.gnome_repo_packages) + self.delete_file(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog) down = Downloader(self.repos.gnome_repo_path, urls, self.flags) down.download() @@ -88,11 +89,11 @@ class UpdateRepository(Configs): f"repository, please wait...\n") self.make_dirs(self.repos.conraid_repo_name) - urls.append(f'{self.repos.conraid_repo_url}{self.repos.conraid_repo_pkg_txt}') - urls.append(f'{self.repos.conraid_repo_url}{self.repos.conraid_repo_chglog_pkg_txt}') + urls.append(f'{self.repos.conraid_repo_mirror}{self.repos.conraid_repo_packages}') + urls.append(f'{self.repos.conraid_repo_mirror}{self.repos.conraid_repo_changelog}') - self.delete_file(self.repos.conraid_repo_path, self.repos.conraid_repo_pkg_txt) - self.delete_file(self.repos.conraid_repo_path, self.repos.conraid_repo_chglog_pkg_txt) + self.delete_file(self.repos.conraid_repo_path, self.repos.conraid_repo_packages) + self.delete_file(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog) down = Downloader(self.repos.conraid_repo_path, urls, self.flags) down.download() @@ -110,20 +111,20 @@ class UpdateRepository(Configs): print('Updating the packages list...\n') print(f"Downloading the '{self.green}{self.repos.ponce_repo_name}" f"{self.endc}' repository, please wait...\n") - self.delete_file(self.repos.ponce_repo_path, self.repos .ponce_repo_txt) - lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.ponce_repo_url} ' + self.delete_file(self.repos.ponce_repo_path, self.repos .ponce_repo_slackbuilds) + lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.ponce_repo_mirror} ' f'{self.repos.ponce_repo_path}') self.utils.process(lftp_command) # Remove the SLACKBUILDS.TXT file before generating the new one. - sbo_file_txt = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_txt) + sbo_file_txt = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds) if sbo_file_txt.is_file(): sbo_file_txt.unlink() # Generating the ponce SLACKBUILDS.TXT file. - print(f'Generating the {self.repos.ponce_repo_txt} file... ', end='', flush=True) + print(f'Generating the {self.repos.ponce_repo_slackbuilds} file... ', end='', flush=True) os.chdir(self.repos.ponce_repo_path) - gen_command: str = f'./gen_sbo_txt.sh > {self.repos.ponce_repo_txt}' + gen_command: str = f'./gen_sbo_txt.sh > {self.repos.ponce_repo_slackbuilds}' self.utils.process(gen_command) print('\n') @@ -131,11 +132,11 @@ class UpdateRepository(Configs): self.make_dirs(self.repos.sbo_repo_name) print('Updating the packages list...\n') - self.delete_file(self.repos.sbo_repo_path, self.repos.sbo_repo_txt) - self.delete_file(self.repos.sbo_repo_path, self.repos.sbo_repo_chglog_txt) + self.delete_file(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds) + self.delete_file(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog) print(f"Downloading the '{self.green}{self.repos.sbo_repo_name}{self.endc}' repository, please wait...\n") - lftp_command: str = f'lftp {self.lftp_mirror_options} {self.repos.sbo_repo_url} {self.repos.sbo_repo_path}' + lftp_command: str = f'lftp {self.lftp_mirror_options} {self.repos.sbo_repo_mirror} {self.repos.sbo_repo_path}' self.utils.process(lftp_command) self.delete_sbo_data() diff --git a/slpkg/views/view_package.py b/slpkg/views/view_package.py index 1085bc15..469cfb6b 100644 --- a/slpkg/views/view_package.py +++ b/slpkg/views/view_package.py @@ -25,12 +25,12 @@ class ViewPackage(Configs): # Switch between sbo and ponce repository. self.sbo_table = SBoTable - self.repo_url: str = self.repos.sbo_repo_url + self.repo_url: str = self.repos.sbo_repo_mirror self.repo_path: Path = self.repos.sbo_repo_path self.repo_tar_suffix: str = self.repos.sbo_repo_tar_suffix if self.repos.ponce_repo: self.sbo_table = PonceTable - self.repo_url: str = self.repos.ponce_repo_url + self.repo_url: str = self.repos.ponce_repo_mirror self.repo_path: Path = self.repos.ponce_repo_path self.repo_tar_suffix: str = '' diff --git a/tests/test_configs.py b/tests/test_configs.py index f3d2475f..2e622147 100644 --- a/tests/test_configs.py +++ b/tests/test_configs.py @@ -7,7 +7,7 @@ class TestConfigs(unittest.TestCase): def setUp(self): self.repos = Repositories() - self.sbo_txt = self.repos.sbo_repo_txt + self.sbo_txt = self.repos.sbo_repo_slackbuilds self.sbo_tar_suffix = self.repos.sbo_repo_tar_suffix self.sbo_repo_tag = self.repos.sbo_repo_tag self.os_arch = Configs.os_arch