Преглед изворни кода

[Core] Adding Redhat9 support (#3342)

Ayush Goyal пре 2 година
родитељ
комит
0c46dba792
3 измењених фајлова са 58 додато и 6 уклоњено
  1. 14 1
      tools/cloudera/build_hue_cloudera.sh
  2. 41 2
      tools/cloudera/build_hue_common.sh
  3. 3 3
      tools/relocatable.sh

+ 14 - 1
tools/cloudera/build_hue_cloudera.sh

@@ -46,7 +46,11 @@ function install_prerequisite() {
   fi
 
   export SQLITE3_PATH=${SQLITE3_PATH:-"$TOOLS_HOME/sqlite/sqlite3"}
-  check_python_path
+  if [[ $1 != "redhat9" ]]; then
+    check_python38_path
+  else
+    check_python39_path
+  fi
   check_sqlite3
   if [[ $1 == "centos7" ]]; then
     export PYTHON38_PATH=/opt/cloudera/cm-agent
@@ -62,6 +66,8 @@ function install_prerequisite() {
     ubuntu18_install
   elif [[ $1 == "ubuntu20" ]]; then
     ubuntu20_install
+  elif [[ $1 == "redhat9" ]]; then
+    redhat9_install
   fi
 
 }
@@ -88,6 +94,13 @@ export LD_LIBRARY_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_LIBRARY_P
 export LD_RUN_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_RUN_PATH
 export PATH=$HOME/.local/bin:$PYTHON38_PATH/bin:${TOOLS_HOME}/sqlite:/usr/bin:$PATH
 
+if [[ $DOCKEROS == "redhat9" ]]; then
+  export PYTHON_H=$PYTHON39_PATH/include/python3.9/Python.h
+  export PYTHON_VER=python3.9
+  export SYS_PYTHON=$PYTHON39_PATH/bin/python3.9
+  export PATH=$PYTHON39_PATH/bin:$PATH
+fi
+
 HUE_SRC=$(realpath $WORK_DIR/../..)
 export ROOT=$HUE_SRC
 cd $HUE_SRC

+ 41 - 2
tools/cloudera/build_hue_common.sh

@@ -14,15 +14,24 @@ function big_console_header() {
   set -x
 }
 
-function check_python_path() {
+function check_python38_path() {
   export python38_bin="$PYTHON38_PATH/bin/python3.8"
   if [ ! -e "$python38_bin" ]; then
-    echo "Python bin does not exists at " $python38_bin
+    echo "Python38 bin does not exists at " $python38_bin
     exit 1
   fi
   export pip38_bin="$PYTHON38_PATH/bin/pip3.8"
 }
 
+function check_python39_path() {
+  export python39_bin="$PYTHON39_PATH/bin/python3.9"
+  if [ ! -e "$python39_bin" ]; then
+    echo "Python39 bin does not exists at " $python38_bin
+    exit 1
+  fi
+  export pip39_bin="$PYTHON39_PATH/bin/pip3.9"
+}
+
 function check_sqlite3() {
   export sqlit3_bin="$SQLITE3_PATH"
   if [ ! -e "$sqlit3_bin" ]; then
@@ -301,3 +310,33 @@ function ubuntu20_install() {
     export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
   fi
 }
+
+function redhat9_install() {
+  if [[ $FORCEINSTALL -eq 1 ]]; then
+    # pre-req install
+    sudo -- sh -c 'yum install -y \
+      java-11-openjdk \
+      java-11-openjdk-devel \
+      java-11-openjdk-headless \
+      krb5-workstation \
+      ncurses-devel \
+      nmap-ncat \
+      xmlsec1 \
+      xmlsec1-openssl \
+      libss \
+      ncurses-c++-libs'
+    # MySQLdb install
+    sudo -- sh -c 'yum install -y python3-mysqlclient'
+    # NODEJS 14 install
+    sudo -- sh -c 'curl -sL https://rpm.nodesource.com/setup_14.x | bash - && yum install -y nodejs'
+    # Pip modules install
+    sudo pip39_bin=${pip39_bin} -- sh -c '${pip39_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
+    sudo pip39_bin=${pip39_bin} -- sh -c 'ln -fs ${pip39_bin} $(dirname ${pip39_bin})/pip'
+    # sqlite3 install
+    sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
+      tar zxvf sqlite-autoconf-3350500.tar.gz && \
+      cd sqlite-autoconf-3350500 && \
+      ./configure --prefix=/usr/local/ && make && make install'
+    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
+  fi
+}

+ 3 - 3
tools/relocatable.sh

@@ -83,15 +83,15 @@ fi
 
 export PATH=$(dirname $ENV_PYTHON):$PATH
 
-PYVER=$($ENV_PYTHON -V 2>&1|head -c 10)
+PYVER=$($ENV_PYTHON -V 2>&1 | awk '{print $2}' | cut -d '.' -f 1,2)
 # Step 1. Fix virtualenv
-if [[ $PYVER == "Python 3.8" ]]; then
+if [ "$(echo "$PYVER >= 3.8" | bc -l)" -eq 1 ]; then
   pushd .
   cd $HUE_ROOT
   virtualenv-make-relocatable "build/env"
   $ENV_PYTHON $VIRTUAL_BOOTSTRAP --relocatable_pth "build/env"
   popd
-elif [[ $PYVER == "Python 2.7" ]]; then
+elif [ "$(echo "$PYVER == 2.7" | bc -l)" -eq 1 ]; then
   if [ -e "$HUE_ROOT/tools/enable-python27.sh" ]; then
     source $HUE_ROOT/tools/enable-python27.sh
   fi