mirror: fix downloading of graphics

It was downloading them all directly into the 'repo' folder.
This commit is contained in:
Hans-Christoph Steiner 2017-11-29 17:12:38 +01:00
parent 79a4c469b3
commit 09a6b37ac0

View file

@ -24,6 +24,10 @@ def _run_wget(path, urls):
else: else:
verbose = '--no-verbose' verbose = '--no-verbose'
if not urls:
return
logging.debug(_('Running wget in {path}').format(path=path))
os.makedirs(path, exist_ok=True)
os.chdir(path) os.chdir(path)
urls_file = '.fdroid-mirror-wget-input-file' urls_file = '.fdroid-mirror-wget-input-file'
with open(urls_file, 'w') as fp: with open(urls_file, 'w') as fp:
@ -142,22 +146,27 @@ def main():
or (f.endswith('.apk') and os.path.getsize(f) != package['size']): or (f.endswith('.apk') and os.path.getsize(f) != package['size']):
urls.append(_append_to_url_path(section, f)) urls.append(_append_to_url_path(section, f))
urls.append(_append_to_url_path(section, f + '.asc')) urls.append(_append_to_url_path(section, f + '.asc'))
_run_wget(sectiondir, urls)
for app in data['apps']: for app in data['apps']:
localized = app.get('localized') localized = app.get('localized')
if localized: if localized:
for locale, d in localized.items(): for locale, d in localized.items():
urls = []
components = (section, app['packageName'], locale)
for k in update.GRAPHIC_NAMES: for k in update.GRAPHIC_NAMES:
f = d.get(k) f = d.get(k)
if f: if f:
urls.append(_append_to_url_path(section, app['packageName'], locale, f)) urls.append(_append_to_url_path(*components, f))
_run_wget(os.path.join(basedir, *components), urls)
for k in update.SCREENSHOT_DIRS: for k in update.SCREENSHOT_DIRS:
urls = []
filelist = d.get(k) filelist = d.get(k)
if filelist: if filelist:
components = (section, app['packageName'], locale, k)
for f in filelist: for f in filelist:
urls.append(_append_to_url_path(section, app['packageName'], locale, k, f)) urls.append(_append_to_url_path(*components, f))
_run_wget(os.path.join(basedir, *components), urls)
_run_wget(sectiondir, urls)
urls = dict() urls = dict()
for app in data['apps']: for app in data['apps']: