build_hue_cloudera.sh 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #!/usr/bin/env bash
  2. set -ex
  3. date; date 1>&2
  4. FORCEINSTALL=1
  5. function find_os() {
  6. unameOut="$(uname -s)"
  7. case "${unameOut}" in
  8. Linux*) machine=Linux;;
  9. Darwin*) machine=Mac;;
  10. CYGWIN*) machine=Cygwin;;
  11. MINGW*) machine=MinGw;;
  12. *) machine="UNKNOWN:${unameOut}"
  13. esac
  14. echo ${machine}
  15. }
  16. function find_home() {
  17. runningos=$(find_os)
  18. WORK_DIR=""
  19. if [[ ${runningos} == "Linux" ]]; then
  20. WORK_DIR=$(dirname "$(readlink -f "$0" || echo "$argv0")")
  21. elif [[ ${runningos} == "Mac" ]]; then
  22. WORK_DIR="$( cd "$( dirname "$argv0" )" && pwd )"
  23. else
  24. echo "Not Supported " $runningos
  25. exit 1
  26. fi
  27. echo ${WORK_DIR}
  28. }
  29. WORK_DIR=$(find_home)
  30. . "${WORK_DIR}/build_hue_common.sh"
  31. BUILDTYPE=$1
  32. DOCKEROS=$2
  33. HUE_JAR_VERSION=$3
  34. PYTHON38_OSES=("centos7" "redhat8" "sles12" "ubuntu20" "ubuntu22")
  35. PYTHON39_OSES=("redhat8" "redhat8-arm64" "redhat9" "redhat9-arm64")
  36. PYTHON311_OSES=("redhat8" "redhat8-arm64" "redhat9" "sles15" "ubuntu22" "ubuntu24" "redhat9-arm64")
  37. LATEST_PYTHON="python3.11"
  38. PYTHON_VERSIONS=("python3.11" "python3.9" "python3.8")
  39. export REQ_PYTHON38="3.8.12"
  40. export REQ_PYTHON39="3.9.16"
  41. export REQ_PYTHON311="3.11.12"
  42. export DESKTOP_VERSION=$DOCKEROS
  43. export HUE_WEBPACK_CONFIG='webpack.config.internal.js'
  44. export SQLITE3_PATH=${SQLITE3_PATH:="${TOOLS_HOME}/sqlite/bin/sqlite3"}
  45. export ORACLE_INSTANTCLIENT19_PATH="/opt/toolchain/instantclient_19_15"
  46. export LD_LIBRARY_PATH="/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_LIBRARY_PATH"
  47. export LD_RUN_PATH="/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_RUN_PATH"
  48. export ORIGINAL_PATH=$PATH
  49. setup_python_env() {
  50. local ver="$1" os="$2"
  51. case "$ver" in
  52. python3.8)
  53. if is_supported_os PYTHON38_OSES "$os"; then
  54. export PYTHON38_PATH=${PYTHON38_PATH:=/opt/python/3.8.12}
  55. if is_supported_python_version "$PYTHON38_PATH/bin/python3.8" $REQ_PYTHON38; then
  56. export PATH="$PYTHON38_PATH/bin:$PATH"
  57. else
  58. unset PYTHON38_PATH
  59. fi
  60. fi
  61. ;;
  62. python3.9)
  63. if is_supported_os PYTHON39_OSES "$os"; then
  64. export PYTHON39_PATH=${PYTHON39_PATH:=/opt/python/3.9.16}
  65. if is_supported_python_version "$PYTHON39_PATH/bin/python3.9" $REQ_PYTHON39; then
  66. export PATH="$PYTHON39_PATH/bin:$PATH"
  67. else
  68. unset PYTHON39_PATH
  69. fi
  70. fi
  71. ;;
  72. python3.11)
  73. if is_supported_os PYTHON311_OSES "$os"; then
  74. export PYTHON311_PATH=${PYTHON311_PATH:=/opt/python/3.11.12}
  75. if is_supported_python_version "$PYTHON311_PATH/bin/python3.11" $REQ_PYTHON311; then
  76. export PATH="$PYTHON311_PATH/bin:$PATH"
  77. else
  78. unset PYTHON311_PATH
  79. fi
  80. fi
  81. ;;
  82. *) echo "Unsupported python version: $ver"; exit 1 ;;
  83. esac
  84. }
  85. install_prerequisite() {
  86. local os="$1"
  87. case "$os" in
  88. centos7) centos7_install "$os";;
  89. redhat8|snapshot) redhat8_install "$os";;
  90. redhat9) redhat9_install "$os";;
  91. sles12) sles12_install "$os";;
  92. sles15) sles15_install "$os";;
  93. ubuntu18) ubuntu18_install "$os";;
  94. ubuntu20) ubuntu20_install "$os";;
  95. ubuntu22) ubuntu22_install "$os";;
  96. ubuntu24) ubuntu24_install "$os";;
  97. redhat8-arm64) redhat8_arm64_install "$os";;
  98. redhat9-arm64) redhat9_arm64_install "$os";;
  99. *) echo "Unsupported OS: $os"; exit 1 ;;
  100. esac
  101. export SQLITE3_PATH=${SQLITE3_PATH:-"$TOOLS_HOME/sqlite/bin/sqlite3"}
  102. }
  103. should_build_python() {
  104. local ver="$1"
  105. local os="$2"
  106. case "$ver" in
  107. python3.11)
  108. is_supported_os PYTHON311_OSES "$os"
  109. return $?
  110. ;;
  111. python3.9)
  112. is_supported_os PYTHON39_OSES "$os"
  113. return $?
  114. ;;
  115. python3.8)
  116. is_supported_os PYTHON38_OSES "$os"
  117. return $?
  118. ;;
  119. *)
  120. return 1
  121. ;;
  122. esac
  123. return 1
  124. }
  125. for PYTHON_VER in "${PYTHON_VERSIONS[@]}"; do
  126. setup_python_env "$PYTHON_VER" "$DOCKEROS"
  127. done
  128. big_console_header "Hue PreRequisite Start for $DOCKEROS"
  129. install_prerequisite "$DOCKEROS"
  130. big_console_header "Hue PreRequisite End for $DOCKEROS"
  131. THISPATH=$PATH
  132. for PYTHON_VER in "${PYTHON_VERSIONS[@]}"; do
  133. HUE_SRC=$(realpath "$WORK_DIR/../..")
  134. cd "$HUE_SRC" || exit 1
  135. if should_build_python "$PYTHON_VER" "$DOCKEROS"; then
  136. BLD_DIR="${BLD_DIR:-$HUE_SRC/build}"
  137. BLD_DIR_ENV="$BLD_DIR/venvs/${PYTHON_VER}"
  138. [[ "$PYTHON_VER" == "python3.11" || "$DOCKEROS" =~ (sles12|centos7|ubuntu20) ]] && BLD_DIR_ENV="$BLD_DIR/env"
  139. echo "BLD_DIR_ENV=${BLD_DIR_ENV}"
  140. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ORACLE_INSTANTCLIENT19_PATH}
  141. export PATH=$PYTHON38_PATH/bin:$PYTHON39_PATH/bin:$PYTHON311_PATH/bin:/opt/sqlite3/bin:/usr/bin:$THISPATH
  142. big_console_header "Hue Build Start for" "$PYTHON_VER" "$@"
  143. BLD_DIR_ENV="$BLD_DIR_ENV" PYTHON_VER="$PYTHON_VER" make apps docs
  144. BLD_DIR_ENV="$BLD_DIR_ENV" PYTHON_VER="$PYTHON_VER" make relocatable-env
  145. BLD_DIR_ENV="$BLD_DIR_ENV" PYTHON_VER="$PYTHON_VER" make huecheck
  146. big_console_header "Hue Build End for" "$PYTHON_VER" "$@"
  147. fi
  148. done
  149. big_console_header "Hue PROD Build Start for" "$@"
  150. if [[ "$DOCKEROS" =~ (centos7|sles12|ubuntu18) ]]; then
  151. PYTHON_VER="python3.8" make release
  152. else
  153. PYTHON_VER="python3.11" make release
  154. fi
  155. big_console_header "Hue PROD Build End for" "$@"