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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 5ce523852ab797b977fab3b40a2a6da184ba4991
Author: Adonis Ling <adonis0...@gmail.com>
AuthorDate: Thu Dec 29 16:01:23 2022 +0800

    [chore](thirdparty) Support cleaning extracted data before building them 
(#15458)
    
    Currently, we may fail to build the third-party libraries if we keep the 
outdated extracted data.
    
    Considering the following scenario, Bob added patches to some libraries and 
Alice updates the codebase and builds
    the third-party libraries. If Alice kept the outdated extracted data, she 
should fail to build the third-party libraries
    because the patches are not applied due to the outdated `patched_marks`.
    
    This PR introduces a way to clean the outdated data before building the 
third-party libraries.
---
 thirdparty/build-thirdparty.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index 45200bf7ce..6e64b89f5c 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -49,6 +49,7 @@ usage() {
 Usage: $0 <options>
   Optional options:
      -j                 build thirdparty parallel
+     --clean            clean the extracted data
   "
     exit 1
 }
@@ -58,6 +59,7 @@ if ! OPTS="$(getopt \
     -o '' \
     -o 'h' \
     -l 'help' \
+    -l 'clean' \
     -o 'j:' \
     -- "$@")"; then
     usage
@@ -88,6 +90,10 @@ if [[ "$#" -ne 1 ]]; then
             HELP=1
             shift
             ;;
+        --clean)
+            CLEAN=1
+            shift
+            ;;
         --)
             shift
             break
@@ -102,11 +108,11 @@ fi
 
 if [[ "${HELP}" -eq 1 ]]; then
     usage
-    exit
 fi
 
 echo "Get params:
     PARALLEL            -- ${PARALLEL}
+    CLEAN               -- ${CLEAN}
 "
 
 if [[ ! -f "${TP_DIR}/download-thirdparty.sh" ]]; then
@@ -123,6 +129,12 @@ fi
 
 cd "${TP_DIR}"
 
+if [[ "${CLEAN}" -eq 1 ]] && [[ -d "${TP_SOURCE_DIR}" ]]; then
+    echo 'Clean the extracted data ...'
+    find "${TP_SOURCE_DIR}" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} \;
+    echo 'Success!'
+fi
+
 # Download thirdparties.
 "${TP_DIR}/download-thirdparty.sh"
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to