[Qa-jenkins-scm] [jenkins.debian.net] 03/03: reproducible: sed everything to use that $BASE variable instead of hardcoding /var/lib/jenkins/userContent (that's about to change rather soon)

Holger Levsen holger at moszumanska.debian.org
Wed Apr 29 07:58:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit ed915317fcd79b719330d77f98e8378e27334636
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Tue Apr 28 23:22:14 2015 +0200

    reproducible: sed everything to use that $BASE variable instead of hardcoding /var/lib/jenkins/userContent (that's about to change rather soon)
---
 bin/reproducible_build.sh       | 23 +++++++++++------------
 bin/reproducible_common.sh      |  4 ++--
 bin/reproducible_html_graphs.sh | 22 +++++++++++-----------
 bin/reproducible_maintenance.sh | 12 ++++++------
 4 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index 56c220e..e6e4557 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -25,9 +25,9 @@ irc_message() {
 }
 
 create_results_dirs() {
-	mkdir -p /var/lib/jenkins/userContent/dbd/${SUITE}/${ARCH}
-	mkdir -p /var/lib/jenkins/userContent/rbuild/${SUITE}/${ARCH}
-	mkdir -p /var/lib/jenkins/userContent/buildinfo/${SUITE}/${ARCH}
+	mkdir -p $BASE/dbd/${SUITE}/${ARCH}
+	mkdir -p $BASE/rbuild/${SUITE}/${ARCH}
+	mkdir -p $BASE/buildinfo/${SUITE}/${ARCH}
 }
 
 handle_race_condition() {
@@ -64,7 +64,6 @@ check_for_race_conditions() {
 
 save_artifacts() {
 		local random=$(head /dev/urandom | tr -cd '[:alnum:]'| head -c5)
-		local BASE="/var/lib/jenkins/userContent"
 		local ARTIFACTS="artifacts/r00t-me/${SRCPACKAGE}_${SUITE}_tmp-${random}"
 		local URL="$REPRODUCIBLE_URL/$ARTIFACTS/"
 		local HEADER="$BASE/$ARTIFACTS/.HEADER.html"
@@ -104,9 +103,9 @@ cleanup_all() {
 }
 
 cleanup_userContent() {
-	rm -f /var/lib/jenkins/userContent/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_*.rbuild.log > /dev/null 2>&1
-	rm -f /var/lib/jenkins/userContent/dbd/${SUITE}/${ARCH}/${SRCPACKAGE}_*.debbindiff.html > /dev/null 2>&1
-	rm -f /var/lib/jenkins/userContent/buildinfo/${SUITE}/${ARCH}/${SRCPACKAGE}_*.buildinfo > /dev/null 2>&1
+	rm -f $BASE/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_*.rbuild.log > /dev/null 2>&1
+	rm -f $BASE/dbd/${SUITE}/${ARCH}/${SRCPACKAGE}_*.debbindiff.html > /dev/null 2>&1
+	rm -f $BASE/buildinfo/${SUITE}/${ARCH}/${SRCPACKAGE}_*.buildinfo > /dev/null 2>&1
 }
 
 calculate_build_duration() {
@@ -173,12 +172,12 @@ handle_ftbr() {
 	local FTBRmessage="$@"
 	echo | tee -a ${RBUILDLOG}
 	echo "$(date) - ${SRCPACKAGE} failed to build reproducibly in ${SUITE} on ${ARCH}." | tee -a ${RBUILDLOG}
-	cp b1/${BUILDINFO} /var/lib/jenkins/userContent/buildinfo/${SUITE}/${ARCH}/ > /dev/null 2>&1 || true  # will fail if there is no .buildinfo
+	cp b1/${BUILDINFO} $BASE/buildinfo/${SUITE}/${ARCH}/ > /dev/null 2>&1 || true  # will fail if there is no .buildinfo
 	if [ ! -z "$FTRmessage" ] ; then
 		echo "$(date) - ${FTBRmessage}." | tee -a ${RBUILDLOG}
 	fi
 	if [ -f ./${DBDREPORT} ] ; then
-		mv ./${DBDREPORT} /var/lib/jenkins/userContent/dbd/${SUITE}/${ARCH}/
+		mv ./${DBDREPORT} $BASE/dbd/${SUITE}/${ARCH}/
 	else
 		echo "$(date) - $DBDVERSION produced no output (which is strange)." | tee -a $RBUILDLOG
 	fi
@@ -195,7 +194,7 @@ handle_ftbr() {
 
 handle_reproducible() {
 	if [ ! -f ./${DBDREPORT} ] && [ -f b1/${BUILDINFO} ] ; then
-		cp b1/${BUILDINFO} /var/lib/jenkins/userContent/buildinfo/${SUITE}/${ARCH}/ > /dev/null 2>&1
+		cp b1/${BUILDINFO} $BASE/buildinfo/${SUITE}/${ARCH}/ > /dev/null 2>&1
 		figlet ${SRCPACKAGE}
 		echo | tee -a ${RBUILDLOG}
 		echo "$DBDVERSION found no differences in the changes files, and a .buildinfo file also exists." | tee -a ${RBUILDLOG}
@@ -416,8 +415,8 @@ build_rebuild() {
 	fi
 	cleanup_userContent
 	chmod 644 $RBUILDLOG
-	mv $RBUILDLOG /var/lib/jenkins/userContent/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_${EVERSION}.rbuild.log
-	RBUILDLOG=/var/lib/jenkins/userContent/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_${EVERSION}.rbuild.log
+	mv $RBUILDLOG $BASE/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_${EVERSION}.rbuild.log
+	RBUILDLOG=$BASE/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_${EVERSION}.rbuild.log
 	rm $TMPCFG
 	if [ $FTBFS -eq 1 ] ; then handle_ftbfs ; fi
 }
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index 8f3e518..f1f87f8 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -236,13 +236,13 @@ write_page_meta_sign() {
 publish_page() {
 	if [ "$1" = "" ] ; then
 		if [ "$VIEW" = "$MAINVIEW" ] ; then
-			cp $PAGE /var/lib/jenkins/userContent/reproducible.html
+			cp $PAGE $BASE/reproducible.html
 		fi
 		TARGET=$PAGE
 	else
 		TARGET=$1/$PAGE
 	fi
-	cp $PAGE /var/lib/jenkins/userContent/$TARGET
+	cp $PAGE $BASE/$TARGET
 	rm $PAGE
 	echo "Enjoy $REPRODUCIBLE_URL/$TARGET"
 }
diff --git a/bin/reproducible_html_graphs.sh b/bin/reproducible_html_graphs.sh
index a132f2b..4813511 100755
--- a/bin/reproducible_html_graphs.sh
+++ b/bin/reproducible_html_graphs.sh
@@ -112,9 +112,9 @@ update_suite_stats() {
 				PREFIX=$SUITE
 			fi
 			# force regeneration of the image if it exists
-			if [ -f /var/lib/jenkins/userContent/$PREFIX/${TABLE[$i]}.png ] ; then
+			if [ -f $BASE/$PREFIX/${TABLE[$i]}.png ] ; then
 				echo "Touching $PREFIX/${TABLE[$i]}.png..."
-				touch -d "$FORCE_DATE 00:00" /var/lib/jenkins/userContent/$PREFIX/${TABLE[$i]}.png
+				touch -d "$FORCE_DATE 00:00" $BASE/$PREFIX/${TABLE[$i]}.png
 			fi
 		done
 	fi
@@ -223,7 +223,7 @@ update_meta_pkg_stats() {
 				echo "Updating meta pkg set stats for ${META_PKGSET[$1]} in $SUITE on $DATE."
 			fi
 			echo "Touching $SUITE/$ARCH/${TABLE[6]}_${META_PKGSET[$i]}.png..."
-			touch -d "$FORCE_DATE 00:00" /var/lib/jenkins/userContent/$SUITE/$ARCH/${TABLE[6]}_${META_PKGSET[$i]}.png
+			touch -d "$FORCE_DATE 00:00" $BASE/$SUITE/$ARCH/${TABLE[6]}_${META_PKGSET[$i]}.png
 		fi
 	done
 }
@@ -256,9 +256,9 @@ update_bug_stats() {
 		sqlite3 -init ${INIT} ${PACKAGES_DB} "$SQL"
 		# force regeneration of the image
 		echo "Touching ${TABLE[3]}.png..."
-		touch -d "$FORCE_DATE 00:00" /var/lib/jenkins/userContent/${TABLE[3]}.png
+		touch -d "$FORCE_DATE 00:00" $BASE/${TABLE[3]}.png
 		echo "Touching ${TABLE[7]}.png..."
-		touch -d "$FORCE_DATE 00:00" /var/lib/jenkins/userContent/${TABLE[7]}.png
+		touch -d "$FORCE_DATE 00:00" $BASE/${TABLE[7]}.png
 	fi
 }
 
@@ -311,7 +311,7 @@ create_png_from_table() {
 		mkdir -p $DIR
 		echo "Generating $2."
 		/srv/jenkins/bin/make_graph.py ${TABLE[$1]}.csv $2 ${COLOR[$1]} "${MAINLABEL[$1]}" "${YLABEL[$1]}"
-		mv $2 /var/lib/jenkins/userContent/$DIR
+		mv $2 $BASE/$DIR
 		[ "$DIR" = "." ] || rmdir $(dirname $2)
 	fi
 	rm ${TABLE[$1]}.csv
@@ -388,7 +388,7 @@ create_suite_stats_page() {
 	write_page " <a href=\"/userContent/$SUITE/${TABLE[0]}.png\"><img src=\"/userContent/$SUITE/${TABLE[0]}.png\" alt=\"${MAINLABEL[0]}\"></a>"
 	for i in 0 2 ; do
 		# recreate png once a day
-		if [ ! -f /var/lib/jenkins/userContent/$SUITE/${TABLE[$i]}.png ] || [ ! -z $(find /var/lib/jenkins/userContent/$SUITE -maxdepth 1 -mtime +0 -name ${TABLE[$i]}.png) ] ; then
+		if [ ! -f $BASE/$SUITE/${TABLE[$i]}.png ] || [ ! -z $(find $BASE/$SUITE -maxdepth 1 -mtime +0 -name ${TABLE[$i]}.png) ] ; then
 			create_png_from_table $i $SUITE/${TABLE[$i]}.png
 		fi
 	done
@@ -407,7 +407,7 @@ create_pkg_sets_page() {
 	write_page_header $VIEW "Overview about reproducible builds of specific package sets in $SUITE/$ARCH"
 	write_page "<ul><li>Tracked package sets in $SUITE: </li>"
 	for i in $(seq 1 ${#META_PKGSET[@]}) ; do
-		if [ -f /var/lib/jenkins/userContent/$SUITE/$ARCH/${TABLE[6]}_${META_PKGSET[$i]}.png ] ; then
+		if [ -f $BASE/$SUITE/$ARCH/${TABLE[6]}_${META_PKGSET[$i]}.png ] ; then
 			write_page "<li><a href=\"#${META_PKGSET[$i]}\">${META_PKGSET[$i]}</a></li>"
 		fi
 	done
@@ -427,9 +427,9 @@ create_pkg_sets_page() {
 			PNG=${TABLE[6]}_${META_PKGSET[$i]}.png
 			THUMB=${TABLE[6]}_${META_PKGSET[$i]}-thumbnail.png
 			# redo pngs once a day
-			if [ ! -f /var/lib/jenkins/userContent/$SUITE/$ARCH/$PNG ] || [ ! -z $(find /var/lib/jenkins/userContent/$SUITE/$ARCH -maxdepth 1 -mtime +0 -name $PNG) ] ; then
+			if [ ! -f $BASE/$SUITE/$ARCH/$PNG ] || [ ! -z $(find $BASE/$SUITE/$ARCH -maxdepth 1 -mtime +0 -name $PNG) ] ; then
 				create_png_from_table 6 $SUITE/$ARCH/$PNG ${META_PKGSET[$i]}
-				convert /var/lib/jenkins/userContent/$SUITE/$ARCH/$PNG -adaptive-resize 160x80 /var/lib/jenkins/userContent/$SUITE/$ARCH/$THUMB
+				convert $BASE/$SUITE/$ARCH/$PNG -adaptive-resize 160x80 $BASE/$SUITE/$ARCH/$THUMB
 			fi
 			write_page "<p><a href=\"/userContent/$SUITE/$ARCH/$PNG\"><img src=\"/userContent/$SUITE/$ARCH/$PNG\" alt=\"${MAINLABEL[6]}\"></a>"
 			write_page "<br />The package set '${META_PKGSET[$i]}' in $SUITE/$ARCH consists of: <br />"
@@ -519,7 +519,7 @@ create_main_stats_page() {
 	for i in 3 7 4 5 1 ; do
 		write_page " <a href=\"/userContent/${TABLE[$i]}.png\"><img src=\"/userContent/${TABLE[$i]}.png\" alt=\"${MAINLABEL[$i]}\"></a>"
 		# redo pngs once a day
-		if [ ! -f /var/lib/jenkins/userContent/${TABLE[$i]}.png ] || [ ! -z $(find /var/lib/jenkins/userContent -maxdepth 1 -mtime +0 -name ${TABLE[$i]}.png) ] ; then
+		if [ ! -f $BASE/${TABLE[$i]}.png ] || [ ! -z $(find $BASE -maxdepth 1 -mtime +0 -name ${TABLE[$i]}.png) ] ; then
 			create_png_from_table $i ${TABLE[$i]}.png
 		fi
 		if [ "$i" = "3" ] ; then
diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index 8732f56..098e63d 100755
--- a/bin/reproducible_maintenance.sh
+++ b/bin/reproducible_maintenance.sh
@@ -34,7 +34,7 @@ if [ ! -f reproducible_$DATE.db.xz ] ; then
 fi
 
 # provide copy for external backups
-cp -v $PACKAGES_DB /var/lib/jenkins/userContent/
+cp -v $PACKAGES_DB $BASE/
 
 # delete old temp directories
 OLDSTUFF=$(find $REP_RESULTS -maxdepth 1 -type d -name "tmp.*" -mtime +2 -exec ls -lad {} \;)
@@ -97,7 +97,7 @@ fi
 # only grep through the last 5h (300 minutes) of builds...
 # (ignore "*None.rbuild.log" because these are build which were just started)
 # this job runs every 4h
-FAILED_BUILDS=$(find /var/lib/jenkins/userContent/rbuild -type f ! -name "*None.rbuild.log" ! -mmin +300 -exec egrep -l -e 'E: Failed to fetch.*(Connection failed|Size mismatch|Cannot initiate the connection to)' {} \; || true)
+FAILED_BUILDS=$(find $BASE/rbuild -type f ! -name "*None.rbuild.log" ! -mmin +300 -exec egrep -l -e 'E: Failed to fetch.*(Connection failed|Size mismatch|Cannot initiate the connection to)' {} \; || true)
 if [ ! -z "$FAILED_BUILDS" ] ; then
 	echo
 	echo "Warning: the following failed builds have been found"
@@ -201,7 +201,7 @@ if grep -q '|' $PACKAGES ; then
 		QUERY="DELETE FROM removed_packages
 			WHERE name='$PKGNAME' AND suite='$SUITE' AND architecture='$ARCH'"
 		sqlite3 -init $INIT ${PACKAGES_DB} "$QUERY"
-		cd /var/lib/jenkins/userContent
+		cd $BASE
 		find rb-pkg/$SUITE/$ARCH  rbuild/$SUITE/$ARCH dbd/$SUITE/$ARCH buildinfo/$SUITE/$ARCH -name "${PKGNAME}_*" | xargs rm -v
 	done
 	cd - > /dev/null
@@ -218,16 +218,16 @@ if [ ! -z "$OLDSTUFF" ] ; then
 fi
 
 # remove artifacts older than 3 days
-ARTIFACTS=$(find /var/lib/jenkins/userContent/artifacts/* -maxdepth 1 -type d -mtime +3 -exec ls -lad {} \; || true)
+ARTIFACTS=$(find $BASE/artifacts/* -maxdepth 1 -type d -mtime +3 -exec ls -lad {} \; || true)
 if [ ! -z "$ARTIFACTS" ] ; then
 	echo
 	echo "Removed old artifacts:"
-	find /var/lib/jenkins/userContent/artifacts/* -maxdepth 1 -type d -mtime +3 -exec rm -rv {} \;
+	find $BASE/artifacts/* -maxdepth 1 -type d -mtime +3 -exec rm -rv {} \;
 	echo
 fi
 
 # find + chmod files with bad permissions
-BADPERMS=$(find /var/lib/jenkins/userContent/{buildinfo,dbd,rbuild,artifacts,unstable,experimental,testing,rb-pkg} ! -perm 644 -type f)
+BADPERMS=$(find $BASE/{buildinfo,dbd,rbuild,artifacts,unstable,experimental,testing,rb-pkg} ! -perm 644 -type f)
 if [ ! -z "$BADPERMS" ] ; then
     DIRTY=true
     echo

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list