Added lftp

This commit is contained in:
Dimitris Zlatanidis 2023-03-10 18:34:13 +02:00
parent 32b5bc967a
commit 872d6696ae
4 changed files with 14 additions and 3 deletions

View file

@ -1,6 +1,8 @@
4.5.9 - 10/03/2023
BugFixed:
- Default build path /tmp/slpkg/build
Added:
- lftp as source file downloader
4.5.8 - 09/03/2023
Updated:

View file

@ -57,8 +57,8 @@
# Slackware command to remove packages.
REMOVEPKG = "removepkg"
# You can choose downloader between wget and curl.
# Default is wget. [wget/curl].
# You can choose a downloader among wget, curl lftp.
# Default is wget. [wget/curl/lftp].
DOWNLOADER = "wget"
# Wget downloader options.
# -c, --continue: resume getting a partially-downloaded file.
@ -68,5 +68,7 @@
WGET_OPTIONS = "-c -N -q --show-progress"
# Curl downloader options.
CURL_OPTIONS = ""
# Lftp downloader options are used to synchronize with the ponce repository.
# Lftp donwloader options.
LFTP_GET_OPTIONS = "-c get -e"
# Lftp mirror options are used to synchronize with the ponce repository.
LFTP_MIRROR_OPTIONS = "-c mirror --parallel=100 --only-newer"

View file

@ -103,6 +103,8 @@ class Configs:
# Curl options.
curl_options: str = ''
lftp_get_options: str = '-c get -e'
# Lftp options'
lftp_mirror_options: str = '-c mirror --parallel=10 --only-newer'
@ -177,6 +179,8 @@ class Configs:
# Curl options.
curl_options: str = config['CURL_OPTIONS']
lftp_get_options: str = config['LFTP_GET_OPTIONS']
# Lftp options.
lftp_mirror_options: str = config['LFTP_MIRROR_OPTIONS']

View file

@ -49,6 +49,9 @@ class Downloader(Configs, Utilities):
self.output = subprocess.call(f'{self.downloader} {self.curl_options} "{self.url}" --output '
f'{self.path}/{self.filename}', shell=True, stderr=self.stderr,
stdout=self.stdout)
elif self.downloader == 'lftp':
self.output = subprocess.call(f'lftp {self.lftp_get_options} {self.url} -o {self.path}',
shell=True, stderr=self.stderr, stdout=self.stdout)
else:
raise SystemExit(f"{self.red}Error:{self.endc} Downloader '{self.downloader}' not supported.\n")