mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
do not require if config.py if using local metadata
Since you can have a .fdroid.* metadata file included directly in an app's git repo, it seems annoying to force developers to also include a blank config.py in order to run `fdroid build` from their git repo. The next step after this is some kind of global config file for setting paths and things that need to be customized that would apply to all git repos, for example, to enable using a buildserver. This also required moving all of the env setting for FDroidPopen into a single place so that it is properly setup when using the local metadata.
This commit is contained in:
parent
3768d7a4d6
commit
3e6b263c8e
1 changed files with 25 additions and 23 deletions
|
@ -194,25 +194,29 @@ def regsub_file(pattern, repl, path):
|
||||||
def read_config(opts, config_file='config.py'):
|
def read_config(opts, config_file='config.py'):
|
||||||
"""Read the repository config
|
"""Read the repository config
|
||||||
|
|
||||||
The config is read from config_file, which is in the current directory when
|
The config is read from config_file, which is in the current
|
||||||
any of the repo management commands are used.
|
directory when any of the repo management commands are used. If
|
||||||
|
there is a local metadata file in the git repo, then config.py is
|
||||||
|
not required, just use defaults.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
global config, options, orig_path
|
global config, options
|
||||||
|
|
||||||
if config is not None:
|
if config is not None:
|
||||||
return config
|
return config
|
||||||
if not os.path.isfile(config_file):
|
|
||||||
logging.critical("Missing config file - is this a repo directory?")
|
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
options = opts
|
options = opts
|
||||||
|
|
||||||
config = {}
|
config = {}
|
||||||
|
|
||||||
logging.debug("Reading %s" % config_file)
|
if os.path.isfile(config_file):
|
||||||
with io.open(config_file, "rb") as f:
|
logging.debug("Reading %s" % config_file)
|
||||||
code = compile(f.read(), config_file, 'exec')
|
with io.open(config_file, "rb") as f:
|
||||||
exec(code, None, config)
|
code = compile(f.read(), config_file, 'exec')
|
||||||
|
exec(code, None, config)
|
||||||
|
elif len(glob.glob('.fdroid.[a-z]*')) == 0:
|
||||||
|
logging.critical("Missing config file - is this a repo directory?")
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
# smartcardoptions must be a list since its command line args for Popen
|
# smartcardoptions must be a list since its command line args for Popen
|
||||||
if 'smartcardoptions' in config:
|
if 'smartcardoptions' in config:
|
||||||
|
@ -231,16 +235,6 @@ def read_config(opts, config_file='config.py'):
|
||||||
|
|
||||||
fill_config_defaults(config)
|
fill_config_defaults(config)
|
||||||
|
|
||||||
# There is no standard, so just set up the most common environment
|
|
||||||
# variables
|
|
||||||
env = os.environ
|
|
||||||
orig_path = env['PATH']
|
|
||||||
for n in ['ANDROID_HOME', 'ANDROID_SDK']:
|
|
||||||
env[n] = config['sdk_path']
|
|
||||||
|
|
||||||
for k, v in config['java_paths'].items():
|
|
||||||
env['JAVA%s_HOME' % k] = v
|
|
||||||
|
|
||||||
for k in ["keystorepass", "keypass"]:
|
for k in ["keystorepass", "keypass"]:
|
||||||
if k in config:
|
if k in config:
|
||||||
write_password_file(k)
|
write_password_file(k)
|
||||||
|
@ -1798,16 +1792,24 @@ def remove_signing_keys(build_dir):
|
||||||
|
|
||||||
|
|
||||||
def set_FDroidPopen_env(build=None):
|
def set_FDroidPopen_env(build=None):
|
||||||
# There is only a weak standard, the variables used by gradle, so also set
|
'''
|
||||||
# up the most commonly used environment variables for SDK and NDK
|
set up the environment variables for the build environment
|
||||||
|
|
||||||
|
There is only a weak standard, the variables used by gradle, so also set
|
||||||
|
up the most commonly used environment variables for SDK and NDK
|
||||||
|
'''
|
||||||
global env, orig_path
|
global env, orig_path
|
||||||
|
|
||||||
if env is None:
|
if env is None:
|
||||||
env = os.environ
|
env = os.environ
|
||||||
orig_path = env['PATH']
|
orig_path = env['PATH']
|
||||||
for n in ['ANDROID_HOME', 'ANDROID_SDK']:
|
for n in ['ANDROID_HOME', 'ANDROID_SDK']:
|
||||||
env[n] = config['sdk_path']
|
env[n] = config['sdk_path']
|
||||||
|
for k, v in config['java_paths'].items():
|
||||||
|
env['JAVA%s_HOME' % k] = v
|
||||||
|
|
||||||
# Set up environment vars that depend on each build
|
# Set up environment vars that depend on each build, only set the
|
||||||
|
# NDK env vars if the NDK is not already in the PATH
|
||||||
if build is not None:
|
if build is not None:
|
||||||
path = build.ndk_path()
|
path = build.ndk_path()
|
||||||
paths = orig_path.split(os.pathsep)
|
paths = orig_path.split(os.pathsep)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue