mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 22:40:12 +01:00
log versions of all installed Android SDK/NDK components
Any variation in the Android tools used to build an APK can cause the build to be unreproducible. To help troubleshoot these times, this posts the installed versions of the Android SDK and NDK components to the lastbuild log, for the long term record. refs #148
This commit is contained in:
parent
2237b6f7d3
commit
ad2b9b99c2
@ -952,6 +952,40 @@ def trybuild(app, build, build_dir, output_dir, also_check_dir, srclib_dir, extl
|
||||
return True
|
||||
|
||||
|
||||
def get_android_tools_versions(sdk_path, ndk_path=None):
|
||||
'''get a list of the versions of all installed Android SDK/NDK components'''
|
||||
|
||||
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]))
|
||||
|
||||
pattern = re.compile('^Pkg.Revision=(.+)', re.MULTILINE)
|
||||
for root, dirs, files in os.walk(sdk_path):
|
||||
if 'source.properties' in files:
|
||||
source_properties = os.path.join(root, 'source.properties')
|
||||
with open(source_properties, 'r') as fp:
|
||||
m = pattern.search(fp.read())
|
||||
if m:
|
||||
components.append((root[len(sdk_path):], m.group(1)))
|
||||
|
||||
return components
|
||||
|
||||
|
||||
def get_android_tools_version_log(sdk_path, ndk_path):
|
||||
'''get a list of the versions of all installed Android SDK/NDK components'''
|
||||
log = ''
|
||||
components = get_android_tools_versions(sdk_path, ndk_path)
|
||||
for name, version in sorted(components):
|
||||
log += '* ' + name + ' (' + version + ')\n'
|
||||
|
||||
return log
|
||||
|
||||
|
||||
def parse_commandline():
|
||||
"""Parse the command line. Returns options, parser."""
|
||||
|
||||
@ -1099,6 +1133,8 @@ def main():
|
||||
|
||||
for build in app.builds:
|
||||
wikilog = None
|
||||
tools_version_log = '== Installed Android Tools ==\n\n'
|
||||
tools_version_log += get_android_tools_version_log(config['sdk_path'], build.ndk_path())
|
||||
try:
|
||||
|
||||
# For the first build of a particular app, we need to set up
|
||||
@ -1164,6 +1200,9 @@ def main():
|
||||
failed_apps[appid] = e
|
||||
wikilog = str(e)
|
||||
|
||||
if wikilog:
|
||||
wikilog = tools_version_log + '\n\n' + wikilog
|
||||
|
||||
if options.wiki and wikilog:
|
||||
try:
|
||||
# Write a page with the last build log for this version code
|
||||
|
Loading…
Reference in New Issue
Block a user