From 616ae3d973c5420f676479c0cfed61ec79f3fa98 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 30 Apr 2023 18:04:01 +0300 Subject: [PATCH] Updated for locals --- slpkg/install_data.py | 49 ++++-- slpkg/update_repository.py | 297 +++++++++++++++++++++++-------------- 2 files changed, 225 insertions(+), 121 deletions(-) diff --git a/slpkg/install_data.py b/slpkg/install_data.py index 716abcd0..6e4bc253 100644 --- a/slpkg/install_data.py +++ b/slpkg/install_data.py @@ -845,6 +845,10 @@ class InstallData(Configs): packages_txt: list = self.utils.read_file(path_packages) checksums_md5: list = self.utils.read_file(path_checksums) + mirror: str = ''.join(self.repos.csb_repo_mirror) + if self.repos.csb_repo_local[0].startswith('file'): + mirror: str = ''.join(self.repos.csb_repo_local) + for line in checksums_md5: line = line.strip() @@ -863,7 +867,7 @@ class InstallData(Configs): cache.append(split_package[0]) # package name cache.append(split_package[1]) # package version cache.append(package_name) - cache.append("".join(self.repos.csb_repo_mirror)) + cache.append(mirror) try: cache.append(checksums_dict[package_name]) except KeyError: @@ -931,9 +935,12 @@ class InstallData(Configs): 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) path_changelog: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog) + packages_txt: list = self.utils.read_file(path_packages) checksums_md5: list = self.utils.read_file(path_checksums) - packages_txt: list = self.utils.read_file(path_packages) + mirror: str = self.repos.conraid_repo_mirror[0] + if self.repos.conraid_repo_local[0].startswith('file'): + mirror: str = self.repos.conraid_repo_local[0] for line in checksums_md5: line = line.strip() @@ -953,7 +960,7 @@ class InstallData(Configs): cache.append(split_package[0]) # package name cache.append(split_package[1]) # package version cache.append(package_name) - cache.append(self.repos.conraid_repo_mirror[0]) + cache.append(mirror) try: cache.append(checksums_dict[package_name]) except KeyError: @@ -1024,6 +1031,10 @@ class InstallData(Configs): packages_txt: list = self.utils.read_file(path_packages) checksums_md5: list = self.utils.read_file(path_checksums) + mirror: str = self.repos.slackonly_repo_mirror[0] + if self.repos.slackonly_repo_local[0].startswith('file'): + mirror: str = self.repos.slackonly_repo_local[0] + for line in checksums_md5: line = line.strip() @@ -1042,7 +1053,7 @@ class InstallData(Configs): cache.append(split_package[0]) # package name cache.append(split_package[1]) # package version cache.append(package_name) - cache.append(self.repos.slackonly_repo_mirror[0]) + cache.append(mirror) try: cache.append(checksums_dict[package_name]) except KeyError: @@ -1118,6 +1129,10 @@ class InstallData(Configs): packages_txt: list = self.utils.read_file(path_packages) checksums_md5: list = self.utils.read_file(path_checksums) + mirror: str = self.repos.salixos_repo_mirror[0] + if self.repos.salixos_repo_local[0].startswith('file'): + mirror: str = self.repos.salixos_repo_local[0] + for line in checksums_md5: line = line.strip() @@ -1136,7 +1151,7 @@ class InstallData(Configs): cache.append(split_package[0]) # package name cache.append(split_package[1]) # package version cache.append(package_name) - cache.append(self.repos.salixos_repo_mirror[0]) + cache.append(mirror) try: cache.append(checksums_dict[package_name]) except KeyError: @@ -1221,6 +1236,10 @@ class InstallData(Configs): packages_txt: list = self.utils.read_file(path_packages) checksums_md5: list = self.utils.read_file(path_checksums) + mirror: str = self.repos.salixos_extra_repo_mirror[0] + if self.repos.salixos_extra_repo_local[0].startswith('file'): + mirror: str = self.repos.salixos_extra_repo_local[0] + for line in checksums_md5: line = line.strip() @@ -1239,7 +1258,7 @@ class InstallData(Configs): cache.append(split_package[0]) # package name cache.append(split_package[1]) # package version cache.append(package_name) - cache.append(self.repos.salixos_extra_repo_mirror[0]) + cache.append(mirror) try: cache.append(checksums_dict[package_name]) except KeyError: @@ -1324,6 +1343,10 @@ class InstallData(Configs): packages_txt: list = self.utils.read_file(path_packages) checksums_md5: list = self.utils.read_file(path_checksums) + mirror: str = self.repos.salixos_patches_repo_mirror[0] + if self.repos.salixos_patches_repo_local[0].startswith('file'): + mirror: str = self.repos.salixos_patches_repo_local[0] + for line in checksums_md5: line = line.strip() @@ -1342,7 +1365,7 @@ class InstallData(Configs): cache.append(split_package[0]) # package name cache.append(split_package[1]) # package version cache.append(package_name) - cache.append(self.repos.salixos_patches_repo_mirror[0]) + cache.append(mirror) try: cache.append(checksums_dict[package_name]) except KeyError: @@ -1426,6 +1449,10 @@ class InstallData(Configs): packages_txt: list = self.utils.read_file(path_packages) checksums_md5: list = self.utils.read_file(path_checksums) + mirror: str = self.repos.slackel_repo_mirror[0] + if self.repos.slackel_repo_local[0].startswith('file'): + mirror: str = self.repos.slackel_repo_local[0] + for line in checksums_md5: line = line.strip() @@ -1444,7 +1471,7 @@ class InstallData(Configs): cache.append(split_package[0]) # package name cache.append(split_package[1]) # package version cache.append(package_name) - cache.append(self.repos.slackel_repo_mirror[0]) + cache.append(mirror) try: cache.append(checksums_dict[package_name]) except KeyError: @@ -1528,6 +1555,10 @@ class InstallData(Configs): packages_txt: list = self.utils.read_file(path_packages) checksums_md5: list = self.utils.read_file(path_checksums) + mirror: str = self.repos.slint_repo_mirror[0] + if self.repos.slint_repo_local[0].startswith('file'): + mirror: str = self.repos.slint_repo_local[0] + for line in checksums_md5: line = line.strip() @@ -1546,7 +1577,7 @@ class InstallData(Configs): cache.append(split_package[0]) # package name cache.append(split_package[1]) # package version cache.append(package_name) - cache.append(self.repos.slint_repo_mirror[0]) + cache.append(mirror) try: cache.append(checksums_dict[package_name]) except KeyError: diff --git a/slpkg/update_repository.py b/slpkg/update_repository.py index 64383146..a2f9c2c5 100644 --- a/slpkg/update_repository.py +++ b/slpkg/update_repository.py @@ -95,8 +95,10 @@ class UpdateRepository(Configs): self.utils.remove_file_if_exists(self.repos.slack_repo_path, self.repos.slack_repo_checksums) if self.repos.slack_repo_local[0].startswith('file'): - lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.slack_repo_mirror[0]} ' - f'{self.repos.slack_repo_path}') + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {self.repos.slack_repo_mirror[0]} ' + f'{self.repos.slack_repo_path}' + ) self.utils.process(lftp_command) else: @@ -126,8 +128,10 @@ class UpdateRepository(Configs): urls.append(f'{self.repos.slack_extra_repo_mirror[0]}{self.repos.slack_extra_repo_changelog}') if self.repos.slack_extra_repo_local[0].startswith('file'): - lftp_command: str = (f'lftp {self.lftp_mirror_options} {"".join(self.repos.slack_extra_repo_mirror)} ' - f'{self.repos.slack_extra_repo_path}') + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {"".join(self.repos.slack_extra_repo_mirror)} ' + f'{self.repos.slack_extra_repo_path}' + ) self.utils.process(lftp_command) @@ -160,8 +164,10 @@ class UpdateRepository(Configs): urls.append(f'{self.repos.slack_patches_repo_mirror[0]}{self.repos.slack_patches_repo_changelog}') if self.repos.slack_patches_repo_local[0].startswith('file'): - lftp_command: str = (f'lftp {self.lftp_mirror_options} {"".join(self.repos.slack_patches_repo_mirror)} ' - f'{self.repos.slack_patches_repo_path}') + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {"".join(self.repos.slack_patches_repo_mirror)} ' + f'{self.repos.slack_patches_repo_path}' + ) self.utils.process(lftp_command) else: @@ -190,8 +196,10 @@ class UpdateRepository(Configs): urls.append(f'{self.repos.alien_repo_mirror[0]}{self.repos.alien_repo_changelog}') if self.repos.alien_repo_local[0].startswith('file'): - lftp_command: str = (f'lftp {self.lftp_mirror_options} {"".join(self.repos.alien_repo_mirror)} ' - f'{self.repos.alien_repo_path}') + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {"".join(self.repos.alien_repo_mirror)} ' + f'{self.repos.alien_repo_path}' + ) self.utils.process(lftp_command) else: @@ -220,8 +228,10 @@ class UpdateRepository(Configs): urls.append(f'{self.repos.multilib_repo_mirror[0]}{self.repos.multilib_repo_changelog}') if self.repos.multilib_repo_local[0].startswith('file'): - lftp_command: str = (f'lftp {self.lftp_mirror_options} {"".join(self.repos.multilib_repo_mirror)} ' - f'{self.repos.multilib_repo_path}') + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {"".join(self.repos.multilib_repo_mirror)} ' + f'{self.repos.multilib_repo_path}' + ) self.utils.process(lftp_command) else: @@ -250,8 +260,10 @@ class UpdateRepository(Configs): urls.append(f'{self.repos.restricted_repo_mirror[0]}{self.repos.restricted_repo_changelog}') if self.repos.restricted_repo_local[0].startswith('file'): - lftp_command: str = (f'lftp {self.lftp_mirror_options} {"".join(self.repos.restricted_repo_mirror)} ' - f'{self.repos.restricted_repo_path}') + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {"".join(self.repos.restricted_repo_mirror)} ' + f'{self.repos.restricted_repo_path}' + ) self.utils.process(lftp_command) else: @@ -278,8 +290,10 @@ class UpdateRepository(Configs): self.utils.remove_file_if_exists(self.repos.gnome_repo_path, self.repos.gnome_repo_checksums) if self.repos.gnome_repo_local[0].startswith('file'): - lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.gnome_repo_mirror[0]} ' - f'{self.repos.gnome_repo_path}') + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {self.repos.gnome_repo_mirror[0]} ' + f'{self.repos.gnome_repo_path}' + ) self.utils.process(lftp_command) else: @@ -309,8 +323,10 @@ class UpdateRepository(Configs): urls.append(f'{self.repos.msb_repo_mirror[0]}{self.repos.msb_repo_changelog}') if self.repos.msb_repo_local[0].startswith('file'): - lftp_command: str = (f'lftp {self.lftp_mirror_options} {"".join(self.repos.msb_repo_mirror)} ' - f'{self.repos.msb_repo_path}') + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {"".join(self.repos.msb_repo_mirror)} ' + f'{self.repos.msb_repo_path}' + ) self.utils.process(lftp_command) else: @@ -327,22 +343,26 @@ class UpdateRepository(Configs): print() def csb_repository(self) -> None: - if not self.repos.csb_repo_mirror[0].startswith('file'): - print(f"Downloading the '{self.green}{self.repos.csb_repo_name}{self.endc}' " - f"repository, please wait...\n") - urls: list = [] - self.utils.create_directory(self.repos.csb_repo_path) + print(f"Downloading the '{self.green}{self.repos.csb_repo_name}{self.endc}' " + f"repository, please wait...\n") + urls: list = [] + self.utils.create_directory(self.repos.csb_repo_path) + self.utils.remove_file_if_exists(self.repos.csb_repo_path, self.repos.csb_repo_packages) + self.utils.remove_file_if_exists(self.repos.csb_repo_path, self.repos.csb_repo_changelog) + self.utils.remove_file_if_exists(self.repos.csb_repo_path, self.repos.csb_repo_checksums) + + if self.repos.csb_repo_local[0].startswith('file'): + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {"".join(self.repos.csb_repo_mirror)} ' + f'{self.repos.csb_repo_path}' + ) + + self.utils.process(lftp_command) + else: + urls.append(f'{"".join(self.repos.csb_repo_mirror)}{self.repos.csb_repo_changelog}') urls.append(f'{"".join(self.repos.csb_repo_mirror)}{self.repos.csb_repo_packages}') - urls.append(f'{self.repos.csb_repo_mirror[0]}{self.repos.csb_repo_changelog}') - urls.append(f'{self.repos.csb_repo_mirror[0]}{self.repos.csb_repo_checksums}') - - self.utils.remove_file_if_exists(self.repos.csb_repo_path, - self.repos.csb_repo_packages) - self.utils.remove_file_if_exists(self.repos.csb_repo_path, - self.repos.csb_repo_changelog) - self.utils.remove_file_if_exists(self.repos.csb_repo_path, - self.repos.csb_repo_checksums) + urls.append(f'{"".join(self.repos.csb_repo_mirror)}{self.repos.csb_repo_checksums}') down = Downloader(self.repos.csb_repo_path, urls, self.flags) down.download() @@ -354,20 +374,27 @@ class UpdateRepository(Configs): print() def conraid_repository(self) -> None: - if not self.repos.conraid_repo_mirror[0].startswith('file'): - print(f"Downloading the '{self.green}{self.repos.conraid_repo_name}{self.endc}' " - f"repository, please wait...\n") - urls: list = [] - self.utils.create_directory(self.repos.conraid_repo_path) + print(f"Downloading the '{self.green}{self.repos.conraid_repo_name}{self.endc}' " + f"repository, please wait...\n") + urls: list = [] + self.utils.create_directory(self.repos.conraid_repo_path) - urls.append(f'{self.repos.conraid_repo_mirror[0]}{self.repos.conraid_repo_packages}') + self.utils.remove_file_if_exists(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog) + self.utils.remove_file_if_exists(self.repos.conraid_repo_path, self.repos.conraid_repo_packages) + self.utils.remove_file_if_exists(self.repos.conraid_repo_path, self.repos.conraid_repo_checksums) + + if self.repos.conraid_repo_local[0].startswith('file'): + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {self.repos.conraid_repo_mirror[0]} ' + f'{self.repos.conraid_repo_path}' + ) + + self.utils.process(lftp_command) + else: urls.append(f'{self.repos.conraid_repo_mirror[0]}{self.repos.conraid_repo_changelog}') + urls.append(f'{self.repos.conraid_repo_mirror[0]}{self.repos.conraid_repo_packages}') urls.append(f'{self.repos.conraid_repo_mirror[0]}{self.repos.conraid_repo_checksums}') - self.utils.remove_file_if_exists(self.repos.conraid_repo_path, self.repos.conraid_repo_packages) - self.utils.remove_file_if_exists(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog) - self.utils.remove_file_if_exists(self.repos.conraid_repo_path, self.repos.conraid_repo_checksums) - down = Downloader(self.repos.conraid_repo_path, urls, self.flags) down.download() print() @@ -384,17 +411,25 @@ class UpdateRepository(Configs): urls: list = [] self.utils.create_directory(self.repos.slackonly_repo_path) - urls.append(f'{self.repos.slackonly_repo_mirror[0]}{self.repos.slackonly_repo_packages}') - urls.append(f'{self.repos.slackonly_repo_mirror[0]}{self.repos.slackonly_repo_changelog}') - urls.append(f'{self.repos.slackonly_repo_mirror[0]}{self.repos.slackonly_repo_checksums}') - - self.utils.remove_file_if_exists(self.repos.slackonly_repo_path, self.repos.slackonly_repo_packages) self.utils.remove_file_if_exists(self.repos.slackonly_repo_path, self.repos.slackonly_repo_changelog) + self.utils.remove_file_if_exists(self.repos.slackonly_repo_path, self.repos.slackonly_repo_packages) self.utils.remove_file_if_exists(self.repos.slackonly_repo_path, self.repos.slackonly_repo_checksums) - down = Downloader(self.repos.slackonly_repo_path, urls, self.flags) - down.download() - print() + if self.repos.slackonly_repo_local[0].startswith('file'): + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {self.repos.slackonly_repo_mirror[0]} ' + f'{self.repos.slackonly_repo_path}' + ) + + self.utils.process(lftp_command) + else: + urls.append(f'{self.repos.slackonly_repo_mirror[0]}{self.repos.slackonly_repo_changelog}') + urls.append(f'{self.repos.slackonly_repo_mirror[0]}{self.repos.slackonly_repo_packages}') + urls.append(f'{self.repos.slackonly_repo_mirror[0]}{self.repos.slackonly_repo_checksums}') + + down = Downloader(self.repos.slackonly_repo_path, urls, self.flags) + down.download() + print() self.delete_bin_database_data(self.repos.slackonly_repo_name) self.delete_last_updated(self.repos.slackonly_repo_name) @@ -402,20 +437,27 @@ class UpdateRepository(Configs): print() def salixos_repository(self) -> None: - if not self.repos.salixos_repo_mirror[0].startswith('file'): - print(f"Downloading the '{self.green}{self.repos.salixos_repo_name}{self.endc}' " - f"repository, please wait...\n") - urls: list = [] - self.utils.create_directory(self.repos.salixos_repo_path) + print(f"Downloading the '{self.green}{self.repos.salixos_repo_name}{self.endc}' " + f"repository, please wait...\n") + urls: list = [] + self.utils.create_directory(self.repos.salixos_repo_path) - urls.append(f'{self.repos.salixos_repo_mirror[0]}{self.repos.salixos_repo_packages}') + self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog) + self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_packages) + self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_checksums) + + if self.repos.salixos_repo_local[0].startswith('file'): + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {self.repos.salixos_repo_mirror[0]} ' + f'{self.repos.salixos_repo_path}' + ) + + self.utils.process(lftp_command) + else: urls.append(f'{self.repos.salixos_repo_mirror[0]}{self.repos.salixos_repo_changelog}') + urls.append(f'{self.repos.salixos_repo_mirror[0]}{self.repos.salixos_repo_packages}') urls.append(f'{self.repos.salixos_repo_mirror[0]}{self.repos.salixos_repo_checksums}') - self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_packages) - self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog) - self.utils.remove_file_if_exists(self.repos.salixos_repo_path, self.repos.salixos_repo_checksums) - down = Downloader(self.repos.salixos_repo_path, urls, self.flags) down.download() print() @@ -426,26 +468,34 @@ class UpdateRepository(Configs): print() def salixos_extra_repository(self) -> None: - if not self.repos.salixos_extra_repo_mirror[0].startswith('file'): - print(f"Downloading the '{self.green}{self.repos.salixos_extra_repo_name}{self.endc}' " - f"repository, please wait...\n") - urls: list = [] - self.utils.create_directory(self.repos.salixos_extra_repo_path) + print(f"Downloading the '{self.green}{self.repos.salixos_extra_repo_name}{self.endc}' " + f"repository, please wait...\n") + urls: list = [] + self.utils.create_directory(self.repos.salixos_extra_repo_path) + self.utils.remove_file_if_exists(self.repos.salixos_extra_repo_path, + self.repos.salixos_extra_repo_changelog) + self.utils.remove_file_if_exists(self.repos.salixos_extra_repo_path, + self.repos.salixos_extra_repo_packages) + self.utils.remove_file_if_exists(self.repos.salixos_extra_repo_path, + self.repos.salixos_extra_repo_checksums) + + urls.append(f'{self.repos.salixos_extra_repo_mirror[0]}{self.repos.salixos_extra_repo_changelog}') + + if self.repos.salixos_extra_repo_local[0].startswith('file'): + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {"".join(self.repos.salixos_extra_repo_mirror)} ' + f'{self.repos.salixos_extra_repo_path}' + ) + + self.utils.process(lftp_command) + else: urls.append(f'{"".join(self.repos.salixos_extra_repo_mirror)}{self.repos.salixos_extra_repo_packages}') - urls.append(f'{self.repos.salixos_extra_repo_mirror[0]}{self.repos.salixos_extra_repo_changelog}') - urls.append(f'{self.repos.salixos_extra_repo_mirror[0]}{self.repos.salixos_extra_repo_checksums}') + urls.append(f'{"".join(self.repos.salixos_extra_repo_mirror)}{self.repos.salixos_extra_repo_checksums}') - self.utils.remove_file_if_exists(self.repos.salixos_extra_repo_path, - self.repos.salixos_extra_repo_packages) - self.utils.remove_file_if_exists(self.repos.salixos_extra_repo_path, - self.repos.salixos_extra_repo_changelog) - self.utils.remove_file_if_exists(self.repos.salixos_extra_repo_path, - self.repos.salixos_extra_repo_checksums) - - down = Downloader(self.repos.salixos_extra_repo_path, urls, self.flags) - down.download() - print() + down = Downloader(self.repos.salixos_extra_repo_path, urls, self.flags) + down.download() + print() self.delete_bin_database_data(self.repos.salixos_extra_repo_name) self.delete_last_updated(self.repos.salixos_extra_repo_name) @@ -453,27 +503,36 @@ class UpdateRepository(Configs): print() def salixos_patches_repository(self) -> None: - if not self.repos.salixos_patches_repo_mirror[0].startswith('file'): - print(f"Downloading the '{self.green}{self.repos.salixos_patches_repo_name}{self.endc}' " - f"repository, please wait...\n") - urls: list = [] - self.utils.create_directory(self.repos.slack_patches_repo_path) + print(f"Downloading the '{self.green}{self.repos.salixos_patches_repo_name}{self.endc}' " + f"repository, please wait...\n") + urls: list = [] + self.utils.create_directory(self.repos.slack_patches_repo_path) + self.utils.remove_file_if_exists(self.repos.salixos_patches_repo_path, + self.repos.salixos_patches_repo_changelog) + self.utils.remove_file_if_exists(self.repos.salixos_patches_repo_path, + self.repos.salixos_patches_repo_packages) + self.utils.remove_file_if_exists(self.repos.salixos_patches_repo_path, + self.repos.salixos_patches_repo_checksums) + + urls.append(f'{self.repos.salixos_patches_repo_mirror[0]}{self.repos.salixos_patches_repo_changelog}') + + if self.repos.salixos_patches_repo_local[0].startswith('file'): + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {"".join(self.repos.salixos_patches_repo_mirror)} ' + f'{self.repos.salixos_patches_repo_path}' + ) + + self.utils.process(lftp_command) + else: urls.append(f'{"".join(self.repos.salixos_patches_repo_mirror)}' f'{self.repos.salixos_patches_repo_packages}') - urls.append(f'{self.repos.salixos_patches_repo_mirror[0]}{self.repos.salixos_patches_repo_changelog}') - urls.append(f'{self.repos.salixos_patches_repo_mirror[0]}{self.repos.salixos_patches_repo_checksums}') + urls.append(f'{"".join(self.repos.salixos_patches_repo_mirror)}' + f'{self.repos.salixos_patches_repo_checksums}') - self.utils.remove_file_if_exists(self.repos.salixos_patches_repo_path, - self.repos.salixos_patches_repo_packages) - self.utils.remove_file_if_exists(self.repos.salixos_patches_repo_path, - self.repos.salixos_patches_repo_changelog) - self.utils.remove_file_if_exists(self.repos.salixos_patches_repo_path, - self.repos.salixos_patches_repo_checksums) - - down = Downloader(self.repos.salixos_patches_repo_path, urls, self.flags) - down.download() - print() + down = Downloader(self.repos.salixos_patches_repo_path, urls, self.flags) + down.download() + print() self.delete_bin_database_data(self.repos.salixos_patches_repo_name) self.delete_last_updated(self.repos.salixos_patches_repo_name) @@ -481,20 +540,27 @@ class UpdateRepository(Configs): print() def slackel_repository(self) -> None: - if not self.repos.slackel_repo_mirror[0].startswith('file'): - print(f"Downloading the '{self.green}{self.repos.slackel_repo_name}{self.endc}' " - f"repository, please wait...\n") - urls: list = [] - self.utils.create_directory(self.repos.slackel_repo_path) + print(f"Downloading the '{self.green}{self.repos.slackel_repo_name}{self.endc}' " + f"repository, please wait...\n") + urls: list = [] + self.utils.create_directory(self.repos.slackel_repo_path) - urls.append(f'{self.repos.slackel_repo_mirror[0]}{self.repos.slackel_repo_packages}') + self.utils.remove_file_if_exists(self.repos.slackel_repo_path, self.repos.slackel_repo_changelog) + self.utils.remove_file_if_exists(self.repos.slackel_repo_path, self.repos.slackel_repo_packages) + self.utils.remove_file_if_exists(self.repos.slackel_repo_path, self.repos.slackel_repo_checksums) + + if self.repos.slackel_repo_local[0].startswith('file'): + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {self.repos.slackel_repo_mirror[0]} ' + f'{self.repos.slackel_repo_path}' + ) + + self.utils.process(lftp_command) + else: urls.append(f'{self.repos.slackel_repo_mirror[0]}{self.repos.slackel_repo_changelog}') + urls.append(f'{self.repos.slackel_repo_mirror[0]}{self.repos.slackel_repo_packages}') urls.append(f'{self.repos.slackel_repo_mirror[0]}{self.repos.slackel_repo_checksums}') - self.utils.remove_file_if_exists(self.repos.slackel_repo_path, self.repos.slackel_repo_packages) - self.utils.remove_file_if_exists(self.repos.slackel_repo_path, self.repos.slackel_repo_changelog) - self.utils.remove_file_if_exists(self.repos.slackel_repo_path, self.repos.slackel_repo_checksums) - down = Downloader(self.repos.slackel_repo_path, urls, self.flags) down.download() print() @@ -505,20 +571,27 @@ class UpdateRepository(Configs): print() def slint_repository(self) -> None: - if not self.repos.slint_repo_mirror[0].startswith('file'): - print(f"Downloading the '{self.green}{self.repos.slint_repo_name}{self.endc}' " - f"repository, please wait...\n") - urls: list = [] - self.utils.create_directory(self.repos.slint_repo_path) + print(f"Downloading the '{self.green}{self.repos.slint_repo_name}{self.endc}' " + f"repository, please wait...\n") + urls: list = [] + self.utils.create_directory(self.repos.slint_repo_path) - urls.append(f'{self.repos.slint_repo_mirror[0]}{self.repos.slint_repo_packages}') + self.utils.remove_file_if_exists(self.repos.slint_repo_path, self.repos.slint_repo_changelog) + self.utils.remove_file_if_exists(self.repos.slint_repo_path, self.repos.slint_repo_packages) + self.utils.remove_file_if_exists(self.repos.slint_repo_path, self.repos.slint_repo_checksums) + + if self.repos.slint_repo_local[0].startswith('file'): + lftp_command: str = ( + f'lftp {self.lftp_mirror_options} {self.repos.slint_repo_mirror[0]} ' + f'{self.repos.slint_repo_path}' + ) + + self.utils.process(lftp_command) + else: urls.append(f'{self.repos.slint_repo_mirror[0]}{self.repos.slint_repo_changelog}') + urls.append(f'{self.repos.slint_repo_mirror[0]}{self.repos.slint_repo_packages}') urls.append(f'{self.repos.slint_repo_mirror[0]}{self.repos.slint_repo_checksums}') - self.utils.remove_file_if_exists(self.repos.slint_repo_path, self.repos.slint_repo_packages) - self.utils.remove_file_if_exists(self.repos.slint_repo_path, self.repos.slint_repo_changelog) - self.utils.remove_file_if_exists(self.repos.slint_repo_path, self.repos.slint_repo_checksums) - down = Downloader(self.repos.slint_repo_path, urls, self.flags) down.download() print()