HBASE-20134 dev-support scripts should use mktemp instead of hard-coding /tmp.

Signed-off-by: Mike Drob <md...@apache.org>

 Conflicts:
        dev-support/jenkins-scripts/generate-hbase-website.sh


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c8f4af0e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c8f4af0e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c8f4af0e

Branch: refs/heads/branch-1.4
Commit: c8f4af0e810179c12ce7d78f64164f607838df06
Parents: 1595cee
Author: Sean Busbey <bus...@apache.org>
Authored: Mon Mar 5 23:40:25 2018 -0600
Committer: Sean Busbey <bus...@apache.org>
Committed: Tue Mar 6 12:43:09 2018 -0600

----------------------------------------------------------------------
 dev-support/hbase_nightly_source-artifact.sh | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c8f4af0e/dev-support/hbase_nightly_source-artifact.sh
----------------------------------------------------------------------
diff --git a/dev-support/hbase_nightly_source-artifact.sh 
b/dev-support/hbase_nightly_source-artifact.sh
index b334fa5..9458324 100755
--- a/dev-support/hbase_nightly_source-artifact.sh
+++ b/dev-support/hbase_nightly_source-artifact.sh
@@ -21,7 +21,7 @@ function usage {
   echo "Usage: ${0} [options] /path/to/component/checkout"
   echo ""
   echo "    --intermediate-file-dir /path/to/use  Path for writing listings 
and diffs. must exist."
-  echo "                                          defaults to making a 
directory in /tmp."
+  echo "                                          defaults to making a 
directory via mktemp."
   echo "    --unpack-temp-dir /path/to/use        Path for unpacking tarball. 
default to"
   echo "                                          'unpacked_src_tarball' in 
intermediate directory."
   echo "    --maven-m2-initial /path/to/use       Path for maven artifacts 
while building in"
@@ -67,11 +67,10 @@ fi
 component_dir="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
 
 if [ -z "${working_dir}" ]; then
-  working_dir=/tmp
-  while [[ -e ${working_dir} ]]; do
-    working_dir=/tmp/hbase-srctarball-test-${RANDOM}.${RANDOM}
-  done
-  mkdir "${working_dir}"
+  if ! working_dir="$(mktemp -d -t hbase-srctarball-test)" ; then
+    echo "Failed to create temporary working directory. Please specify via 
--unpack-temp-dir"
+    exit 1
+  fi
 else
   # absolutes please
   working_dir="$(cd "$(dirname "${working_dir}")"; pwd)/$(basename 
"${working_dir}")"

Reply via email to