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 2026/08/11 19:51:01 UTC

(kudu) branch master updated: KUDU-3788 do not unconditionally fetch all source archives

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

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 1d9153c24 KUDU-3788 do not unconditionally fetch all source archives
1d9153c24 is described below

commit 1d9153c248733781bf69132f2d094d9d3c92b2bc
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Fri Aug 7 22:16:05 2026 -0700

    KUDU-3788 do not unconditionally fetch all source archives
    
    With this changelist, 3rd-party build no longer fetches unneeded source
    archives in pre-built mode (USE_PREBUILT_THIRDPARTY=1): now the source
    archive for a component is fetched only when building the component
    from scratch.  For legacy non-pre-build mode, the behavior is left
    as before, i.e. all the source archives are fetched, extracted,
    and patched when running build-if-necessary.sh
    
    Change-Id: I1551fdc2e912f528a0111fcc1098bb608d3887fc
    Reviewed-on: http://gerrit.cloudera.org:8080/24673
    Tested-by: Alexey Serbin <al...@apache.org>
    Reviewed-by: Alexey Serbin <al...@apache.org>
---
 thirdparty/build-definitions.sh   |   1 -
 thirdparty/download-thirdparty.sh | 283 +++++++-------------------------------
 thirdparty/fetch-utils.sh         |  57 +++++++-
 thirdparty/prebuilt-utils.sh      |   2 +
 4 files changed, 110 insertions(+), 233 deletions(-)

diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index d195a3066..0a5a1d5dc 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -947,7 +947,6 @@ build_gcovr() {
   cp -a $GCOVR_SOURCE/scripts/gcovr $dst_dir
 }
 
