smoketest: Avoid writing to ..
authorGuido Günther <agx@sigxcpu.org>
Tue, 25 Aug 2020 08:38:48 +0000 (10:38 +0200)
committerGuido Günther <agx@sigxcpu.org>
Tue, 25 Aug 2020 08:48:15 +0000 (10:48 +0200)
Use a temporary directory to avoid 'allow-root'.

debian/tests/smoke-rpm

index a97402a50610f09cab05fb0cfd32216b649a2924..0380479034121126ddc1ee59c9405bc95699d8b0 100755 (executable)
@@ -3,6 +3,13 @@
 set -e
 set -x
 
+cleanup()
+{
+  [ -z "${GBP_TEMPDIR}" ] || rm -rf "${GBP_TEMPDIR}"
+}
+
+trap cleanup EXIT
+
 git init .
 git config user.email "you@example.com"
 git config user.name "Doesnot Matter"
@@ -13,7 +20,9 @@ gbp buildpackage-rpm --help
 
 # Build an RPM of ourselfes if build-deps are available
 if python3 -c "import setuptools"; then
+  GBP_TEMPDIR=$(mktemp -d)
   gbp buildpackage-rpm --git-packaging-dir=packaging/ \
+                       --git-export-dir="$GBP_TEMPDIR" \
                        -D'%__python3 /usr/bin/python3' \
                        -D'%__python /usr/bin/python3' \
                        -bb --nodeps