diff --git a/buildserver/cookbooks/android-ndk/recipes/default.rb b/buildserver/cookbooks/android-ndk/recipes/default.rb index 13e64d48..460b4fc4 100644 --- a/buildserver/cookbooks/android-ndk/recipes/default.rb +++ b/buildserver/cookbooks/android-ndk/recipes/default.rb @@ -8,12 +8,6 @@ execute "add-android-ndk-path" do not_if "grep PATH-NDK /home/#{user}/.bsenv" 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 timeout 14400 interpreter "bash" diff --git a/buildserver/cookbooks/android-sdk/recipes/default.rb b/buildserver/cookbooks/android-sdk/recipes/default.rb index 0c925c2c..3d6ff562 100644 --- a/buildserver/cookbooks/android-sdk/recipes/default.rb +++ b/buildserver/cookbooks/android-sdk/recipes/default.rb @@ -23,12 +23,6 @@ execute "add-android-sdk-path" do not_if "grep PATH-SDK /home/#{user}/.bsenv" 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 interpreter "bash" user user diff --git a/fdroidserver/common.py b/fdroidserver/common.py index e80613d1..a0aeb982 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -36,6 +36,7 @@ import metadata config = None options = None +env = None 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 any of the repo management commands are used. """ - global config, options + global config, options, env if config is not None: return config @@ -124,6 +125,15 @@ def read_config(opts, config_file='config.py'): if not test_build_tools_exists(config): 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"]: if k in config: write_password_file(k) @@ -1594,13 +1604,15 @@ def FDroidPopen(commands, cwd=None, shell=False, output=True): :returns: A PopenResult. """ + global env + if cwd: cwd = os.path.normpath(cwd) logging.debug("Directory: %s" % cwd) logging.debug("> %s" % ' '.join(commands)) 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_queue = Queue.Queue()