1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-20 13:50:12 +01:00

Merge branch 'build-log-data-points' into 'master'

add data points to the build log to add debugging

See merge request fdroid/fdroidserver!429
This commit is contained in:
Hans-Christoph Steiner 2018-01-03 14:39:23 +00:00
commit 4aaf82c34c
3 changed files with 16 additions and 5 deletions

View File

@ -105,6 +105,7 @@ fedora_latest:
- wget --no-verbose -O tools.zip https://dl.google.com/android/repository/tools_r25.2.4-linux.zip - wget --no-verbose -O tools.zip https://dl.google.com/android/repository/tools_r25.2.4-linux.zip
- unzip -q tools.zip - unzip -q tools.zip
- rm tools.zip - rm tools.zip
- export AAPT_VERSION=`sed -n "s,^MINIMUM_AAPT_VERSION\s*=\s*['\"]\(.*\)[['\"],\1,p" fdroidserver/common.py`
- export ANDROID_HOME=`pwd`/android-sdk - export ANDROID_HOME=`pwd`/android-sdk
- mkdir $ANDROID_HOME - mkdir $ANDROID_HOME
- mv tools $ANDROID_HOME/ - mv tools $ANDROID_HOME/
@ -115,7 +116,7 @@ fedora_latest:
- mkdir ~/.android - mkdir ~/.android
- touch ~/.android/repositories.cfg - touch ~/.android/repositories.cfg
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "platform-tools" - echo y | $ANDROID_HOME/tools/bin/sdkmanager "platform-tools"
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;26.0.2" - echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;$AAPT_VERSION"
- chown -R testuser . - chown -R testuser .
- cd tests - cd tests
- su testuser --login --command - su testuser --login --command

View File

@ -65,12 +65,13 @@ install:
fi; fi;
brew cask install android-sdk; brew cask install android-sdk;
export AAPT_VERSION=`sed -n "s,^MINIMUM_AAPT_VERSION\s*=\s*['\"]\(.*\)[['\"],\1,p" fdroidserver/common.py`;
mkdir -p "$ANDROID_HOME/licenses"; mkdir -p "$ANDROID_HOME/licenses";
echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"; echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license";
echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e" >> "$ANDROID_HOME/licenses/android-sdk-license"; echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e" >> "$ANDROID_HOME/licenses/android-sdk-license";
echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"; echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license";
echo y | $ANDROID_HOME/tools/bin/sdkmanager "platform-tools"; echo y | $ANDROID_HOME/tools/bin/sdkmanager "platform-tools";
echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;25.0.2"; echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;$AAPT_VERSION";
echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-23"; echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-23";
sudo pip3 install babel; sudo pip3 install babel;

View File

@ -79,6 +79,7 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
buildserverid = subprocess.check_output(['vagrant', 'ssh', '-c', buildserverid = subprocess.check_output(['vagrant', 'ssh', '-c',
'cat /home/vagrant/buildserverid'], 'cat /home/vagrant/buildserverid'],
cwd='builder').rstrip() cwd='builder').rstrip()
logging.debug(_('Fetched buildserverid from VM: ') + buildserverid)
# Open SSH connection... # Open SSH connection...
logging.info("Connecting to virtual machine...") logging.info("Connecting to virtual machine...")
@ -288,6 +289,10 @@ def force_gradle_build_tools(build_dir, build_tools):
path) path)
def _get_build_timestamp():
return time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime())
def transform_first_char(string, method): def transform_first_char(string, method):
"""Uses method() on the first character of string.""" """Uses method() on the first character of string."""
if len(string) == 0: if len(string) == 0:
@ -1055,6 +1060,7 @@ def parse_commandline():
options = None options = None
config = None config = None
buildserverid = None buildserverid = None
starttime = _get_build_timestamp()
def main(): def main():
@ -1174,6 +1180,7 @@ def main():
for build in app.builds: for build in app.builds:
wikilog = None wikilog = None
build_starttime = _get_build_timestamp()
tools_version_log = '' tools_version_log = ''
if not options.onserver: if not options.onserver:
tools_version_log = get_android_tools_version_log(build.ndk_path()) tools_version_log = get_android_tools_version_log(build.ndk_path())
@ -1270,7 +1277,7 @@ def main():
f.write('versionCode: %s\nversionName: %s\ncommit: %s\n' % f.write('versionCode: %s\nversionName: %s\ncommit: %s\n' %
(build.versionCode, build.versionName, build.commit)) (build.versionCode, build.versionName, build.commit))
f.write('Build completed at ' f.write('Build completed at '
+ time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime()) + '\n') + _get_build_timestamp() + '\n')
f.write('\n' + tools_version_log + '\n') f.write('\n' + tools_version_log + '\n')
f.write(str(e)) f.write(str(e))
logging.error("Could not build app %s: %s" % (appid, e)) logging.error("Could not build app %s: %s" % (appid, e))
@ -1295,10 +1302,12 @@ def main():
newpage = site.Pages[lastbuildpage] newpage = site.Pages[lastbuildpage]
with open(os.path.join('tmp', 'fdroidserverid')) as fp: with open(os.path.join('tmp', 'fdroidserverid')) as fp:
fdroidserverid = fp.read().rstrip() fdroidserverid = fp.read().rstrip()
txt = "* build completed at " + time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime()) + '\n' \ txt = "* build session started at " + starttime + '\n' \
+ "* this build started at " + build_starttime + '\n' \
+ "* this build completed at " + _get_build_timestamp() + '\n' \
+ '* fdroidserverid: [https://gitlab.com/fdroid/fdroidserver/commit/' \ + '* fdroidserverid: [https://gitlab.com/fdroid/fdroidserver/commit/' \
+ fdroidserverid + ' ' + fdroidserverid + ']\n\n' + fdroidserverid + ' ' + fdroidserverid + ']\n\n'
if options.onserver: if buildserverid:
txt += '* buildserverid: [https://gitlab.com/fdroid/fdroidserver/commit/' \ txt += '* buildserverid: [https://gitlab.com/fdroid/fdroidserver/commit/' \
+ buildserverid + ' ' + buildserverid + ']\n\n' + buildserverid + ' ' + buildserverid + ']\n\n'
txt += tools_version_log + '\n\n' txt += tools_version_log + '\n\n'