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

Message ID 20180314015205.20781-4-lukeshu@lukeshu.com
State Accepted
Headers show
Series
  • Backports from Parabola
Related show

Commit Message

Luke Shumaker March 14, 2018, 1:52 a.m. UTC
From: Luke Shumaker <lukeshu@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(-)

Comments

Eli Schwartz via arch-projects March 14, 2018, 11:23 a.m. UTC | #1
On 03/13/2018 09:52 PM, Luke Shumaker wrote:
> From: Luke Shumaker <lukeshu@parabola.nu>


> 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}"
> 

These two have no TEMPLATE given anyways, so this change is extraneous.

Patch

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}"