From de1afc3c7eeb02a5237cd2826314cb663ef5d07d Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 14 Sep 2017 02:03:43 +0200 Subject: [PATCH 1/4] bash_completion: add update --create-key option --- completion/bash-completion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completion/bash-completion b/completion/bash-completion index dd1e5b29..22d5f748 100644 --- a/completion/bash-completion +++ b/completion/bash-completion @@ -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 From feadc6a565aa4226df38d52e970ecb2382407725 Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 14 Sep 2017 02:13:49 +0200 Subject: [PATCH 2/4] make sure config exists before writing to it --- fdroidserver/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 182949d9..fe0462c7 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -2314,7 +2314,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() From 190a2fde814eaa0e00fb0447df521bc241ee3f54 Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Tue, 12 Sep 2017 16:21:29 +0200 Subject: [PATCH 3/4] common: allow starting without a config file There is no reason this should be disallowed as the default config often works well when building simple apps. --- fdroidserver/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index fe0462c7..6e4e5d8d 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -238,8 +238,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: From 34f79b876ca6108b0d9a12d9a5d9eaf3bb49bebe Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 14 Sep 2017 02:14:26 +0200 Subject: [PATCH 4/4] tests: don't touch config.py, no config is fine now --- tests/run-tests | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/run-tests b/tests/run-tests index 2cfdc55a..608c1e2e 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -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/