提交 5428cbbe 编写于 作者: J Joerg Jaspert

New function for tempfile generation

Especially proper adding to the TMPFILES variable to get rid of em
again.
上级 773f4286
......@@ -23,6 +23,19 @@ function debug () {
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() {
......
......@@ -3,8 +3,7 @@
# 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
......@@ -43,8 +42,7 @@ function newstats() {
# 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
......
......@@ -182,7 +182,7 @@ function fingerprints() {
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
......@@ -691,8 +691,7 @@ function signotherfiles() {
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
......
......@@ -54,8 +54,7 @@ function backportsacl() {
# 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册