pan3793 commented on code in PR #4797:
URL: https://github.com/apache/zeppelin/pull/4797#discussion_r1721686600


##########
zeppelin-interpreter/src/main/thrift/genthrift.sh:
##########
@@ -17,13 +17,176 @@
 # * limitations under the License.
 # */
 
-rm -rf gen-java
-rm -rf ../java/org/apache/zeppelin/interpreter/thrift
-thrift --gen java RemoteInterpreterService.thrift
-thrift --gen java RemoteInterpreterEventService.thrift
-for file in gen-java/org/apache/zeppelin/interpreter/thrift/* ; do
-  cat java_license_header.txt ${file} > ${file}.tmp
-  mv -f ${file}.tmp ${file}
-done
-mv gen-java/org/apache/zeppelin/interpreter/thrift 
../java/org/apache/zeppelin/interpreter/thrift
-rm -rf gen-java
+
+THRIFT_VERSION="0.13.0"
+THRIFT_URL="https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz";
+
+check_thrift_installed() {
+    if command -v thrift &> /dev/null; then
+        INSTALLED_VERSION=$(thrift -version 2>&1 | awk '{print $3}')
+        if [ "$INSTALLED_VERSION" == "$THRIFT_VERSION" ]; then
+            return 0  # Return 0 if the same version is installed
+        else
+            echo "Installed Thrift version is $INSTALLED_VERSION, but required 
version is $THRIFT_VERSION."
+            return 1  # Return 1 if a different version is installed
+        fi
+    else
+        echo "Thrift is not installed."
+        return 2  # Return 2 if Thrift is not installed
+    fi
+}
+
+check_openssl_installed() {
+    if command -v openssl &> /dev/null; then
+        OPENSSL_VERSION=$(openssl version | awk '{print $2}')
+        if [[ "$OPENSSL_VERSION" == 1.1* ]]; then
+            echo "OpenSSL 1.1.x is already installed. Version: 
$OPENSSL_VERSION"
+            return 0
+        else
+            echo "OpenSSL is installed, but not version 1.1.x. Current 
version: $OPENSSL_VERSION"
+            return 1
+        fi
+    else
+        echo "OpenSSL is not installed."
+        return 1
+    fi
+}
+
+install_openssl_from_source() {
+    echo "Installing OpenSSL 1.1.x from source..."
+
+    yum groupinstall -y "Development Tools"
+    yum install -y wget perl-core libtool zlib-devel
+
+    cd /usr/local/src
+    wget https://www.openssl.org/source/openssl-1.1.1l.tar.gz
+    tar -xzvf openssl-1.1.1l.tar.gz
+    cd openssl-1.1.1l
+    ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl 
shared zlib
+    make
+    make install
+
+    export PATH="/usr/local/openssl/bin:$PATH"
+    export 
LD_LIBRARY_PATH="/usr/local/openssl/lib:/usr/local/lib64:/usr/lib64:$LD_LIBRARY_PATH"
+
+    echo "OpenSSL 1.1.x installation completed."
+}
+
+install_thrift_ubuntu() {
+    echo "Installing Thrift ${THRIFT_VERSION} on Ubuntu/Debian..."
+
+    apt-get update
+    apt-get install -y software-properties-common
+    apt-get update
+    apt-get install -y thrift-compiler=${THRIFT_VERSION}*
+}
+
+install_thrift_centos() {
+    echo "Installing Thrift ${THRIFT_VERSION} on CentOS..."
+
+    if ! check_openssl_installed; then
+        install_openssl_from_source
+    fi
+
+    yum install -y epel-release
+    yum install -y wget gcc-c++ libevent-devel zlib-devel
+
+    cd /usr/local/src
+    wget ${THRIFT_URL}
+    if [ ! -f "thrift-${THRIFT_VERSION}.tar.gz" ]; then
+        echo "Thrift source file download failed."
+        exit 1
+    fi
+    tar -xzf thrift-${THRIFT_VERSION}.tar.gz
+    cd thrift-${THRIFT_VERSION}
+    ./configure --with-lua=no --with-ruby=no --with-php=no --with-qt4=no 
--with-qt5=no --with-cpp=no
+    make
+    make install
+
+    echo "Thrift ${THRIFT_VERSION} installed successfully."
+}
+
+install_thrift_macos() {
+  echo "Installing Thrift ${THRIFT_VERSION} on macOS..."
+  if command -v brew &> /dev/null; then
+    brew install [email protected]

Review Comment:
   this does not work. and formulae with the suffix `name@<version>` won't be 
added into PATH automaticlly.
   
   ```
   $ brew install [email protected]
   Warning: No available formula with the name "[email protected]". Did you mean 
[email protected]?
   ==> Searching for similarly named formulae and casks...
   ==> Formulae
   [email protected]
   
   To install [email protected], run:
     brew install [email protected]
   ```



-- 
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]

Reply via email to