mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-20 13:50:12 +01:00
make get_android_tools_versions() search ndk_paths from config
This commit is contained in:
parent
7a1d236c8d
commit
09fa49a7a3
@ -237,7 +237,7 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
|
||||
try:
|
||||
cmd_stdout = chan.makefile('rb', 1024)
|
||||
output = bytes()
|
||||
output += common.get_android_tools_version_log(build.ndk_path()).encode()
|
||||
output += common.get_android_tools_version_log().encode()
|
||||
while not chan.exit_status_ready():
|
||||
line = cmd_stdout.readline()
|
||||
if line:
|
||||
@ -402,7 +402,7 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext
|
||||
log_path = os.path.join(log_dir,
|
||||
common.get_toolsversion_logname(app, build))
|
||||
with open(log_path, 'w') as f:
|
||||
f.write(common.get_android_tools_version_log(build.ndk_path()))
|
||||
f.write(common.get_android_tools_version_log())
|
||||
else:
|
||||
if build.sudo:
|
||||
logging.warning('%s:%s runs this on the buildserver with sudo:\n\t%s\nThese commands were skipped because fdroid build is not running on a dedicated build server.'
|
||||
@ -1088,7 +1088,7 @@ def main():
|
||||
build_starttime = common.get_wiki_timestamp()
|
||||
tools_version_log = ''
|
||||
if not options.onserver:
|
||||
tools_version_log = common.get_android_tools_version_log(build.ndk_path())
|
||||
tools_version_log = common.get_android_tools_version_log()
|
||||
common.write_running_status_json(status_output)
|
||||
try:
|
||||
|
||||
|
@ -3872,7 +3872,7 @@ def get_wiki_timestamp(timestamp=None):
|
||||
return time.strftime("%Y-%m-%d %H:%M:%SZ", timestamp)
|
||||
|
||||
|
||||
def get_android_tools_versions(ndk_path=None):
|
||||
def get_android_tools_versions():
|
||||
'''get a list of the versions of all installed Android SDK/NDK components'''
|
||||
|
||||
global config
|
||||
@ -3880,11 +3880,9 @@ def get_android_tools_versions(ndk_path=None):
|
||||
if sdk_path[-1] != '/':
|
||||
sdk_path += '/'
|
||||
components = []
|
||||
if ndk_path:
|
||||
ndk_release_txt = os.path.join(ndk_path, 'RELEASE.TXT')
|
||||
if os.path.isfile(ndk_release_txt):
|
||||
with open(ndk_release_txt, 'r') as fp:
|
||||
components.append((os.path.basename(ndk_path), fp.read()[:-1]))
|
||||
for ndk_path in config.get('ndk_paths', []):
|
||||
version = get_ndk_version(ndk_path)
|
||||
components.append((os.path.basename(ndk_path), str(version)))
|
||||
|
||||
pattern = re.compile(r'^Pkg.Revision *= *(.+)', re.MULTILINE)
|
||||
for root, dirs, files in os.walk(sdk_path):
|
||||
@ -3898,10 +3896,10 @@ def get_android_tools_versions(ndk_path=None):
|
||||
return components
|
||||
|
||||
|
||||
def get_android_tools_version_log(ndk_path=None):
|
||||
def get_android_tools_version_log():
|
||||
'''get a list of the versions of all installed Android SDK/NDK components'''
|
||||
log = '== Installed Android Tools ==\n\n'
|
||||
components = get_android_tools_versions(ndk_path)
|
||||
components = get_android_tools_versions()
|
||||
for name, version in sorted(components):
|
||||
log += '* ' + name + ' (' + version + ')\n'
|
||||
|
||||
|
@ -362,7 +362,7 @@ class BuildTest(unittest.TestCase):
|
||||
with mock.patch(
|
||||
'fdroidserver.common.force_exit', lambda *args: None
|
||||
) as a, mock.patch(
|
||||
'fdroidserver.common.get_android_tools_version_log', lambda s: 'fake'
|
||||
'fdroidserver.common.get_android_tools_version_log', lambda: 'fake'
|
||||
) as b, mock.patch(
|
||||
'fdroidserver.common.FDroidPopen', FakeProcess
|
||||
) as c, mock.patch(
|
||||
|
Loading…
Reference in New Issue
Block a user