[arch-projects] [dbscripts] [PATCH 3/8] Export TMPDIR, and use mktemp -t instead of making it part of the template

Luke Shumaker lukeshu at lukeshu.com
Wed Mar 14 01:52:00 UTC 2018


From: Luke Shumaker <lukeshu at parabola.nu>

---
 config                    | 2 +-
 db-functions              | 2 +-
 test/cases/db-update.bats | 2 +-
 test/lib/common.bash      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/config b/config
index 02ade09..2f5dbc6 100644
--- a/config
+++ b/config
@@ -21,7 +21,7 @@ LOCK_DELAY=10
 LOCK_TIMEOUT=300
 
 STAGING="$HOME/staging"
-TMPDIR="/var/tmp"
+export TMPDIR="/var/tmp"
 ARCHES=(x86_64)
 DBEXT=".db.tar.gz"
 FILESEXT=".files.tar.gz"
diff --git a/db-functions b/db-functions
index 2703e80..58b753a 100644
--- a/db-functions
+++ b/db-functions
@@ -38,7 +38,7 @@ mv_acl() {
 }
 
 # set up general environment
-WORKDIR=$(mktemp -d "${TMPDIR}/${0##*/}.XXXXXXXXXX")
+WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX")
 if [[ -n ${SVNUSER} ]]; then
 	setfacl -m u:"${SVNUSER}":rwx "${WORKDIR}"
 	setfacl -m d:u:"${USER}":rwx "${WORKDIR}"
diff --git a/test/cases/db-update.bats b/test/cases/db-update.bats
index e7e4489..2e44b91 100644
--- a/test/cases/db-update.bats
+++ b/test/cases/db-update.bats
@@ -222,7 +222,7 @@ load ../lib/common
 
 @test "package has to be aregular file" {
 	local p
-	local target=$(mktemp -d)
+	local target=$(mktemp -dt)
 	local arches=('i686' 'x86_64')
 
 	releasePackage extra 'pkg-simple-a'
diff --git a/test/lib/common.bash b/test/lib/common.bash
index 568a541..45e4800 100644
--- a/test/lib/common.bash
+++ b/test/lib/common.bash
@@ -83,7 +83,7 @@ setup() {
 	local a
 	PKGEXT=".pkg.tar.xz"
 
-	TMP="$(mktemp -d)"
+	TMP="$(mktemp -dt)"
 
 	export DBSCRIPTS_CONFIG=${TMP}/config.local
 	cat <<eot > "${DBSCRIPTS_CONFIG}"
-- 
2.16.1


More information about the arch-projects mailing list