chiark / gitweb /
Merge branch 'newcomers' into 'master'
authorHans-Christoph Steiner <hans@guardianproject.info>
Sat, 16 Sep 2017 08:07:56 +0000 (08:07 +0000)
committerHans-Christoph Steiner <hans@guardianproject.info>
Sat, 16 Sep 2017 08:07:56 +0000 (08:07 +0000)
allow starting without config.py

See merge request fdroid/fdroidserver!335

completion/bash-completion
fdroidserver/common.py
tests/run-tests

index dd1e5b29e3c8f9e6ca85bd8d084b2e68bcb2f9e5..22d5f74899aa7b3e1fb372323f77ff89eb86df91 100644 (file)
@@ -145,7 +145,7 @@ __complete_install() {
 
 __complete_update() {
        opts="-c -v -q -b -i -I -e -w"
-       lopts="--create-metadata --verbose --quiet --buildreport
+       lopts="--create-metadata --create-key --verbose --quiet --buildreport
  --interactive --icons --editor --wiki --pretty --clean --delete-unknown
  --nosign --rename-apks --use-date-from-apk"
        case "${prev}" in
index 815cf3eb7fd4f04af511fe4ee2ac9648e2eaa090..a39b671a7560685e5c091338f4f288cbe41b0d13 100644 (file)
@@ -239,8 +239,8 @@ def read_config(opts, config_file='config.py'):
         with io.open(config_file, "rb") as f:
             code = compile(f.read(), config_file, 'exec')
             exec(code, None, config)
-    elif len(get_local_metadata_files()) == 0:
-        raise FDroidException("Missing config file - is this a repo directory?")
+    else:
+        logging.debug("No config.py found - using defaults.")
 
     for k in ('mirrors', 'install_list', 'uninstall_list', 'serverwebroot', 'servergitroot'):
         if k in config:
@@ -2315,7 +2315,10 @@ def write_to_config(thisconfig, key, value=None, config_file=None):
         value = thisconfig[origkey] if origkey in thisconfig else thisconfig[key]
     cfg = config_file if config_file else 'config.py'
 
-    # load config file
+    # load config file, create one if it doesn't exist
+    if not os.path.exists(cfg):
+        os.mknod(cfg)
+        logging.info("Creating empty " + cfg)
     with open(cfg, 'r', encoding="utf-8") as f:
         lines = f.readlines()
 
index 2cfdc55aca866095eda78ed274e74c442412a5cd..608c1e2eec45a6322c430e6887a6769d89c7c369 100755 (executable)
@@ -185,7 +185,6 @@ echo_header 'copy git import and run `fdroid scanner` on it'
 
 REPOROOT=`create_test_dir`
 cd $REPOROOT
-touch config.py
 cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/
 mkdir metadata
 echo "Auto Name:Just A Test" > metadata/org.fdroid.ci.test.app.txt
@@ -526,7 +525,6 @@ echo_header "test metadata checks"
 REPOROOT=`create_test_dir`
 cd $REPOROOT
 
-touch config.py
 mkdir repo
 cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
 
@@ -828,7 +826,6 @@ echo_header "setup a new repo manually and generate a keystore"
 REPOROOT=`create_test_dir`
 KEYSTORE=$REPOROOT/keystore.jks
 cd $REPOROOT
-touch config.py
 cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/
 ! test -e $KEYSTORE
 set +e
@@ -895,7 +892,6 @@ echo_header "setup a new repo with no keystore, add APK, and update"
 REPOROOT=`create_test_dir`
 KEYSTORE=$REPOROOT/keystore.jks
 cd $REPOROOT
-touch config.py
 touch fdroid-icon.png
 mkdir repo
 cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/