-# The trace viewer naturally comes as pre-built in its source tarball.
 build_trace_viewer() {
   local dst_dir=$INSTALL_DESTDIR$PREFIX/share/trace-viewer
   mkdir -p $dst_dir
diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh
index 0505aaf40..683e04799 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -34,236 +34,59 @@ fi
 mkdir -p $TP_SOURCE_DIR
 cd $TP_SOURCE_DIR
 
-fetch_and_patch \
- $GLOG_ARCHIVE \
- $GLOG_SOURCE \
- $GLOG_PATCHLEVEL \
- "${GLOG_PATCHES[@]}"
-
-fetch_and_patch \
- $GMOCK_ARCHIVE \
- $GMOCK_SOURCE \
- $GMOCK_PATCHLEVEL \
- "${GMOCK_PATCHES[@]}"
-
-fetch_and_patch \
- $GFLAGS_ARCHIVE \
- $GFLAGS_SOURCE \
- $GFLAGS_PATCHLEVEL
-
-fetch_and_patch \
- $GPERFTOOLS_ARCHIVE \
- $GPERFTOOLS_SOURCE \
- $GPERFTOOLS_PATCHLEVEL \
- "${GPERFTOOLS_PATCHES[@]}" \
- "${GPERFTOOLS_EXTRA_COMMANDS[@]}"
-
-fetch_and_patch \
- $FLATBUFFERS_ARCHIVE \
- $FLATBUFFERS_SOURCE \
- $FLATBUFFERS_PATCHLEVEL \
- "${FLATBUFFERS_PATCHES[@]}"
-
-fetch_and_patch \
- $PROTOBUF_ARCHIVE \
- $PROTOBUF_SOURCE \
- $PROTOBUF_PATCHLEVEL \
- "${PROTOBUF_PATCHES[@]}" \
- "${PROTOBUF_EXTRA_COMMANDS[@]}"
-
-fetch_and_patch \
- $CMAKE_ARCHIVE \
- $CMAKE_SOURCE \
- $CMAKE_PATCHLEVEL \
- "${CMAKE_PATCHES[@]}"
-
-fetch_and_patch \
- $SNAPPY_ARCHIVE \
- $SNAPPY_SOURCE \
- $SNAPPY_PATCHLEVEL
-
-fetch_and_patch \
- $ZLIB_ARCHIVE \
- $ZLIB_SOURCE \
- $ZLIB_PATCHLEVEL
-
-fetch_and_patch \
- $LIBEV_ARCHIVE \
- $LIBEV_SOURCE \
- $LIBEV_PATCHLEVEL
-
-fetch_and_patch \
- $RAPIDJSON_ARCHIVE \
- $RAPIDJSON_SOURCE \
- $RAPIDJSON_PATCHLEVEL \
- "${RAPIDJSON_PATCHES[@]}"
-
-fetch_and_patch \
- $SQUEASEL_ARCHIVE \
- $SQUEASEL_SOURCE \
- $SQUEASEL_PATCHLEVEL \
- "${SQUEASEL_PATCHES[@]}"
-
-fetch_and_patch \
- $MUSTACHE_ARCHIVE \
- $MUSTACHE_SOURCE \
- $MUSTACHE_PATCHLEVEL
-
-fetch_and_patch \
- $CPPLINT_ARCHIVE \
- $CPPLINT_SOURCE \
- $CPPLINT_PATCHLEVEL \
- "${CPPLINT_PATCHES[@]}"
-
-fetch_and_patch \
- $GCOVR_ARCHIVE \
- $GCOVR_SOURCE \
- $GCOVR_PATCHLEVEL
-
-fetch_and_patch \
- $CURL_ARCHIVE \
- $CURL_SOURCE \
- $CURL_PATCHLEVEL \
- "${CURL_PATCHES[@]}" \
- "${CURL_EXTRA_COMMANDS[@]}"
-
-fetch_and_patch \
- $CRCUTIL_ARCHIVE \
- $CRCUTIL_SOURCE \
- $CRCUTIL_PATCHLEVEL \
- "${CRCUTIL_PATCHES[@]}"
-
-fetch_and_patch \
- $LIBUNWIND_ARCHIVE \
- $LIBUNWIND_SOURCE \
- $LIBUNWIND_PATCHLEVEL \
- "${LIBUNWIND_PATCHES[@]}"
-
-fetch_and_patch \
- $LLVM_ARCHIVE \
- $LLVM_SOURCE \
- $LLVM_PATCHLEVEL \
- "${LLVM_PATCHES[@]}"
-
-fetch_and_patch \
- $LZ4_ARCHIVE \
- $LZ4_SOURCE \
- $LZ4_PATCHLEVEL
-
-fetch_and_patch \
- $BITSHUFFLE_ARCHIVE \
- $BITSHUFFLE_SOURCE \
- $BITSHUFFLE_PATCHLEVEL
-
-fetch_and_patch \
- $TRACE_VIEWER_ARCHIVE \
- $TRACE_VIEWER_SOURCE \
- $TRACE_VIEWER_PATCHLEVEL
-
-fetch_and_patch \
- $BOOST_ARCHIVE \
- $BOOST_SOURCE \
- $BOOST_PATCHLEVEL
-
-fetch_and_patch \
- $BREAKPAD_ARCHIVE \
- $BREAKPAD_SOURCE \
- $BREAKPAD_PATCHLEVEL \
- "${BREAKPAD_PATCHES[@]}"
-
-fetch_and_patch \
- $SPARSEHASH_ARCHIVE \
- $SPARSEHASH_SOURCE \
- $SPARSEHASH_PATCHLEVEL \
- "${SPARSEHASH_PATCHES[@]}"
-
-fetch_and_patch \
- $SPARSEPP_ARCHIVE \
- $SPARSEPP_SOURCE \
- $SPARSEPP_PATCHLEVEL
-
-fetch_and_patch \
- $THRIFT_ARCHIVE \
- $THRIFT_SOURCE \
- $THRIFT_PATCHLEVEL \
- "${THRIFT_PATCHES[@]}"
-
-fetch_and_patch \
- $BISON_ARCHIVE \
- $BISON_SOURCE \
- $BISON_PATCHLEVEL
-
-fetch_and_patch \
- $HIVE_ARCHIVE \
- $HIVE_SOURCE \
- $HIVE_PATCHLEVEL
-
-fetch_and_patch \
- $HADOOP_ARCHIVE \
- $HADOOP_SOURCE \
- $HADOOP_PATCHLEVEL
-
-fetch_and_patch \
- $YAML_ARCHIVE \
- $YAML_SOURCE \
- $YAML_PATCHLEVEL
-
-fetch_and_patch \
- $CHRONY_ARCHIVE \
- $CHRONY_SOURCE \
- $CHRONY_PATCHLEVEL \
- "${CHRONY_PATCHES[@]}"
-
-fetch_and_patch \
- $GUMBO_PARSER_ARCHIVE \
- $GUMBO_PARSER_SOURCE \
- $GUMBO_PARSER_PATCHLEVEL \
- "${GUMBO_PARSER_PATCHES[@]}" \
- "${GUMBO_PARSER_EXTRA_COMMANDS[@]}"
-
-fetch_and_patch \
- $GUMBO_QUERY_ARCHIVE \
- $GUMBO_QUERY_SOURCE \
- $GUMBO_QUERY_PATCHLEVEL \
- "${GUMBO_QUERY_PATCHES[@]}"
-
-fetch_and_patch \
- $POSTGRES_ARCHIVE \
- $POSTGRES_SOURCE \
- $POSTGRES_PATCHLEVEL \
- "${POSTGRES_PATCHES[@]}"
-
-fetch_and_patch \
- $POSTGRES_JDBC_ARCHIVE \
- $POSTGRES_JDBC_SOURCE \
- $POSTGRES_JDBC_PATCHLEVEL
-
-fetch_and_patch \
- $RANGER_ARCHIVE \
- $RANGER_SOURCE \
- $RANGER_PATCHLEVEL \
- "${RANGER_PATCHES[@]}"
-
-fetch_and_patch \
- $JWT_CPP_ARCHIVE \
- $JWT_CPP_SOURCE \
- $JWT_CPP_PATCHLEVEL
-
-fetch_and_patch \
- $RANGER_KMS_ARCHIVE \
- $RANGER_KMS_SOURCE \
- $RANGER_KMS_PATCHLEVEL
-
-fetch_and_patch \
- $ROCKSDB_ARCHIVE \
- $ROCKSDB_SOURCE \
- $ROCKSDB_PATCHLEVEL \
- "${ROCKSDB_PATCHES[@]}"
-
-fetch_and_patch \
- $PROMETHEUS_ARCHIVE \
- $PROMETHEUS_SOURCE \
- $PROMETHEUS_PATCHLEVEL
+TP_COMPONENTS="
+ glog
+ gmock
+ gflags
+ gperftools
+ flatbuffers
+ protobuf
+ cmake
+ snappy
+ zlib
+ libev
+ rapidjson
+ squeasel
+ mustache
+ cpplint
+ gcovr
+ curl
+ crcutil
+ libunwind
+ llvm
+ lz4
+ bitshuffle
+ trace-viewer
+ boost
+ breakpad
+ sparsehash
+ sparsepp
+ thrift
+ bison
+ hive
+ hadoop
+ yaml
+ chrony
+ gumbo-parser
+ gumbo-query
+ postgres
+ postgres-jdbc
+ ranger
+ jwt-cpp
+ ranger-kms
+ rocksdb
+ prometheus
+"
+
+
+# If not using pre-built thirdparty artifacts, fetch all the source archives
+# unconditionally: this simplifies the logic. It is aligned with the most
+# common use case: building everything from scratch (if not built yet).
+if [ "${USE_PREBUILT_THIRDPARTY:-1}" = "0" ]; then
+  for comp in $TP_COMPONENTS; do
+    fetch_and_patch $comp
+  done
+fi
 
 echo "---------------"
 echo "Thirdparty dependencies downloaded successfully"
diff --git a/thirdparty/fetch-utils.sh b/thirdparty/fetch-utils.sh
index be41a4615..526e360fb 100644
--- a/thirdparty/fetch-utils.sh
+++ b/thirdparty/fetch-utils.sh
@@ -140,6 +140,12 @@ fetch_with_url_and_patch() {
   local URL_PREFIX=$4
   # Remaining args are expected to be a list of patch commands
 
+  if [ -z "$TP_SOURCE_DIR" ]; then
+    echo "TP_SOURCE_DIR is not defined"
+    exit 1
+  fi
+  mkdir -p $TP_SOURCE_DIR
+  pushd $TP_SOURCE_DIR
   delete_if_wrong_patchlevel $SOURCE $PATCH_LEVEL
   if [ ! -d $SOURCE ]; then
     fetch_and_expand $FILENAME $SOURCE $URL_PREFIX
@@ -153,15 +159,16 @@ fetch_with_url_and_patch() {
     popd
     echo
   fi
+  popd
 }
 
 # Call fetch_with_url_and_patch with the default dependency URL source.
-fetch_and_patch() {
+fetch_and_patch_src() {
   local FILENAME=$1
   local SOURCE=$2
   local PATCH_LEVEL=$3
-
   shift 3
+
   fetch_with_url_and_patch \
     $FILENAME \
     $SOURCE \
@@ -169,3 +176,49 @@ fetch_and_patch() {
     $DEPENDENCY_URL \
     "$@"
 }
+
+# Deduce all the necessary arguments for 'fetch_and_patch_src' function
+# given the name of a 3rd-party component, and invoke the function.
+fetch_and_patch() {
+  local component=$1
+  if [ -z "$component" ]; then
+    echo "ERROR: first argument (component name) must not be empty" >&2
+    exit 1
+  fi
+  component=$(echo $component | tr '[:lower:]' '[:upper:]' | tr '-' '_')
+
+  # Building variables in the xxx_{NAME,SOURCE,PATCHLEVEL,PATCHES} form
+  # using information provided in vars.sh.
+  local name_var="${component}_NAME"
+  local name="${!name_var}"
+  if [ -z "$name" ]; then
+    echo "ERROR: $name_var isn't defined or empty: check vars.sh" >&2
+    exit 1
+  fi
+
+  local src_var="${component}_NAME"
+  local src="${!src_var}"
+  if [ -z "$src" ]; then
+    echo "ERROR: $src_var isn't defined or empty: check vars.sh" >&2
+    exit 1
+  fi
+
+  local plevel_var="${component}_PATCHLEVEL"
+  local plevel="${!plevel_var}"
+  if [ -z "$plevel" ]; then
+    echo "ERROR: $plevel_var isn't defined or empty: check vars.sh" >&2
+    exit 1
+  fi
+
+  # Namerefs (declare -n ...) aren't available in bash versions prior to 4.3,
+  # so using eval to reconstruct the array locally for wider portability
+  # across bash versions.
+
+  # xxx_PATCHES may be empty if there isn't any patches to apply
+  eval "local patches=(\"\${${component}_PATCHES[@]}\")"
+
+  # xxx_EXTRA_COMMANDS may be empty if there isn't any extra commands to run
+  eval "local extra_commands=(\"\${${component}_EXTRA_COMMANDS[@]}\")"
+
+  fetch_and_patch_src $name.tar.gz $src $plevel "${patches[@]}" "${extra_commands[@]}"
+}
diff --git a/thirdparty/prebuilt-utils.sh b/thirdparty/prebuilt-utils.sh
index f25612dc7..09aa5b548 100644
--- a/thirdparty/prebuilt-utils.sh
+++ b/thirdparty/prebuilt-utils.sh
@@ -363,6 +363,7 @@ fetch_prebuilt_or_build() {
 
   if [ "${USE_PREBUILT_THIRDPARTY:-1}" = "0" ]; then
     create_lib_symlink "$PREFIX"
+    fetch_and_patch "$component"
     invoke_component_build "$component" "$install_subdir"
     apply_post_install "$component" "$install_subdir"
     return
@@ -402,6 +403,7 @@ fetch_prebuilt_or_build() {
   rm -rf "$staging_root"
 
   create_lib_symlink "$staging_root$PREFIX"
+  fetch_and_patch "$component"
   invoke_component_build "$component" "$install_subdir"
   create_prebuilt_tarball "$staging_root" "$tarball_name"
   extract_prebuilt_tarball "$tarball_name" "$install_subdir"