You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2017/01/31 02:56:00 UTC

[2/2] kudu git commit: thirdparty: Clean up thirdparty prefix from previous builds

thirdparty: Clean up thirdparty prefix from previous builds

If we are rebuilding thirdparty anyway, let's remove the artifacts from
previous builds that were previously installed, since we are going to
reinstall them anyway. This should not affect build times, since we are
not wiping out the build directory, and this will protect us against bad
artifacts left over from previous failed builds.

Change-Id: If2a7ceb3dad1acede152775611f549798723016c
Reviewed-on: http://gerrit.cloudera.org:8080/5826
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Mike Percy <mp...@apache.org>


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

Branch: refs/heads/master
Commit: e87fb79076d5ae2838cad6b63a78066a7853fb20
Parents: 2882f0f
Author: Mike Percy <mp...@apache.org>
Authored: Sat Jan 28 14:01:09 2017 -0800
Committer: Mike Percy <mp...@apache.org>
Committed: Tue Jan 31 02:55:40 2017 +0000

----------------------------------------------------------------------
 thirdparty/build-thirdparty.sh | 48 +++++++++++++++++++++++++++++--------
 thirdparty/postflight.py       |  6 ++---
 thirdparty/vars.sh             |  4 ++--
 3 files changed, 43 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/e87fb790/thirdparty/build-thirdparty.sh
----------------------------------------------------------------------
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index 5626633..6d3bf06 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -68,6 +68,9 @@ else
       "uninstrumented") F_UNINSTRUMENTED=1 ;;
       "tsan")           F_TSAN=1 ;;
 
+      # User requested a specific package to be built.
+      *) F_SPECIFIC_PACKAGE=1 ;& # Fall through to below cases.
+
       # Dependencies.
       "cmake")        F_CMAKE=1 ;;
       "gflags")       F_GFLAGS=1 ;;
@@ -98,19 +101,39 @@ fi
 
 ################################################################################
 
-for PREFIX_DIR in $PREFIX_COMMON $PREFIX_DEPS $PREFIX_DEPS_TSAN; do
-  mkdir -p $PREFIX_DIR/include
+init_prefix() {
+  local PREFIX_DIR=$1
+  local MAKE_LIBDIR=$2
+
+  if [ -z "$PREFIX_DIR" ]; then
+    echo "Unspecified prefix dir in init_prefix()"
+    exit 1
+  fi
+
+  rm -rf "$PREFIX_DIR"
+  mkdir -p "$PREFIX_DIR"
+  mkdir -p "$PREFIX_DIR/include"
 
-  # PREFIX_COMMON is for header-only libraries.
-  if [ "$PREFIX_DIR" != "$PREFIX_COMMON" ]; then
-    mkdir -p $PREFIX_DIR/lib
+  # Some prefixes (such as common) are for non-library tools and header-only
+  # libraries. If the caller doesn't pass the second argument, we don't create
+  # and link the prefix lib dir.
+  if [ -n "$MAKE_LIBDIR" ]; then
+    mkdir -p "$PREFIX_DIR/lib"
 
     # On some systems, autotools installs libraries to lib64 rather than lib.  Fix
     # this by setting up lib64 as a symlink to lib.  We have to do this step first
     # to handle cases where one third-party library depends on another.
     ln -sf "$PREFIX_DIR/lib" "$PREFIX_DIR/lib64"
   fi
-done
+}
+
+# If we are installing to a prefix for the first time, or are installing all
+# dependencies under a given prefix, initialize the whole prefix (including
+# wiping out existing files in that path) to ensure nothing remains from the
+# installation of a previous build.
+[ -n "$F_COMMON" ] && init_prefix $PREFIX_COMMON
+[ -n "$F_UNINSTRUMENTED" ] && init_prefix $PREFIX_UNINSTRUMENTED libdir
+[ -n "$F_TSAN" ] && init_prefix $PREFIX_TSAN libdir
 
 # Incorporate the value of these standard compilation environment variables into
 # the EXTRA_* environment variables.
@@ -193,7 +216,7 @@ fi
 
 ### Build C dependencies without instrumentation
 
-PREFIX=$PREFIX_DEPS
+PREFIX=$PREFIX_UNINSTRUMENTED
 MODE_SUFFIX=""
 
 save_env
@@ -239,7 +262,7 @@ restore_env
 ### Build C++ dependencies without instrumentation
 
 # Clang is used by all builds so it is part of the 'common' library group even
-# though its LLVM libraries are installed to $PREFIX_DEPS.
+# though its LLVM libraries are installed to $PREFIX_UNINSTRUMENTED.
 if [ -n "$F_COMMON" -o -n "$F_LLVM" ]; then
   build_llvm normal
 fi
@@ -317,7 +340,7 @@ fi
 export CC=$CLANG
 export CXX=$CLANGXX
 
-PREFIX=$PREFIX_DEPS_TSAN
+PREFIX=$PREFIX_TSAN
 MODE_SUFFIX=".tsan"
 
 save_env
@@ -434,7 +457,12 @@ fi
 restore_env
 
 # Now run the post-flight checks.
-$TP_DIR/postflight.py
+POST_FLIGHT_FLAGS=""
+if [[ -n "$F_TSAN" || -n "$F_SPECIFIC_PACKAGE" ]]; then
+  # Do the tsan postflight check any time a tsan dep might be updated.
+  POST_FLIGHT_FLAGS="$POST_FLIGHT_FLAGS tsan"
+fi
+$TP_DIR/postflight.py $POST_FLIGHT_FLAGS
 
 echo "---------------------"
 echo "Thirdparty dependencies '$ARGS_TO_PRINT' built and installed successfully"

http://git-wip-us.apache.org/repos/asf/kudu/blob/e87fb790/thirdparty/postflight.py
----------------------------------------------------------------------
diff --git a/thirdparty/postflight.py b/thirdparty/postflight.py
index e61adcb..bc0a9bb 100755
--- a/thirdparty/postflight.py
+++ b/thirdparty/postflight.py
@@ -17,7 +17,7 @@
 # specific language governing permissions and limitations
 # under the License.
 """
-Simple script which performs some sanity checks on the built thirdparty/.
+Script which performs some sanity checks on the built thirdparty/.
 """
 
 import os
@@ -83,11 +83,11 @@ done
 echo All TSAN dependencies checked
 """.format(tp_dir=TP_DIR))
 
-
 def main():
   print("Running post-flight checks")
   print("-------------------------")
-  check_tsan_dependencies()
+  if "tsan" in sys.argv:
+    check_tsan_dependencies()
   print("-------------------------")
   print("Post-flight checks succeeded.")
   return 0

http://git-wip-us.apache.org/repos/asf/kudu/blob/e87fb790/thirdparty/vars.sh
----------------------------------------------------------------------
diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh
index b8d8b0e..9d7f4ba 100644
--- a/thirdparty/vars.sh
+++ b/thirdparty/vars.sh
@@ -31,8 +31,8 @@ TP_BUILD_DIR="$TP_DIR/build"
 CLOUDFRONT_URL_PREFIX=http://d3dr9sfxru4sde.cloudfront.net
 
 PREFIX_COMMON=$TP_DIR/installed/common
-PREFIX_DEPS=$TP_DIR/installed/uninstrumented
-PREFIX_DEPS_TSAN=$TP_DIR/installed/tsan
+PREFIX_UNINSTRUMENTED=$TP_DIR/installed/uninstrumented
+PREFIX_TSAN=$TP_DIR/installed/tsan
 
 GFLAGS_VERSION=2.1.2
 GFLAGS_NAME=gflags-$GFLAGS_VERSION