1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-20 13:50:12 +01:00

More config changes

* Add the remaining defaults
* Don't always check that dirs exist
* Better sample config
This commit is contained in:
Daniel Martí 2014-01-26 21:39:30 +01:00
parent d8fde9e855
commit fc2c1bb1a8
3 changed files with 19 additions and 23 deletions

View File

@ -1,5 +1,6 @@
sdk_path = "/home/vagrant/android-sdk" sdk_path = "/home/vagrant/android-sdk"
ndk_path = "/home/vagrant/android-ndk" ndk_path = "/home/vagrant/android-ndk"
build_tools = "19.0.1" build_tools = "19.0.1"
ant = "ant"
mvn3 = "mvn" mvn3 = "mvn"
gradle = "gradle" gradle = "gradle"

View File

@ -51,14 +51,17 @@ def read_config(opts, config_file='config.py'):
options.verbose = False options.verbose = False
defconfig = { defconfig = {
'build_server_always': False, 'sdk_path': "$ANDROID_HOME",
'ndk_path': "$ANDROID_NDK",
'build_tools': "19.0.1",
'ant': "ant",
'mvn3': "mvn", 'mvn3': "mvn",
'gradle': 'gradle', 'gradle': 'gradle',
'archive_older': 0, 'archive_older': 0,
'update_stats': False, 'update_stats': False,
'archive_older': 0,
'stats_to_carbon': False, 'stats_to_carbon': False,
'repo_maxage': 0, 'repo_maxage': 0,
'build_server_always': False,
'char_limits': { 'char_limits': {
'Summary' : 50, 'Summary' : 50,
'Description' : 1500 '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: 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) 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 # Expand environment variables
for k, v in config.items(): for k, v in config.items():
if type(v) != str: if type(v) != str:
@ -82,24 +89,6 @@ def read_config(opts, config_file='config.py'):
v = os.path.expanduser(v) v = os.path.expanduser(v)
config[k] = os.path.expandvars(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 return config
# Given the arguments in the form of multiple appid:[vc] strings, this returns # Given the arguments in the form of multiple appid:[vc] strings, this returns

View File

@ -15,10 +15,16 @@ ndk_path = "$ANDROID_NDK"
# Build tools version to be used # Build tools version to be used
build_tools = "19.0.1" build_tools = "19.0.1"
# Command for running maven 3 (command or full path) # Command for running Ant
mvn3 = "mvn3" #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" gradle = "gradle"
# Set the maximum age (in days) of an index that a client should accept from # Set the maximum age (in days) of an index that a client should accept from