Set up SDK and NDK env vars from python

No need to make the buildserver do it
This commit is contained in:
Daniel Martí 2014-07-01 21:03:50 +02:00
parent e8284225c9
commit 70d77a1cce
3 changed files with 14 additions and 14 deletions

View file

@ -8,12 +8,6 @@ execute "add-android-ndk-path" do
not_if "grep PATH-NDK /home/#{user}/.bsenv" not_if "grep PATH-NDK /home/#{user}/.bsenv"
end end
execute "add-android-ndk-var" do
user user
command "echo \"export ANDROID_NDK=#{ndk_loc}\" >> /home/#{user}/.bsenv"
not_if "grep ANDROID_NDK /home/#{user}/.bsenv"
end
script "setup-android-ndk" do script "setup-android-ndk" do
timeout 14400 timeout 14400
interpreter "bash" interpreter "bash"

View file

@ -23,12 +23,6 @@ execute "add-android-sdk-path" do
not_if "grep PATH-SDK /home/#{user}/.bsenv" not_if "grep PATH-SDK /home/#{user}/.bsenv"
end end
execute "add-android-home" do
user user
command "echo \"export ANDROID_HOME=#{sdk_loc}\" >> /home/#{user}/.bsenv"
not_if "grep ANDROID_HOME /home/#{user}/.bsenv"
end
script "add_build_tools" do script "add_build_tools" do
interpreter "bash" interpreter "bash"
user user user user

View file

@ -36,6 +36,7 @@ import metadata
config = None config = None
options = None options = None
env = None
def get_default_config(): def get_default_config():
@ -76,7 +77,7 @@ def read_config(opts, config_file='config.py'):
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 directory when
any of the repo management commands are used. any of the repo management commands are used.
""" """
global config, options global config, options, env
if config is not None: if config is not None:
return config return config
@ -124,6 +125,15 @@ def read_config(opts, config_file='config.py'):
if not test_build_tools_exists(config): if not test_build_tools_exists(config):
sys.exit(3) sys.exit(3)
env = os.environ
# There is no standard, so just set up the most common environment
# variables
for n in ['ANDROID_HOME', 'ANDROID_SDK', 'SDK']:
env[n] = config['sdk_path']
for n in ['ANDROID_NDK', 'NDK']:
env[n] = config['ndk_path']
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)
@ -1594,13 +1604,15 @@ def FDroidPopen(commands, cwd=None, shell=False, output=True):
:returns: A PopenResult. :returns: A PopenResult.
""" """
global env
if cwd: if cwd:
cwd = os.path.normpath(cwd) cwd = os.path.normpath(cwd)
logging.debug("Directory: %s" % cwd) logging.debug("Directory: %s" % cwd)
logging.debug("> %s" % ' '.join(commands)) logging.debug("> %s" % ' '.join(commands))
result = PopenResult() result = PopenResult()
p = subprocess.Popen(commands, cwd=cwd, shell=shell, p = subprocess.Popen(commands, cwd=cwd, shell=shell, env=env,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout_queue = Queue.Queue() stdout_queue = Queue.Queue()