chiark / gitweb /
ensure that mirror URLs always include the repodir
authorHans-Christoph Steiner <hans@eds.org>
Fri, 7 Jul 2017 13:50:11 +0000 (15:50 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Fri, 7 Jul 2017 13:50:11 +0000 (15:50 +0200)
Since the mirror URLs are per repo section (repo/archive), the mirror URLs
must include the repodir at the end.  This was missing for servergitmirrors

found by @cde when working on fdroidclient#35

fdroidserver/index.py
tests/run-tests

index 942c58612ff1b2db90f4e649812f2927cb490440..6843f5208a7d5a6e9af66ca41c8455256f408f11 100644 (file)
@@ -113,8 +113,8 @@ def make(apps, sortedids, apks, repodir, archive):
             mirrors.append(urllib.parse.urljoin(mirror + '/', urlbasepath))
     for mirror in common.config.get('servergitmirrors', []):
         mirror = get_mirror_service_url(mirror)
-        if mirror is not None:
-            mirrors.append(mirror + '/')
+        if mirror:
+            mirrors.append(mirror + '/' + repodir)
     if mirrorcheckfailed:
         raise FDroidException("Malformed repository mirrors.")
     if mirrors:
index 625402e830f3198b677ce641bf92c31cd500f9ce..eef54ee4bfa215fef9c6453ecd92be8999c00c7b 100755 (executable)
@@ -1038,11 +1038,16 @@ cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $OF
 
 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
+echo "mirrors = ['http://foo.bar/fdroid', 'http://asdflkdsfjafdsdfhkjh.onion/fdroid']" >> config.py
 echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py
 echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
 echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
-$fdroid update --verbose
+$fdroid update --pretty
 grep -F '<application id=' repo/index.xml > /dev/null
+grep -F '/fdroid/repo</mirror>' repo/index.xml
+grep -F '/fdroid/archive</mirror>' archive/index.xml
+test `grep '<mirror>' repo/index.xml | wc -l` -eq 2
+test `grep '<mirror>' archive/index.xml | wc -l` -eq 2
 cd binary_transparency
 [ `git rev-list --count HEAD` == "1" ]
 cd ..