Merge method from utils

This commit is contained in:
Dimitris Zlatanidis 2023-03-25 19:48:02 +02:00
parent 43228647b3
commit faa5f3e019

View file

@ -70,9 +70,9 @@ class UpdateRepository(Configs):
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_packages)
self.delete_file(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog)
self.delete_file(self.repos.gnome_repo_path, self.repos.gnome_repo_checksums)
self.utils.remove_file_if_exists(self.repos.gnome_repo_path, self.repos.gnome_repo_packages)
self.utils.remove_file_if_exists(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog)
self.utils.remove_file_if_exists(self.repos.gnome_repo_path, self.repos.gnome_repo_checksums)
down = Downloader(self.repos.gnome_repo_path, urls, self.flags)
down.download()
@ -94,9 +94,9 @@ class UpdateRepository(Configs):
urls.append(f'{self.repos.conraid_repo_mirror}{self.repos.conraid_repo_changelog}')
urls.append(f'{self.repos.conraid_repo_mirror}{self.repos.conraid_repo_checksums}')
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)
self.delete_file(self.repos.conraid_repo_path, 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()
@ -114,7 +114,7 @@ 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_slackbuilds)
self.utils.remove_file_if_exists(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)
@ -135,8 +135,8 @@ 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_slackbuilds)
self.delete_file(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog)
self.utils.remove_file_if_exists(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds)
self.utils.remove_file_if_exists(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_mirror} '
@ -197,13 +197,6 @@ class UpdateRepository(Configs):
self.update = queue.get()
self.update_the_repositories()
@staticmethod
def delete_file(folder: Path, txt_file: str) -> None:
""" Delete the file. """
file = Path(folder, txt_file)
if file.exists():
file.unlink()
def delete_sbo_data(self) -> None:
""" Delete all the data from a table of the database. """
if self.repos.ponce_repo: