You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2019/11/16 06:23:42 UTC

[kudu] 02/02: [mini-cluster] fix on building mini-cluster JAR

This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch branch-1.11.x
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 069f1813b22a49caa6746ff9664a7779faeccfa3
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Tue Nov 12 17:49:55 2019 -0800

    [mini-cluster] fix on building mini-cluster JAR
    
    Prior to this patch, build_mini_cluster_binaries.sh script didn't
    properly handle the case of running in the same workspace that
    was used to build the mini-cluster JAR for prior releases.  That
    might result in not building the required JAR, so no binary
    content would be uploaded by running publish_mini_cluster_binaries.sh
    script later on.
    
    This patch fixes the issue: by default, the build directory
    is re-created upon every run of the build_mini_cluster_binaries.sh
    script unless MINI_CLUSTER_NO_FRESH_BUILD environment variable is set.
    Also, even if MINI_CLUSTER_NO_FRESH_BUILD is set and the build directory
    is not re-created, the script now warns on ambiguity when multiple
    artifact directories are present.
    
    Change-Id: Ic2d5c2a83e2a0ab959e2eb7898d47ab736cd1e1f
    Reviewed-on: http://gerrit.cloudera.org:8080/14702
    Tested-by: Kudu Jenkins
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
    (cherry picked from commit 6406123924c3900e8edd65eebbb3d93963fd2a7b)
    Reviewed-on: http://gerrit.cloudera.org:8080/14728
    Tested-by: Alexey Serbin <as...@cloudera.com>
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
---
 .../mini-cluster/build_mini_cluster_binaries.sh       | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/build-support/mini-cluster/build_mini_cluster_binaries.sh b/build-support/mini-cluster/build_mini_cluster_binaries.sh
index 2f9e9ee..1d0a434 100755
--- a/build-support/mini-cluster/build_mini_cluster_binaries.sh
+++ b/build-support/mini-cluster/build_mini_cluster_binaries.sh
@@ -72,6 +72,16 @@ BUILD_ROOT=$SOURCE_ROOT/build/mini-cluster
 MINI_CLUSTER_SRCDIR=$SOURCE_ROOT/build-support/mini-cluster
 TARGETS="kudu kudu-tserver kudu-master"
 
+# Remove leftovers from previous releases/builds: rename the existing directory.
+# To skip this step, set the MINI_CLUSTER_NO_FRESH_BUILD environment variable.
+if [ -n "$MINI_CLUSTER_NO_FRESH_BUILD" ]; then
+  echo "WARNING: using existing build directory"
+else
+  suffix=$(date "+%Y%m%d.%H%M%S")
+  echo "Moving existing $BUILD_ROOT into $BUILD_ROOT.$suffix"
+  mv $BUILD_ROOT $BUILD_ROOT.$suffix
+fi
+
 cd $SOURCE_ROOT
 if [ -n "$NO_REBUILD_THIRDPARTY" ]; then
   echo Skipping thirdparty because NO_REBUILD_THIRDPARTY is not empty
@@ -120,7 +130,14 @@ make -j$NUM_PROCS $TARGETS
 # Relocate the binaries.
 $MINI_CLUSTER_SRCDIR/relocate_binaries_for_mini_cluster.py $BUILD_ROOT $TARGETS
 
-ARTIFACT_NAME=$(ls -d kudu-binary* | sed 's#/##' | head -1)
+ARTIFACT_NAME="$(ls -dF kudu-binary-* | egrep '.*/$' | sed 's#/##')"
+if [ $(echo $ARTIFACT_NAME | wc -w) -ne 1 ]; then
+  echo "ERROR: this script can handle only single kudu-binary artifact, but"
+  echo "       multiple kudu-binary-* directories found under $BUILD_ROOT:"
+  echo "       $ARTIFACT_NAME"
+  echo "       Remove extra kudu-binary-* directories"
+  exit 1
+fi
 
 # Strip everything to minimize the size of the tarball we generate.
 echo Stripping symbols...