Removed lftp extra options

This commit is contained in:
Dimitris Zlatanidis 2024-04-11 21:34:52 +03:00
parent 2113b81786
commit 924685b15f
4 changed files with 2 additions and 20 deletions

View file

@ -124,12 +124,6 @@ LFTP_GET_OPTIONS = "-c get -e"
# Ponce repositories or for the local repositories. # Ponce repositories or for the local repositories.
LFTP_MIRROR_OPTIONS = "-c mirror --parallel=100 --only-newer --delete" LFTP_MIRROR_OPTIONS = "-c mirror --parallel=100 --only-newer --delete"
# Extra lftp options by repository, using a key = value pair.
# Example, if you want to exclude some files or directories:
# {"slack" = "-x source/ -x patches/", "sbo" = "-x '*.tar.gz*'"}
# Be sure of the name, as set it in the /etc/slpkg/repositories.toml file.
LFTP_MIRROR_EXTRA_OPTIONS = {}
# Python urllib3 settings used for checking between two changelog files. # Python urllib3 settings used for checking between two changelog files.
# Timeouts allow you to control how long (in seconds) requests are allowed # Timeouts allow you to control how long (in seconds) requests are allowed
# to run before being aborted. In simple cases, you can specify a timeout # to run before being aborted. In simple cases, you can specify a timeout

View file

@ -50,7 +50,6 @@ class Configs:
curl_options: str = '' curl_options: str = ''
lftp_get_options: str = '-c get -e' lftp_get_options: str = '-c get -e'
lftp_mirror_options: str = '-c mirror --parallel=100 --only-newer --delete' lftp_mirror_options: str = '-c mirror --parallel=100 --only-newer --delete'
lftp_mirror_extra_options = {}
ascii_characters: bool = True ascii_characters: bool = True
ask_question: bool = True ask_question: bool = True
parallel_downloads: bool = False parallel_downloads: bool = False
@ -97,7 +96,6 @@ class Configs:
curl_options: str = config['CURL_OPTIONS'] curl_options: str = config['CURL_OPTIONS']
lftp_get_options: str = config['LFTP_GET_OPTIONS'] lftp_get_options: str = config['LFTP_GET_OPTIONS']
lftp_mirror_options: str = config['LFTP_MIRROR_OPTIONS'] lftp_mirror_options: str = config['LFTP_MIRROR_OPTIONS']
lftp_mirror_extra_options = config['LFTP_MIRROR_EXTRA_OPTIONS']
ascii_characters: bool = config['ASCII_CHARACTERS'] ascii_characters: bool = config['ASCII_CHARACTERS']
file_list_suffix: str = config['FILE_LIST_SUFFIX'] file_list_suffix: str = config['FILE_LIST_SUFFIX']
parallel_downloads: bool = config['PARALLEL_DOWNLOADS'] parallel_downloads: bool = config['PARALLEL_DOWNLOADS']

View file

@ -133,7 +133,6 @@ class FormConfigs(Configs):
'SPINNING_BAR =', 'SPINNING_BAR =',
'CASE_SENSITIVE =', 'CASE_SENSITIVE =',
'PROCESS_LOG =', 'PROCESS_LOG =',
'LFTP_MIRROR_EXTRA_OPTIONS =',
'URLLIB_RETRIES =', 'URLLIB_RETRIES =',
'URLLIB_REDIRECT =', 'URLLIB_REDIRECT =',
'URLLIB_TIMEOUT =', 'URLLIB_TIMEOUT =',

View file

@ -34,7 +34,6 @@ class UpdateRepositories(Configs):
self.download = Downloader(flags) self.download = Downloader(flags)
self.repos_for_update: dict = {} self.repos_for_update: dict = {}
self.lftp_extra_options: str = ' '
self.option_for_repository: bool = self.utils.is_option( self.option_for_repository: bool = self.utils.is_option(
('-o', '--repository'), flags) ('-o', '--repository'), flags)
@ -74,22 +73,16 @@ class UpdateRepositories(Configs):
if self.option_for_repository: if self.option_for_repository:
self.view_downloading_message(self.repository) self.view_downloading_message(self.repository)
self.set_lftp_extra_options(self.repository)
repositories[self.repository]() repositories[self.repository]()
else: else:
for repo, update in self.repos_for_update.items(): for repo, update in self.repos_for_update.items():
if update: if update:
self.view_downloading_message(repo) self.view_downloading_message(repo)
self.set_lftp_extra_options(repo)
repositories[repo]() repositories[repo]()
def view_downloading_message(self, repo: str) -> None: def view_downloading_message(self, repo: str) -> None:
print(f"Syncing with the repository '{self.green}{repo}{self.endc}', please wait...\n") print(f"Syncing with the repository '{self.green}{repo}{self.endc}', please wait...\n")
def set_lftp_extra_options(self, repository: str) -> None:
if self.lftp_mirror_extra_options.get(repository):
self.lftp_extra_options: str = f' {self.lftp_mirror_extra_options[repository]} '
def slack_repository(self) -> None: def slack_repository(self) -> None:
urls: dict = {} urls: dict = {}
self.utils.create_directory(self.repos.slack_repo_path) self.utils.create_directory(self.repos.slack_repo_path)
@ -402,8 +395,7 @@ class UpdateRepositories(Configs):
self.utils.remove_file_if_exists(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)
self.utils.remove_file_if_exists(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog) self.utils.remove_file_if_exists(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog)
lftp_command: str = (f'lftp {self.lftp_mirror_options}{self.lftp_extra_options}' lftp_command: str = f'lftp {self.lftp_mirror_options} {self.repos.ponce_repo_mirror[0]} {self.repos.ponce_repo_path}'
f'{self.repos.ponce_repo_mirror[0]} {self.repos.ponce_repo_path}')
self.multi_process.process(lftp_command) self.multi_process.process(lftp_command)
@ -418,8 +410,7 @@ class UpdateRepositories(Configs):
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_slackbuilds)
self.utils.remove_file_if_exists(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_changelog)
lftp_command: str = (f'lftp {self.lftp_mirror_options}{self.lftp_extra_options}' lftp_command: str = f'lftp {self.lftp_mirror_options} {self.repos.sbo_repo_mirror[0]} {self.repos.sbo_repo_path}'
f'{self.repos.sbo_repo_mirror[0]} {self.repos.sbo_repo_path}')
self.multi_process.process(lftp_command) self.multi_process.process(lftp_command)