Merge branch 'newcomers' into 'master'

allow starting without config.py

See merge request fdroid/fdroidserver!335
This commit is contained in:
Hans-Christoph Steiner 2017-09-16 08:07:56 +00:00
commit acac15f74d
3 changed files with 7 additions and 8 deletions

View 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

View 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()

View File

@ -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/