提交 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 () { ...@@ -23,6 +23,19 @@ function debug () {
fi 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 # Function that only cleans tempfiles, but does not exit or otherwise
# care about any exit status # care about any exit status
function cleantempfiles() { function cleantempfiles() {
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
# get the latest list of wnpp bugs and their source packages # get the latest list of wnpp bugs and their source packages
function wnppbugs() { function wnppbugs() {
log "Fetching latest list of wnpp bugs" log "Fetching latest list of wnpp bugs"
TMPLIST=$( mktemp -p ${TMPDIR} ) TMPLIST=$( gettempfile )
TMPFILES="${TMPFILES} ${TMPLIST}"
wget -q -O${TMPLIST} --ca-directory=/etc/ssl/ca-debian https://qa.debian.org/data/bts/wnpp_rm wget -q -O${TMPLIST} --ca-directory=/etc/ssl/ca-debian https://qa.debian.org/data/bts/wnpp_rm
chmod go+r ${TMPLIST} chmod go+r ${TMPLIST}
mv ${TMPLIST} ${scriptdir}/masterfiles/wnpp_rm mv ${TMPLIST} ${scriptdir}/masterfiles/wnpp_rm
...@@ -43,8 +42,7 @@ function newstats() { ...@@ -43,8 +42,7 @@ function newstats() {
# Generate the contributor data # Generate the contributor data
function contributor() { function contributor() {
log "Submitting data to contributors" log "Submitting data to contributors"
TMPCNTB=$( mktemp -p ${TMPDIR} ) TMPCNTB=$( gettempfile )
TMPFILES="${TMPFILES} ${TMPCNTB}"
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} 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 # Post with curl as a workaround for #801506
......
...@@ -182,7 +182,7 @@ function fingerprints() { ...@@ -182,7 +182,7 @@ function fingerprints() {
log "Updating fingerprints" log "Updating fingerprints"
dak import-keyring -L /srv/keyring.debian.org/keyrings/debian-keyring.gpg 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}" dak import-keyring --generate-users "%s" /srv/keyring.debian.org/keyrings/debian-maintainers.gpg >"${OUTFILE}"
if [ -s "${OUTFILE}" ]; then if [ -s "${OUTFILE}" ]; then
...@@ -691,8 +691,7 @@ function signotherfiles() { ...@@ -691,8 +691,7 @@ function signotherfiles() {
for archive in "${public_archives[@]}"; do for archive in "${public_archives[@]}"; do
log "... archive: ${archive}" log "... archive: ${archive}"
archiveroot="$(get_archiveroot "${archive}")" archiveroot="$(get_archiveroot "${archive}")"
local TMPLO=$( mktemp -p ${TMPDIR} ) local TMPLO=$( gettempfile )
trap "rm -f ${TMPLO}" ERR EXIT TERM HUP INT QUIT
cd ${archiveroot} cd ${archiveroot}
rm -f extrafiles rm -f extrafiles
......
...@@ -54,8 +54,7 @@ function backportsacl() { ...@@ -54,8 +54,7 @@ function backportsacl() {
# do the buildd key updates # do the buildd key updates
function builddautosigning() { function builddautosigning() {
BUILDDFUN=$(mktemp -p "${TMPDIR}" BUILDDFUN.XXXXXX) BUILDDFUN=$( gettempfile )
TMPFILES="${TMPFILES} ${BUILDDFUN}"
exec >> "${BUILDDFUN}" 2>&1 exec >> "${BUILDDFUN}" 2>&1
${scriptsdir}/buildd-remove-keys ${scriptsdir}/buildd-remove-keys
${scriptsdir}/buildd-add-keys ${scriptsdir}/buildd-add-keys
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册