summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-06-12 21:31:12 +0200
committerHolger Levsen <holger@layer-acht.org>2015-06-14 21:55:26 +0200
commit7fc7fb0c59266664b8c700e21859a7fbcc3d5052 (patch)
treea18c9e48228f06f39c2679208f88008cd5c8a502
parented7f36ad6ac69972414ff11eea911a22a25d26f1 (diff)
downloadjenkins.debian.net-7fc7fb0c59266664b8c700e21859a7fbcc3d5052.tar.xz
reproducible: define $TEMPDIR as /tmp/reproducible and teach all the to create temporary files under TEMPDIR (except for builders, they have their own TMPDIR), to avoid polluting /tmp
-rwxr-xr-xbin/reproducible_blacklist.sh2
-rwxr-xr-xbin/reproducible_build.sh4
-rwxr-xr-xbin/reproducible_common.sh6
-rwxr-xr-xbin/reproducible_coreboot.sh4
-rwxr-xr-xbin/reproducible_create_meta_pkg_sets.sh6
-rwxr-xr-xbin/reproducible_html_dd_list.sh4
-rwxr-xr-xbin/reproducible_html_repository_comparison.sh4
-rwxr-xr-xbin/reproducible_maintenance.sh10
-rwxr-xr-xbin/reproducible_openwrt.sh6
-rwxr-xr-xbin/reproducible_setup_pbuilder.sh6
10 files changed, 27 insertions, 25 deletions
diff --git a/bin/reproducible_blacklist.sh b/bin/reproducible_blacklist.sh
index e5322bea..9de1b68d 100755
--- a/bin/reproducible_blacklist.sh
+++ b/bin/reproducible_blacklist.sh
@@ -13,7 +13,6 @@ common_init "$@"
blacklist_packages() {
DATE=$(date +'%Y-%m-%d %H:%M')
- TMPFILE=$(mktemp)
for PKG in $PACKAGES ; do
VERSION=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT version FROM sources WHERE name='$PKG' AND suite='$SUITE';")
PKGID=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT id FROM sources WHERE name='$PKG' AND suite='$SUITE';")
@@ -23,7 +22,6 @@ blacklist_packages() {
revert_blacklisted_packages() {
DATE=$(date +'%Y-%m-%d %H:%M')
- TMPFILE=$(mktemp)
for PKG in $PACKAGES ; do
VERSION=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT version FROM sources WHERE name='$PKG' AND suite='$SUITE';")
PKGID=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT id FROM sources WHERE name='$PKG' AND suite='$SUITE';")
diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index c17f6975..1b9227b0 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -375,8 +375,8 @@ first_build(){
}
check_buildinfo() {
- local TMPFILE1=$(mktemp)
- local TMPFILE2=$(mktemp)
+ local TMPFILE1=$(mktemp --tmpdir=$TMPDIR)
+ local TMPFILE2=$(mktemp --tmpdir=$TMPDIR)
grep-dctrl -s Build-Environment -n ${SRCPACKAGE} ./b1/$BUILDINFO > $TMPFILE1
grep-dctrl -s Build-Environment -n ${SRCPACKAGE} ./b2/$BUILDINFO > $TMPFILE2
set +e
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index 75f32c3a..2b0ad523 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -53,6 +53,10 @@ declare -A SPOKENTARGET
BASE="/var/lib/jenkins/userContent/reproducible"
mkdir -p "$BASE"
+# to hold reproducible temporary files/directories without polluting /tmp
+TEMPDIR="/tmp/reproducible"
+mkdir -p "$TMPDIR"
+
# create subdirs for suites
for i in $SUITES ; do
mkdir -p "$BASE/$i"
@@ -95,7 +99,7 @@ schedule_packages() {
HOURS=$(echo "$(date +'%H')*2"|bc)
MINS=$(date +'%M') # schedule on the full hour so we can recognize them easily
DATE=$(date +'%Y-%m-%d %H:%M' -d "$DAYS day ago - $HOURS hours - $MINS minutes")
- TMPFILE=$(mktemp)
+ TMPFILE=$(mktemp --tmpdir=$TEMPDIR)
for PKG_ID in $@ ; do
echo "REPLACE INTO schedule (package_id, date_scheduled, date_build_started, save_artifacts, notify) VALUES ('$PKG_ID', '$DATE', '', '$ARTIFACTS', '$NOTIFY');" >> $TMPFILE
done
diff --git a/bin/reproducible_coreboot.sh b/bin/reproducible_coreboot.sh
index 9400a9f9..f1d15a7d 100755
--- a/bin/reproducible_coreboot.sh
+++ b/bin/reproducible_coreboot.sh
@@ -128,7 +128,7 @@ fi
#
# create html about toolchains used
#
-TOOLCHAIN_HTML=$(mktemp)
+TOOLCHAIN_HTML=$(mktemp --tmpdir=$TMPDIR)
echo "<table><tr><th>cross toolchain source</th><th>sha256sum</th></tr>" > $TOOLCHAIN_HTML
cd util/crossgcc/tarballs
for i in * ; do
@@ -198,7 +198,7 @@ DBDVERSION="$(schroot --directory /tmp -c source:jenkins-reproducible-${DBDSUITE
echo "============================================================================="
echo "$(date -u) - Running $DBDVERSION on coreboot images."
echo "============================================================================="
-ROMS_HTML=$(mktemp)
+ROMS_HTML=$(mktemp --tmpdir=$TMPDIR)
echo " <ul>" > $ROMS_HTML
BAD_ROMS=0
GOOD_ROMS=0
diff --git a/bin/reproducible_create_meta_pkg_sets.sh b/bin/reproducible_create_meta_pkg_sets.sh
index 3b3eb25c..e6e65013 100755
--- a/bin/reproducible_create_meta_pkg_sets.sh
+++ b/bin/reproducible_create_meta_pkg_sets.sh
@@ -54,7 +54,7 @@ update_if_similar() {
echo diff -u $TARGET $TARGET.new
diff -u $TARGET $TARGET.new || true
echo
- KEEP=$(mktemp)
+ KEEP=$(mktemp --tmpdir=$TEMPDIR pkg-set-check-XXXXXXXXXX)
mv $TARGET.new $KEEP
echo "The new pkg-set has been saved as $KEEP for further investigation."
echo "wc -l $TARGET $KEEP)"
@@ -364,8 +364,8 @@ update_pkg_sets() {
}
-TMPFILE=$(mktemp)
-TMPFILE2=$(mktemp)
+TMPFILE=$(mktemp --tmpdir=$TEMPDIR pkg-sets-XXXXXXXXX)
+TMPFILE2=$(mktemp --tmpdir=$TEMPDIR pkg-sets-XXXXXXXXX)
for SUITE in $SUITES ; do
if [ "$SUITE" = "experimental" ] ; then
# no pkg sets in experimental
diff --git a/bin/reproducible_html_dd_list.sh b/bin/reproducible_html_dd_list.sh
index fe0c39bf..4d819d9b 100755
--- a/bin/reproducible_html_dd_list.sh
+++ b/bin/reproducible_html_dd_list.sh
@@ -19,8 +19,8 @@ for SUITE in $SUITES ; do
PAGE=index_${VIEW}.html
echo "$(date) - starting to write $PAGE page."
write_page_header $VIEW "Maintainers of unreproducible packages in $SUITE"
- TMPFILE=$(mktemp)
- SOURCES=$(mktemp)
+ TMPFILE=$(mktemp --tmpdir=$TEMPDIR dd-list-XXXXXXXX)
+ SOURCES=$(mktemp --tmpdir=$TEMPDIR dd-list-XXXXXXXX)
schroot --directory /tmp -c source:jenkins-reproducible-$SUITE cat /var/lib/apt/lists/*_source_Sources > $SOURCES || \
wget ${MIRROR}/dists/$SUITE/main/source/Sources.xz -O - | xzcat > $SOURCES
BAD=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT s.name FROM results AS r JOIN sources AS s ON r.package_id=s.id WHERE r.status='unreproducible' AND s.suite='$SUITE' ORDER BY r.build_date DESC" | xargs echo)
diff --git a/bin/reproducible_html_repository_comparison.sh b/bin/reproducible_html_repository_comparison.sh
index 4b2675cf..fe2ab234 100755
--- a/bin/reproducible_html_repository_comparison.sh
+++ b/bin/reproducible_html_repository_comparison.sh
@@ -15,8 +15,8 @@ ARCH="amd64" # same
VIEW=repositories
PAGE=index_${VIEW}.html
-TMPFILE=$(mktemp)
-TMP2FILE=$(mktemp)
+TMPFILE=$(mktemp --tmpdir=$TEMPDIR repo-comp-XXXXXXXXX)
+TMP2FILE=$(mktemp --tmpdir=$TEMPDIR repo-comp-XXXXXXXXX)
MODIFIED_IN_SID=0
MODIFIED_IN_EXP=0
diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index 63e8398b..49817707 100755
--- a/bin/reproducible_maintenance.sh
+++ b/bin/reproducible_maintenance.sh
@@ -89,9 +89,9 @@ if [ ! -z "$FAILED_BUILDS" ] ; then
fi
# find+terminate processes which should not be there
-HAYSTACK=$(mktemp)
-RESULT=$(mktemp)
-TOKILL=$(mktemp)
+HAYSTACK=$(mktemp --tmpdir=$TEMPDIR maintenance-XXXXXXXXXXX)
+RESULT=$(mktemp --tmpdir=$TEMPDIR maintenance-XXXXXXXXXXX)
+TOKILL=$(mktemp --tmpdir=$TEMPDIR maintenance-XXXXXXXXXXX)
PBUIDS="1234 1111 2222"
ps axo pid,user,size,pcpu,cmd > $HAYSTACK
for i in $PBUIDS ; do
@@ -152,7 +152,7 @@ QUERY="
AND p.date_build_started < datetime('now', '-36 hours')
ORDER BY p.date_scheduled
"
-PACKAGES=$(mktemp)
+PACKAGES=$(mktemp --tmpdir=$TEMPDIR maintenance-XXXXXXXXXXXX)
sqlite3 -init $INIT ${PACKAGES_DB} "$QUERY" > $PACKAGES 2> /dev/null || echo "Warning: SQL query '$QUERY' failed."
if grep -q '|' $PACKAGES ; then
echo
@@ -179,7 +179,7 @@ if [ ! -z "$LOCKFILES" ] ; then
fi
# find packages which have been removed from the archive
-PACKAGES=$(mktemp)
+PACKAGES=$(mktemp --tmpdir=$TEMPDIR maintenance-XXXXXXXXXX)
QUERY="SELECT name, suite, architecture FROM removed_packages
LIMIT 25"
sqlite3 -init $INIT ${PACKAGES_DB} "$QUERY" > $PACKAGES 2> /dev/null || echo "Warning: SQL query '$QUERY' failed."
diff --git a/bin/reproducible_openwrt.sh b/bin/reproducible_openwrt.sh
index 688fee8a..ebe6941b 100755
--- a/bin/reproducible_openwrt.sh
+++ b/bin/reproducible_openwrt.sh
@@ -196,7 +196,7 @@ save_openwrt_results b2
#
# create html about toolchain used
#
-TOOLCHAIN_HTML=$(mktemp)
+TOOLCHAIN_HTML=$(mktemp --tmpdir=$TMPDIR)
TARGET=$(ls -1d staging_dir/toolchain*|cut -d "-" -f2-|xargs echo)
echo "<table><tr><th>Contents of <code>build_dir/host/</code></th></tr>" > $TOOLCHAIN_HTML
for i in $(ls -1 build_dir/host/) ; do
@@ -216,7 +216,7 @@ for i in gcc binutils bzip2 flex python perl make findutils grep diffutils unzip
done
echo "</table>" >> $TOOLCHAIN_HTML
# get banner
-BANNER_HTML=$(mktemp)
+BANNER_HTML=$(mktemp --tmpdir=$TMPDIR)
cat $(find build_dir/ -name banner | grep etc/banner|head -1) >> $BANNER_HTML
# clean up builddir to save space on tmpfs
@@ -230,7 +230,7 @@ DBDVERSION="$(schroot --directory /tmp -c source:jenkins-reproducible-${DBDSUITE
echo "============================================================================="
echo "$(date -u) - Running $DBDVERSION on OpenWrt images and packages."
echo "============================================================================="
-DBD_HTML=$(mktemp)
+DBD_HTML=$(mktemp --tmpdir=$TMPDIR)
# run debbindiff on the images
echo " <table><tr><th>Images for <code>$TARGET</code></th></tr>" > $DBD_HTML
GOOD_IMAGES=0
diff --git a/bin/reproducible_setup_pbuilder.sh b/bin/reproducible_setup_pbuilder.sh
index 1134f779..837f3b4f 100755
--- a/bin/reproducible_setup_pbuilder.sh
+++ b/bin/reproducible_setup_pbuilder.sh
@@ -82,8 +82,8 @@ setup_pbuilder() {
PACKAGES="$@"
EXTRA_PACKAGES="locales-all"
echo "$(date) - creating /var/cache/pbuilder/${NAME}.tgz now..."
- TMPFILE=$(mktemp)
- LOG=$(mktemp)
+ TMPFILE=$(mktemp --tmpdir=$TEMPDIR pbuilder-XXXXXXXXX)
+ LOG=$(mktemp --tmpdir=$TEMPDIR pbuilder-XXXXXXXX)
if [ "$SUITE" = "experimental" ] ; then
SUITE=unstable
echo "echo 'deb $MIRROR experimental main' > /etc/apt/sources.list.d/experimental.list" > ${TMPFILE}
@@ -105,7 +105,7 @@ setup_pbuilder() {
for PKG in ${PACKAGES} ; do
grep "http://reproducible.alioth.debian.org/debian/ ./ Packages" ${LOG} \
| grep -v grep | grep "${PKG} " \
- || ( echo ; echo "Package ${PKG} is not installed at all or probably rather not in our version, so removing the chroot and exiting now." ; sudo rm -v /var/cache/pbuilder/${NAME}-new.tgz ; exit 1 )
+ || ( echo ; echo "Package ${PKG} is not installed at all or probably rather not in our version, so removing the chroot and exiting now." ; sudo rm -v /var/cache/pbuilder/${NAME}-new.tgz ; rm $TMPFILE $LOG ; exit 1 )
done
sudo mv /var/cache/pbuilder/${NAME}-new.tgz /var/cache/pbuilder/${NAME}.tgz
# create stamp file to record initial creation date