github-actions[bot] commented on code in PR #66221:
URL: https://github.com/apache/doris/pull/66221#discussion_r3710358262


##########
build.sh:
##########
@@ -453,16 +453,57 @@ if [[ "${TARGET_SYSTEM}" == 'Darwin' ]]; then
 else
     LAST_THIRDPARTY_LIB='hadoop_hdfs/native/libhdfs.a'
 fi
-if [[ ! -f "${DORIS_THIRDPARTY}/installed/lib/${LAST_THIRDPARTY_LIB}" ]]; then
-    echo "Thirdparty libraries need to be build ..."
-    # need remove all installed pkgs because some lib like lz4 will throw 
error if its lib alreay exists
-    rm -rf "${DORIS_THIRDPARTY}/installed"
 
-    if [[ "${CLEAN}" -eq 0 ]]; then
-        bash "${DORIS_THIRDPARTY}/build-thirdparty.sh" -j "${PARALLEL}"
-    else
-        bash "${DORIS_THIRDPARTY}/build-thirdparty.sh" -j "${PARALLEL}" --clean
+# The final-library sentinel only proves that some third-party build 
completed. It cannot
+# distinguish an older prebuilt whose Arrow/Paimon closure predates the 
selected sources.
+# shellcheck source=thirdparty/arrow-paimon-vars.sh
+. "${DORIS_HOME}/thirdparty/arrow-paimon-vars.sh"
+ARROW_PAIMON_THIRDPARTY_VALID=false
+if arrow_paimon_prebuilt_valid "${DORIS_THIRDPARTY}/installed"; then
+    ARROW_PAIMON_THIRDPARTY_VALID=true
+fi
+
+rebuild_thirdparty_libraries() {
+    local remove_installed="$1"
+    shift
+    local build_script="${DORIS_THIRDPARTY}/build-thirdparty.sh"
+    local build_args=(-j "${PARALLEL}")
+    local selected_thirdparty_root
+    local checkout_thirdparty_root
+
+    if [[ ! -f "${build_script}" ]]; then
+        echo "Cannot rebuild thirdparty libraries: ${build_script} is 
missing." >&2
+        echo "DORIS_THIRDPARTY=${DORIS_THIRDPARTY} is an install-only or 
incomplete prefix. Use a matching compilation image/prebuilt, or unset 
DORIS_THIRDPARTY to rebuild with this checkout's thirdparty tree." >&2
+        exit 1
+    fi
+    selected_thirdparty_root="$(cd "${DORIS_THIRDPARTY}" && pwd -P)"
+    checkout_thirdparty_root="$(cd "${DORIS_HOME}/thirdparty" && pwd -P)"
+    if [[ "${selected_thirdparty_root}" != "${checkout_thirdparty_root}" ]]; 
then
+        echo "Cannot rebuild thirdparty libraries with an external source 
tree: ${selected_thirdparty_root}." >&2
+        echo "Unset DORIS_THIRDPARTY to rebuild with this checkout's 
thirdparty tree, then use the resulting version-matched installation." >&2
+        exit 1
+    fi
+    build_script="${checkout_thirdparty_root}/build-thirdparty.sh"
+    if [[ "${remove_installed}" == "true" ]]; then
+        # Some libraries, such as lz4, fail when an earlier installation 
remains.
+        rm -rf "${DORIS_THIRDPARTY}/installed"
     fi
+    if [[ "${CLEAN}" -eq 1 ]]; then
+        build_args+=(--clean)
+    fi
+    bash "${build_script}" "${build_args[@]}" "$@"
+    if ! arrow_paimon_prebuilt_valid "${DORIS_THIRDPARTY}/installed"; then
+        echo "Rebuilt Arrow/Paimon artifacts do not match this checkout's 
selected inputs." >&2
+        exit 1
+    fi
+}
+
+if [[ ! -f "${DORIS_THIRDPARTY}/installed/lib/${LAST_THIRDPARTY_LIB}" ]]; then
+    echo "Thirdparty libraries need to be build ..."
+    rebuild_thirdparty_libraries true
+elif [[ "${ARROW_PAIMON_THIRDPARTY_VALID}" != "true" ]]; then

Review Comment:
   [P2] Preserve the clean-only exit before dependency recovery
   
   For bare `./build.sh --clean`, all build-target flags remain zero, but this 
new stale-marker branch runs before the clean-only exit at lines 545-550. With 
a local stale install it rebuilds Arrow/Paimon (and forwards `--clean`) before 
deleting BE/FE outputs; with an install-only compilation prefix whose legacy 
prebuilt has no component markers, it exits because `build-thirdparty.sh` is 
absent and never cleans anything. Please move the existing clean-only branch 
ahead of third-party validation/recovery, or gate recovery on a target that 
actually consumes native third-party artifacts, and add a bare-clean lifecycle 
case.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to