mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Merge for create dirs method
This commit is contained in:
parent
e4d27a6b7e
commit
dcb665199d
2 changed files with 24 additions and 25 deletions
|
@ -93,7 +93,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.slack_repo_name}{self.endc}"
|
||||
f"' repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.slack_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.slack_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.slack_repo_mirror[0]}{self.repos.slack_repo_packages}')
|
||||
urls.append(f'{self.repos.slack_repo_mirror[0]}{self.repos.slack_repo_changelog}')
|
||||
|
@ -117,7 +117,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.slack_extra_repo_name}{self.endc}"
|
||||
f"' repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.slack_extra_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.slack_extra_repo_name)
|
||||
|
||||
urls.append(f'{"".join(self.repos.slack_extra_repo_mirror)}{self.repos.slack_extra_repo_packages}')
|
||||
urls.append(f'{self.repos.slack_extra_repo_mirror[0]}{self.repos.slack_extra_repo_changelog}')
|
||||
|
@ -144,7 +144,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.slack_patches_repo_name}{self.endc}"
|
||||
f"' repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.slack_patches_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.slack_patches_repo_name)
|
||||
|
||||
urls.append(f'{"".join(self.repos.slack_patches_repo_mirror)}{self.repos.slack_patches_repo_packages}')
|
||||
urls.append(f'{self.repos.slack_patches_repo_mirror[0]}{self.repos.slack_patches_repo_changelog}')
|
||||
|
@ -171,7 +171,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.alien_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.alien_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.alien_repo_name)
|
||||
|
||||
urls.append(f'{"".join(self.repos.alien_repo_mirror)}{self.repos.alien_repo_packages}')
|
||||
urls.append(f'{self.repos.alien_repo_mirror[0]}{self.repos.alien_repo_changelog}')
|
||||
|
@ -195,7 +195,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.multilib_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.multilib_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.multilib_repo_name)
|
||||
|
||||
urls.append(f'{"".join(self.repos.multilib_repo_mirror)}{self.repos.multilib_repo_packages}')
|
||||
urls.append(f'{self.repos.multilib_repo_mirror[0]}{self.repos.multilib_repo_changelog}')
|
||||
|
@ -219,7 +219,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.restricted_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.restricted_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.restricted_repo_name)
|
||||
|
||||
urls.append(f'{"".join(self.repos.restricted_repo_mirror)}{self.repos.restricted_repo_packages}')
|
||||
urls.append(f'{self.repos.restricted_repo_mirror[0]}{self.repos.restricted_repo_changelog}')
|
||||
|
@ -243,7 +243,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.gnome_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.gnome_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.gnome_repo_name)
|
||||
|
||||
urls.append(f'{self.repos.gnome_repo_mirror[0]}{self.repos.gnome_repo_packages}')
|
||||
urls.append(f'{self.repos.gnome_repo_mirror[0]}{self.repos.gnome_repo_changelog}')
|
||||
|
@ -267,7 +267,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.msb_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.msb_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.msb_repo_name)
|
||||
|
||||
urls.append(f'{"".join(self.repos.msb_repo_mirror)}{self.repos.msb_repo_packages}')
|
||||
urls.append(f'{self.repos.msb_repo_mirror[0]}{self.repos.msb_repo_changelog}')
|
||||
|
@ -294,7 +294,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.csb_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.csb_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.csb_repo_name)
|
||||
|
||||
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}')
|
||||
|
@ -321,7 +321,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.conraid_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.conraid_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.conraid_repo_name)
|
||||
|
||||
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_changelog}')
|
||||
|
@ -345,7 +345,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.slackonly_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.slackonly_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.slackonly_repo_name)
|
||||
|
||||
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}')
|
||||
|
@ -369,7 +369,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.salixos_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.salixos_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.salixos_repo_name)
|
||||
|
||||
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_changelog}')
|
||||
|
@ -393,7 +393,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.salixos_extra_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.salixos_extra_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.salixos_extra_repo_name)
|
||||
|
||||
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}')
|
||||
|
@ -420,7 +420,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.salixos_patches_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.salixos_patches_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.salixos_patches_repo_name)
|
||||
|
||||
urls.append(f'{"".join(self.repos.salixos_patches_repo_mirror)}'
|
||||
f'{self.repos.salixos_patches_repo_packages}')
|
||||
|
@ -448,7 +448,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.slackel_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.slackel_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.slackel_repo_name)
|
||||
|
||||
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_changelog}')
|
||||
|
@ -472,7 +472,7 @@ class UpdateRepository(Configs):
|
|||
print(f"Downloading the '{self.green}{self.repos.slint_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
urls: list = []
|
||||
self.make_dirs(self.repos.slint_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.slint_repo_name)
|
||||
|
||||
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_changelog}')
|
||||
|
@ -498,7 +498,7 @@ class UpdateRepository(Configs):
|
|||
if not self.option_for_generate or not self.repos.ponce_repo_mirror[0].startswith('file'):
|
||||
print(f"Downloading the '{self.green}{self.repos.ponce_repo_name}"
|
||||
f"{self.endc}' repository, please wait...\n")
|
||||
self.make_dirs(self.repos.gnome_repo_name)
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.gnome_repo_name)
|
||||
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[0]} '
|
||||
f'{self.repos.ponce_repo_path}')
|
||||
|
@ -519,11 +519,15 @@ class UpdateRepository(Configs):
|
|||
if not self.repos.sbo_repo_mirror[0].startswith('file'):
|
||||
print(f"Downloading the '{self.green}{self.repos.sbo_repo_name}{self.endc}' "
|
||||
f"repository, please wait...\n")
|
||||
self.make_dirs(self.repos.sbo_repo_name)
|
||||
|
||||
self.utils.create_directory(self.repos.repositories_path, self.repos.sbo_repo_name)
|
||||
|
||||
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)
|
||||
|
||||
lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.sbo_repo_mirror[0]} '
|
||||
f'{self.repos.sbo_repo_path}')
|
||||
|
||||
self.utils.process(lftp_command)
|
||||
|
||||
self.delete_last_updated(self.repos.sbo_repo_name)
|
||||
|
@ -531,12 +535,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_sbo_database_data()
|
||||
self.data.install_sbos_data()
|
||||
|
||||
def make_dirs(self, repo) -> None:
|
||||
""" Creates folder like mkdir -p. """
|
||||
directory: Path = Path(self.repos.repositories_path, repo)
|
||||
if not directory.is_dir():
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def check(self, queue) -> None:
|
||||
compare: dict = self.check_updates.check()
|
||||
|
||||
|
|
|
@ -69,8 +69,9 @@ class Utilities(Configs):
|
|||
shutil.rmtree(folder)
|
||||
|
||||
@staticmethod
|
||||
def create_directory(directory: Path) -> None:
|
||||
def create_directory(directory: Path, folder='') -> None:
|
||||
""" Creates folder like mkdir -p. """
|
||||
directory: Path = Path(directory, folder)
|
||||
if not directory.is_dir():
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue