chiark / gitweb /
provide warning if config items will not preserve order
authorHans-Christoph Steiner <hans@eds.org>
Fri, 24 Feb 2017 09:28:00 +0000 (10:28 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Fri, 24 Feb 2017 10:01:01 +0000 (11:01 +0100)
If a group of items are enclosed in {}, then that will be a Python set,
which does not preserve order.  To preserve order, the data must be either
a tuple () or list [].

fdroidserver/common.py
tests/run-tests

index 5e0419b057bb6281170e7112b66d9b1746a99384..5321b7b63da2a0a0662e7a6dbde0e52d60654264 100644 (file)
@@ -221,6 +221,12 @@ def read_config(opts, config_file='config.py'):
         logging.critical("Missing config file - is this a repo directory?")
         sys.exit(2)
 
+    for k in ('mirrors', 'install_list', 'uninstall_list', 'serverwebroot', 'servergitroot'):
+        if k in config:
+            if not type(config[k]) in (str, list, tuple):
+                logging.warn('"' + k + '" will be in random order!'
+                             + ' Use () or [] brackets if order is important!')
+
     # smartcardoptions must be a list since its command line args for Popen
     if 'smartcardoptions' in config:
         config['smartcardoptions'] = config['smartcardoptions'].split(' ')
index 8a9b500abc6a7b1b1c30d3c2295dbd06715631a2..14dcfd1ab0ad1b41e2266c8a3e65e4ebab05e89e 100755 (executable)
@@ -131,7 +131,7 @@ cd $REPOROOT
 
 $fdroid init
 sed -i.tmp 's,^ *repo_description.*,repo_description = """获取已安装在您的设备上的应用的,' config.py
-echo "mirrors = {'https://foo.bar/fdroid', 'http://secret.onion/fdroid'}" >> config.py
+echo "mirrors = ('https://foo.bar/fdroid', 'http://secret.onion/fdroid')" >> config.py
 mkdir metadata
 cp $WORKSPACE/tests/urzip.apk repo/
 cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.txt metadata/