summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-24 10:22:08 +0200
committerErich Eckner <git@eckner.net>2018-09-24 10:22:08 +0200
commitc0973425861ac911a887d0865905571673ce41de (patch)
tree6cb204c673d882df3e8645b6effcb721d842115d
parent2822716112435d983906bd1dbc28ad8ca2e02728 (diff)
downloadbuilder-c0973425861ac911a887d0865905571673ce41de.tar.xz
unify mktemp definitions to use --tmpdir if appropriate
-rwxr-xr-xbin/harvest-commit-times2
-rwxr-xr-xbin/modify-package-state2
-rwxr-xr-xbin/repo-copy2
-rwxr-xr-xlib/common-functions8
-rwxr-xr-xlib/mysql-functions6
5 files changed, 8 insertions, 12 deletions
diff --git a/bin/harvest-commit-times b/bin/harvest-commit-times
index 91c96ba..1f8c2e0 100755
--- a/bin/harvest-commit-times
+++ b/bin/harvest-commit-times
@@ -58,7 +58,7 @@ if ! verbose_flock ${block_flag} 9; then
exit
fi
-tmp_file=$(mktemp "tmp.harvest-commit-times.XXXXXXXXXX")
+tmp_file=$(mktemp 'tmp.harvest-commit-times.XXXXXXXXXX' --tmpdir)
trap 'rm "${tmp_file}"' EXIT
# shellcheck disable=SC2016
diff --git a/bin/modify-package-state b/bin/modify-package-state
index b4425ec..25b70f2 100755
--- a/bin/modify-package-state
+++ b/bin/modify-package-state
@@ -115,7 +115,7 @@ if ${report}; then
cat "${output_file}" > "${input_file}"
rm -f "${output_file}"
}
- output_file=$(mktemp 'tmp.modify-package-state.XXXXXXXXXX')
+ output_file=$(mktemp 'tmp.modify-package-state.XXXXXXXXXX' --tmpdir)
trap 'move_output' EXIT
else
output_file='/dev/null'
diff --git a/bin/repo-copy b/bin/repo-copy
index 803cae3..ee3ac2e 100755
--- a/bin/repo-copy
+++ b/bin/repo-copy
@@ -28,7 +28,7 @@ to_repo="$2"
shift
shift
-tmp_dir=$(mktemp -d "${TMPDIR:-/tmp}/repo-tools.XXXXXXXXXX")
+tmp_dir=$(mktemp -d 'repo-tools.XXXXXXXXXX' --tmpdir)
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
# extract the databases
diff --git a/lib/common-functions b/lib/common-functions
index 2d96350..34a3bf6 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -704,7 +704,7 @@ smoothen_namcap_log() {
trigger_mirror_refreshs() {
local tmp_file
- tmp_file=$(mktemp "tmp.common-functions.trigger_mirror_refreshs.XXXXXXXXXX" --tmpdir)
+ tmp_file=$(mktemp 'tmp.common-functions.trigger_mirror_refreshs.XXXXXXXXXX' --tmpdir)
date '+%s' > \
"${tmp_file}"
failsafe_rsync \
@@ -804,9 +804,7 @@ verbose_flock() {
# recompress_gz $tmp_dir $file1.gz $file2.gz ...
# recompress the given file(s) to make them rsync friendly
recompress_gz() {
- tmp_file=$(
- mktemp "$1/recompress_gz.XXXXXXXX"
- )
+ tmp_file=$(mktemp "$1/recompress_gz.XXXXXXXX")
shift
local file
for file in "$@"; do
@@ -829,7 +827,7 @@ recompress_gz() {
# - commands must be executable in arbitrary order
failsafe_sftp() {
( # new shell is intentional
- temp_dir=$(mktemp -d "tmp.common-functions.sftp_failsave.XXXXXXXXXX")
+ temp_dir=$(mktemp -d 'tmp.common-functions.sftp_failsafe.XXXXXXXXXX' --tmpdir)
trial_counter=20
trap 'rm -rf --one-file-system "${temp_dir}"' EXIT
cat > "${temp_dir}/input"
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 438e498..f1b663e 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -682,7 +682,7 @@ mysql_sanity_check() {
# recreate the `build_dependency_loops` table
mysql_find_build_assignment_loops() {
( # new shell is intentional
- tmp_file=$(mktemp "tmp.mysql-functions.mysql_find_build_assignment_loops.XXXXXXXXXX")
+ tmp_file=$(mktemp 'tmp.mysql-functions.mysql_find_build_assignment_loops.XXXXXXXXXX' --tmpdir)
trap 'rm "${tmp_file}"' EXIT
{
printf 'SELECT DISTINCT `architectures`.`id`'
@@ -1178,9 +1178,7 @@ mysql_query_and_delete_unneeded_binary_packages() {
mysql_sort_versions() {
( # new shell is intentional
- tmp_file=$(
- mktemp "tmp.mysql_sort_versions.XXXXXXXXXX" --tmpdir
- )
+ tmp_file=$(mktemp 'tmp.mysql_sort_versions.XXXXXXXXXX' --tmpdir)
trap 'rm "${tmp_file}"' EXIT
if [ "x$1" != 'x-f' ] && \
{