From 09a6b37ac04b640a3f785ce5cb74baff9f36c2e7 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 29 Nov 2017 17:12:38 +0100 Subject: [PATCH] mirror: fix downloading of graphics It was downloading them all directly into the 'repo' folder. --- fdroidserver/mirror.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/fdroidserver/mirror.py b/fdroidserver/mirror.py index 6ed69953..06595a44 100644 --- a/fdroidserver/mirror.py +++ b/fdroidserver/mirror.py @@ -24,6 +24,10 @@ def _run_wget(path, urls): else: 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) urls_file = '.fdroid-mirror-wget-input-file' with open(urls_file, 'w') as fp: @@ -142,22 +146,27 @@ def main(): 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 + '.asc')) + _run_wget(sectiondir, urls) for app in data['apps']: localized = app.get('localized') if localized: for locale, d in localized.items(): + urls = [] + components = (section, app['packageName'], locale) for k in update.GRAPHIC_NAMES: f = d.get(k) 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: + urls = [] filelist = d.get(k) if filelist: + components = (section, app['packageName'], locale, k) for f in filelist: - urls.append(_append_to_url_path(section, app['packageName'], locale, k, f)) - - _run_wget(sectiondir, urls) + urls.append(_append_to_url_path(*components, f)) + _run_wget(os.path.join(basedir, *components), urls) urls = dict() for app in data['apps']: -- 2.30.2