summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-04-06 17:34:51 +0200
committerHolger Levsen <holger@layer-acht.org>2015-04-18 17:59:47 +0200
commit25549ac6a98046538713f78a494e0d9063e3bdf8 (patch)
tree502c49a392e15c2da587f1246492733c5a810090
parentcec503e5c0155ed61527f1081829c5c6314008a4 (diff)
downloadjenkins.debian.net-25549ac6a98046538713f78a494e0d9063e3bdf8.tar.xz
reproducible: build: refactor: strip out save_artifats() from cleanup_all(), and rewrite it all
-rwxr-xr-xbin/reproducible_build.sh32
1 files changed, 18 insertions, 14 deletions
diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index 16999869..52aa83bc 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -29,29 +29,33 @@ create_results_dirs() {
mkdir -p /var/lib/jenkins/userContent/buildinfo/${SUITE}/${ARCH}
}
-cleanup_all() {
- if [ $SAVE_ARTIFACTS -eq 1 ] || [ $SAVE_ARTIFACTS -eq 3 ] ; then
+save_artifacts() {
local random=$(head /dev/urandom | tr -cd '[:alnum:]'| head -c5)
local ARTIFACTS="artifacts/r00t-me/${SRCPACKAGE}_${SUITE}_tmp-${random}"
+ local URL="$REPRODUCIBLE_URL/$ARTIFACTS/"
+ local HEADER="$ARTIFACTS/.HEADER.html"
mkdir -p /var/lib/jenkins/userContent/$ARTIFACTS
cp -r $TMPDIR/* /var/lib/jenkins/userContent/$ARTIFACTS/
echo | tee -a ${RBUILDLOG}
- echo "Artifacts from this build are preserved. They will be available for 72h only, so download them now if you want them." | tee -a ${RBUILDLOG}
- echo "WARNING: You shouldn't trust packages you downloaded from this host, they can contain malware or the worst of your fears, packaged nicely in debian format." | tee -a ${RBUILDLOG}
- echo "If you are not afraid facing your fears while helping the world by investigating reproducible build issues, you can download the artifacts from the following location:" | tee -a ${RBUILDLOG}
- URL="https://reproducible.debian.net/$ARTIFACTS/"
- TMPFILE=$(mktemp)
- curl $URL > $TMPFILE 2>/dev/null
- sed -i "s#</table>#<tr><td colspan=\"5\"><a href=\"$REPRODUCIBLE_URL/${SUITE}/${ARCH}/${SRCPACKAGE}\">$REPRODUCIBLE_URL/${SUITE}/${ARCH}/${SRCPACKAGE}</a></td></tr></table>#g" $TMPFILE
- chmod 644 $TMPFILE
- mv $TMPFILE /var/lib/jenkins/userContent/$ARTIFACTS/index.html
- echo "$URL" | tee -a ${RBUILDLOG}
+ local msg="Artifacts from this build are preserved. They will be available for 72h only, so download them now if you want them.\n"
+ local msg="WARNING: You shouldn't trust packages you downloaded from this host, they can contain malware or the worst of your fears, packaged nicely in debian format.\n"
+ local msg="If you are not afraid facing your fears while helping the world by investigating reproducible build issues, you can download the artifacts from the following location: $URL\n"
+ echo $msg | tee -a $BUILDLOG
+ echo $msg | sed 's#\n#\n<br />#g' > $HEADER
+ echo "Package page: <a href=\"$REPRODUCIBLE_URL/${SUITE}/${ARCH}/${SRCPACKAGE}\">$REPRODUCIBLE_URL/${SUITE}/${ARCH}/${SRCPACKAGE}</a><br />" >> $HEADER
+ chmod 644 $HEADER
echo | tee -a ${RBUILDLOG}
- MESSAGE="$URL published"
+ # irc message
+ local MESSAGE="$URL published"
if [ $SAVE_ARTIFACTS -eq 3 ] ; then
- MESSAGE="$MESSAGE, $DBDVERSION had troubles with these..."
+ local MESSAGE="$MESSAGE, $DBDVERSION had troubles with these..."
fi
irc_message "$MESSAGE"
+}
+
+cleanup_all() {
+ if [ $SAVE_ARTIFACTS -eq 1 ] || [ $SAVE_ARTIFACTS -eq 3 ] ; then
+ save_artifacts
elif [ $SAVE_ARTIFACTS -eq 2 ] ; then
echo "No artifacts were saved for this build." | tee -a ${RBUILDLOG}
irc_message "Check $REPRODUCIBLE_URL/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_${EVERSION}.rbuild.log to find out why no artifacts were saved."