From fc2c1bb1a87c944e6df7f08098ee957286639725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sun, 26 Jan 2014 21:39:30 +0100 Subject: [PATCH] More config changes * Add the remaining defaults * Don't always check that dirs exist * Better sample config --- config.buildserver.py | 1 + fdroidserver/common.py | 29 +++++++++-------------------- sampleconfigs/config.sample.py | 12 +++++++++--- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/config.buildserver.py b/config.buildserver.py index 152a46e8..4de4aeca 100644 --- a/config.buildserver.py +++ b/config.buildserver.py @@ -1,5 +1,6 @@ sdk_path = "/home/vagrant/android-sdk" ndk_path = "/home/vagrant/android-ndk" build_tools = "19.0.1" +ant = "ant" mvn3 = "mvn" gradle = "gradle" diff --git a/fdroidserver/common.py b/fdroidserver/common.py index e6997e38..4e4322c0 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -51,14 +51,17 @@ def read_config(opts, config_file='config.py'): options.verbose = False defconfig = { - 'build_server_always': False, + 'sdk_path': "$ANDROID_HOME", + 'ndk_path': "$ANDROID_NDK", + 'build_tools': "19.0.1", + 'ant': "ant", 'mvn3': "mvn", 'gradle': 'gradle', 'archive_older': 0, 'update_stats': False, - 'archive_older': 0, 'stats_to_carbon': False, 'repo_maxage': 0, + 'build_server_always': False, 'char_limits': { 'Summary' : 50, 'Description' : 1500 @@ -75,6 +78,10 @@ def read_config(opts, config_file='config.py'): if st.st_mode & stat.S_IRWXG or st.st_mode & stat.S_IRWXO: print "WARNING: unsafe permissions on {0} (should be 0600)!".format(config_file) + for k, v in defconfig.items(): + if k not in config: + config[k] = v + # Expand environment variables for k, v in config.items(): if type(v) != str: @@ -82,24 +89,6 @@ def read_config(opts, config_file='config.py'): v = os.path.expanduser(v) config[k] = os.path.expandvars(v) - # Check that directories exist - for key in ('sdk_path', 'ndk_path', 'build_tools'): - if key not in config: - continue - val = config[key] - if key == 'build_tools': - if 'sdk_path' not in config: - print "ERROR: sdk_path needs to be set for build_tools" - sys.exit(3) - val = os.path.join(config['sdk_path'], 'build-tools', val) - if not os.path.isdir(val): - print "ERROR: No such directory found for %s: %s" % (key, val) - sys.exit(3) - - for k, v in defconfig.items(): - if k not in config: - config[k] = v - return config # Given the arguments in the form of multiple appid:[vc] strings, this returns diff --git a/sampleconfigs/config.sample.py b/sampleconfigs/config.sample.py index d352fa02..af611446 100644 --- a/sampleconfigs/config.sample.py +++ b/sampleconfigs/config.sample.py @@ -15,10 +15,16 @@ ndk_path = "$ANDROID_NDK" # Build tools version to be used build_tools = "19.0.1" -# Command for running maven 3 (command or full path) -mvn3 = "mvn3" +# Command for running Ant +#ant = "/path/to/ant" +ant = "ant" -# Command for running Gradle (command or full path) +# Command for running maven 3 +#mvn3 = "/path/to/mvn" +mvn3 = "mvn" + +# Command for running Gradle +#gradle = "/path/to/gradle" gradle = "gradle" # Set the maximum age (in days) of an index that a client should accept from