fi
}
+# Get a tempfile, add it to the right variable to get rid of it,
+# and return it
+function gettempfile() {
+ local MAKEDIR=${1:-false}
+ local TMPARGS=""
+ if [[ ${MAKEDIR} == true ]]; then
+ TMPARGS="--directory"
+ fi
+ local TMPFILE=$( mktemp -p ${TMPDIR} ${TMPARGS} )
+ TMPFILES="${TEMPFILES} ${TMPFILE}"
+ echo "${TMPFILE}"
+}
+
# Function that only cleans tempfiles, but does not exit or otherwise
# care about any exit status
function cleantempfiles() {
# get the latest list of wnpp bugs and their source packages
function wnppbugs() {
log "Fetching latest list of wnpp bugs"
- TMPLIST=$( mktemp -p ${TMPDIR} )
- TMPFILES="${TMPFILES} ${TMPLIST}"
+ TMPLIST=$( gettempfile )
wget -q -O${TMPLIST} --ca-directory=/etc/ssl/ca-debian https://qa.debian.org/data/bts/wnpp_rm
chmod go+r ${TMPLIST}
mv ${TMPLIST} ${scriptdir}/masterfiles/wnpp_rm
# Generate the contributor data
function contributor() {
log "Submitting data to contributors"
- TMPCNTB=$( mktemp -p ${TMPDIR} )
- TMPFILES="${TMPFILES} ${TMPCNTB}"
+ TMPCNTB=$( gettempfile )
REQUESTS_CA_BUNDLE=/etc/ssl/ca-debian/ca-certificates.crt dc-tool --mine="${configdir}/contributor.source" --auth-token @"${base}/s3kr1t/contributor.auth" --source ftp.debian.org --json > ${TMPCNTB}
# Post with curl as a workaround for #801506
log "Updating fingerprints"
dak import-keyring -L /srv/keyring.debian.org/keyrings/debian-keyring.gpg
- OUTFILE=$(mktemp)
+ OUTFILE=$( gettempfile )
dak import-keyring --generate-users "%s" /srv/keyring.debian.org/keyrings/debian-maintainers.gpg >"${OUTFILE}"
if [ -s "${OUTFILE}" ]; then
for archive in "${public_archives[@]}"; do
log "... archive: ${archive}"
archiveroot="$(get_archiveroot "${archive}")"
- local TMPLO=$( mktemp -p ${TMPDIR} )
- trap "rm -f ${TMPLO}" ERR EXIT TERM HUP INT QUIT
+ local TMPLO=$( gettempfile )
cd ${archiveroot}
rm -f extrafiles
# do the buildd key updates
function builddautosigning() {
- BUILDDFUN=$(mktemp -p "${TMPDIR}" BUILDDFUN.XXXXXX)
- TMPFILES="${TMPFILES} ${BUILDDFUN}"
+ BUILDDFUN=$( gettempfile )
exec >> "${BUILDDFUN}" 2>&1
${scriptsdir}/buildd-remove-keys
${scriptsdir}/buildd-add-keys