[Qa-jenkins-scm] [jenkins.debian.net] 03/03: 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
Holger Levsen
holger at moszumanska.debian.org
Sun Jun 14 19:56:04 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 7fc7fb0c59266664b8c700e21859a7fbcc3d5052
Author: Mattia Rizzolo <mattia at mapreri.org>
Date: Fri Jun 12 21:31:12 2015 +0200
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
---
bin/reproducible_blacklist.sh | 2 --
bin/reproducible_build.sh | 4 ++--
bin/reproducible_common.sh | 6 +++++-
bin/reproducible_coreboot.sh | 4 ++--
bin/reproducible_create_meta_pkg_sets.sh | 6 +++---
bin/reproducible_html_dd_list.sh | 4 ++--
bin/reproducible_html_repository_comparison.sh | 4 ++--
bin/reproducible_maintenance.sh | 10 +++++-----
bin/reproducible_openwrt.sh | 6 +++---
bin/reproducible_setup_pbuilder.sh | 6 +++---
10 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/bin/reproducible_blacklist.sh b/bin/reproducible_blacklist.sh
index e5322be..9de1b68 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 c17f697..1b9227b 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 75f32c3..2b0ad52 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 9400a9f..f1d15a7 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 3b3eb25..e6e6501 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 fe0c39b..4d819d9 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 4b2675c..fe2ab23 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 63e8398..4981770 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 688fee8..ebe6941 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 1134f77..837f3b4 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
--
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