Commit 7fc7fb0c authored by Mattia Rizzolo's avatar Mattia Rizzolo Committed by Holger Levsen

reproducible: define $TEMPDIR as /tmp/reproducible and teach all the to create...

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
parent ed7f36ad
......@@ -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';")
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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."
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment