build_hue_cloudera.sh 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #!/usr/bin/env bash
  2. set -ex
  3. # Time marker for both stderr and stdout
  4. date; date 1>&2
  5. FORCEINSTALL=1
  6. function find_os() {
  7. unameOut="$(uname -s)"
  8. case "${unameOut}" in
  9. Linux*) machine=Linux;;
  10. Darwin*) machine=Mac;;
  11. CYGWIN*) machine=Cygwin;;
  12. MINGW*) machine=MinGw;;
  13. *) machine="UNKNOWN:${unameOut}"
  14. esac
  15. echo ${machine}
  16. }
  17. function find_home() {
  18. runningos=$(find_os)
  19. WORK_DIR=""
  20. if [[ ${runningos} == "Linux" ]]; then
  21. WORK_DIR=$(dirname "$(readlink -f "$0" || echo "$argv0")")
  22. elif [[ ${runningos} == "Mac" ]]; then
  23. WORK_DIR="$( cd "$( dirname "$argv0" )" && pwd )"
  24. else
  25. echo "Not Supported " $runningos
  26. exit 1
  27. fi
  28. echo ${WORK_DIR}
  29. }
  30. function install_prerequisite() {
  31. if [[ $1 == "redhat9_ppc" ]]; then
  32. export FORCEINSTALL=0
  33. export SQLITE3_PATH="$TOOLS_HOME/sqlite/bin/sqlite3"
  34. redhat9_ppc_install
  35. elif [[ $1 == "redhat8_ppc" ]]; then
  36. export FORCEINSTALL=0
  37. export SQLITE3_PATH="$TOOLS_HOME/sqlite/bin/sqlite3"
  38. redhat8_ppc_install
  39. elif [[ $1 == "redhat7_ppc" ]]; then
  40. export FORCEINSTALL=0
  41. export SQLITE3_PATH="$TOOLS_HOME/sqlite/bin/sqlite3"
  42. redhat7_ppc_install
  43. fi
  44. export SQLITE3_PATH=${SQLITE3_PATH:-"$TOOLS_HOME/sqlite/bin/sqlite3"}
  45. # check_sqlite3
  46. if [[ $1 == "centos7" ]]; then
  47. export PYTHON38_PATH=/opt/cloudera/cm-agent
  48. export pip38_bin="$PYTHON38_PATH/bin/pip3.8"
  49. centos7_install
  50. elif [[ $1 == "redhat8" || $1 == "snapshot" ]]; then
  51. redhat8_install
  52. elif [[ $1 == "sles12" ]]; then
  53. sles12_install
  54. export PATH=/usr/lib/mit/bin:$PATH
  55. elif [[ $1 == "sles15" ]]; then
  56. sles15_install
  57. export PATH=/usr/lib/mit/bin:$PATH
  58. elif [[ $1 == "ubuntu18" ]]; then
  59. ubuntu18_install
  60. elif [[ $1 == "ubuntu20" ]]; then
  61. ubuntu20_install
  62. elif [[ $1 == "redhat9" ]]; then
  63. redhat9_install
  64. elif [[ $1 == "ubuntu22" ]]; then
  65. ubuntu22_install
  66. elif [[ $1 == "redhat8-arm64" ]]; then
  67. redhat8_arm64_install
  68. fi
  69. }
  70. WORK_DIR=$(find_home)
  71. . ${WORK_DIR}/build_hue_common.sh
  72. BUILDTYPE=$1
  73. DOCKEROS=$2
  74. HUE_JAR_VERSION=$3
  75. export VIRTUAL_ENV_VERSION="20.24.4"
  76. export VIRTUAL_ENV_RELOCATABLE_VERSION="0.0.1"
  77. export DESKTOP_VERSION=$2
  78. export HUE_WEBPACK_CONFIG='webpack.config.internal.js'
  79. export PATH="$PYTHON38_PATH/bin:$PATH"
  80. export SYS_PYTHON="$PYTHON38_PATH/bin/python3.8"
  81. export SYS_PIP="$PYTHON38_PATH/bin/pip3.8"
  82. export SQLITE3_PATH=${SQLITE3_PATH:="${TOOLS_HOME}/sqlite/bin/sqlite3"}
  83. export ORACLE_INSTANTCLIENT19_PATH="/opt/toolchain/instantclient_19_15"
  84. export LD_LIBRARY_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_LIBRARY_PATH
  85. export LD_RUN_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_RUN_PATH
  86. PYTHON_VERSIONS=("python3.11" "python3.9" "python3.8")
  87. for PYTHON_VER in "${PYTHON_VERSIONS[@]}"; do
  88. if [[ $PYTHON_VER == "python3.8" && ( $DOCKEROS == "redhat7_ppc" || $DOCKEROS == "redhat8" || $DOCKEROS == "redhat8_ppc" || $DOCKEROS == "sles12" || $DOCKEROS == "centos7" || $DOCKEROS == "ubuntu18" || $DOCKEROS == "ubuntu20" || $DOCKEROS == "ubuntu22" ) ]]; then
  89. check_python38_path
  90. export PATH="$PYTHON38_PATH/bin:$PATH"
  91. export SYS_PYTHON="$PYTHON38_PATH/bin/python3.8"
  92. export SYS_PIP="$PYTHON38_PATH/bin/pip3.8"
  93. export VIRTUAL_ENV_VERSION="20.24.4"
  94. elif [[ $PYTHON_VER == "python3.9" && ( $DOCKEROS == "redhat9" || $DOCKEROS == "redhat8" || $DOCKEROS == "redhat9_ppc" || $DOCKEROS == "redhat8-arm64" ) ]]; then
  95. check_python39_path
  96. export PATH="$PYTHON39_PATH/bin:$PATH"
  97. export SYS_PYTHON="$PYTHON39_PATH/bin/python3.9"
  98. export SYS_PIP="$PYTHON39_PATH/bin/pip3.9"
  99. export VIRTUAL_ENV_VERSION="20.19.0"
  100. elif [[ $PYTHON_VER == "python3.11" && ( $DOCKEROS == "redhat9" || $DOCKEROS == "redhat8" || $DOCKEROS == "sles15" || $DOCKEROS == "redhat8-arm64" ) ]]; then
  101. check_python311_path
  102. export PATH="$PYTHON311_PATH/bin:$PATH"
  103. export SYS_PYTHON="$PYTHON311_PATH/bin/python3.11"
  104. export SYS_PIP="$PYTHON311_PATH/bin/pip3.11"
  105. export VIRTUAL_ENV_VERSION="20.24.4"
  106. else
  107. continue
  108. fi
  109. big_console_header "Hue PreRequisite Start for" $PYTHON_VER "$@"
  110. install_prerequisite $DOCKEROS
  111. big_console_header "Hue PreRequisite End for" $PYTHON_VER "$@"
  112. HUE_SRC=$(realpath "$WORK_DIR/../..")
  113. cd "$HUE_SRC" || exit 1
  114. BLD_DIR="${BLD_DIR:-build}" # Default build directory if not set
  115. if [[ $PYTHON_VER == "python3.11" ]]; then
  116. BLD_DIR_ENV="${BLD_DIR}/env"
  117. else
  118. BLD_DIR_ENV="${BLD_DIR}/venvs/${PYTHON_VER}"
  119. fi
  120. echo "BLD_DIR_ENV=${BLD_DIR_ENV}"
  121. big_console_header "Hue Build Start for" $PYTHON_VER "$@"
  122. PYTHON_VER=$PYTHON_VER make apps docs relocatable-env huecheck
  123. big_console_header "Hue Build End for" $PYTHON_VER "$@"
  124. done
  125. big_console_header "Hue PROD Build Start for" "$@"
  126. make release
  127. big_console_header "Hue PROD Build End for" "$@"