Repository: hbase
Updated Branches:
  refs/heads/branch-2 cbbefe755 -> f5c8713bd


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

Signed-off-by: Mike Drob <md...@apache.org>
Signed-off-by: Umesh Agashe <uaga...@cloudera.com>
Signed-off-by: Michael Stack <st...@apache.org>


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

Branch: refs/heads/branch-2
Commit: f5c8713bdd142b7cc6555ad696453504a1dc753c
Parents: cbbefe7
Author: Sean Busbey <bus...@apache.org>
Authored: Mon Mar 5 23:40:25 2018 -0600
Committer: Sean Busbey <bus...@apache.org>
Committed: Wed Mar 7 08:39:19 2018 -0600

----------------------------------------------------------------------
 dev-support/hbase_nightly_source-artifact.sh          | 11 +++++------
 dev-support/jenkins-scripts/generate-hbase-website.sh | 13 ++++++-------
 2 files changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/f5c8713b/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 375d121..56a3d46 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}")"

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5c8713b/dev-support/jenkins-scripts/generate-hbase-website.sh
----------------------------------------------------------------------
diff --git a/dev-support/jenkins-scripts/generate-hbase-website.sh 
b/dev-support/jenkins-scripts/generate-hbase-website.sh
index c25c895..b6277d0 100644
--- a/dev-support/jenkins-scripts/generate-hbase-website.sh
+++ b/dev-support/jenkins-scripts/generate-hbase-website.sh
@@ -40,7 +40,7 @@ function usage {
   echo ""
   echo "    --working-dir /path/to/use  Path for writing logs and a local 
checkout of hbase-site repo."
   echo "                                if given must exist."
-  echo "                                defaults to making a directory in 
/tmp."
+  echo "                                defaults to making a directory via 
mktemp."
   echo "    --local-repo /path/for/maven/.m2  Path for putting local maven 
repo."
   echo "                                if given must exist."
   echo "                                defaults to making a clean directory 
in --working-dir."
@@ -77,12 +77,11 @@ fi
 component_dir="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
 
 if [ -z "${working_dir}" ]; then
-  echo "[DEBUG] defaulting to creating a directory in /tmp"
-  working_dir=/tmp
-  while [[ -e ${working_dir} ]]; do
-    working_dir=/tmp/hbase-generate-website-${RANDOM}.${RANDOM}
-  done
-  mkdir "${working_dir}"
+  echo "[DEBUG] defaulting to creating a directory via mktemp"
+  if ! working_dir="$(mktemp -d -t hbase-generate-website)" ; then
+    echo "Failed to create temporary working directory. Please specify via 
--working-dir"
+    exit 1
+  fi
 else
   # absolutes please
   working_dir="$(cd "$(dirname "${working_dir}")"; pwd)/$(basename 
"${working_dir}")"

Reply via email to