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

boroknagyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit f4c0c396ff63cde12705fbd87b49d4c254061bc3
Author: Abhishek Rawat <[email protected]>
AuthorDate: Sat Jun 21 11:35:46 2025 -0700

    IMPALA-14175: Generate impala-udf-devel package using the build script
    
    Added '-udf_devel_package' option to buildall.sh. This generates
    impala-udf-devel rpm which includes udf headers and static libraries -
    ImpalaUdf-retail.a and ImpalaUdf-debug.a.
    
    Testing:
    - Tested that rpm is generated using build script:
     ./buildall.sh -release_and_debug -notests -udf_devel_package
    - Tested that the rpm is also generated using standalone script:
     ./bin/make-impala-udf-devel-rpm.sh
    - Generated impala-udf-devel package and tested compiling
    impala_udf_samples:
    https://github.com/cloudera/impala-udf-samples
    
    Change-Id: I5b85df9c3f680a7e5551f067a97a5650daba9b50
    Reviewed-on: http://gerrit.cloudera.org:8080/23060
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 bin/impala-udf-devel.spec        | 54 +++++++++++++++++++++++++++++
 bin/make-impala-udf-devel-rpm.sh | 74 ++++++++++++++++++++++++++++++++++++++++
 buildall.sh                      | 15 +++++++-
 3 files changed, 142 insertions(+), 1 deletion(-)

diff --git a/bin/impala-udf-devel.spec b/bin/impala-udf-devel.spec
new file mode 100644
index 000000000..d8d8dc4de
--- /dev/null
+++ b/bin/impala-udf-devel.spec
@@ -0,0 +1,54 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Name:           impala-udf-devel
+Version:        %{version}
+Release:        1%{?dist}
+Summary:        Apache Impala UDF development package
+
+License:        Apache-2.0
+Group:          Development/Libraries
+Source0:        %{name}-%{version}.tar.gz
+
+# some rhel distros error out if there are no symbols or source files so
+# skip creating -debuginfo subpackage
+%global debug_package %{nil}
+
+%description
+This RPM provides Apache Impala UDF headers, and shared library.
+
+%prep
+%setup -q
+
+%build
+
+%install
+mkdir -p %{buildroot}/usr/include/impala_udf
+cp -a usr/include/impala_udf/* %{buildroot}/usr/include/impala_udf/
+
+mkdir -p %{buildroot}/usr/lib64
+cp -a usr/lib64/* %{buildroot}/usr/lib64/
+
+%files
+/usr/include/impala_udf/uda-test-harness-impl.h
+/usr/include/impala_udf/uda-test-harness.h
+/usr/include/impala_udf/udf-debug.h
+/usr/include/impala_udf/udf-test-harness.h
+/usr/include/impala_udf/udf.h
+/usr/lib64/libImpalaUdf-debug.a
+/usr/lib64/libImpalaUdf-retail.a
+
diff --git a/bin/make-impala-udf-devel-rpm.sh b/bin/make-impala-udf-devel-rpm.sh
new file mode 100755
index 000000000..7438a8c80
--- /dev/null
+++ b/bin/make-impala-udf-devel-rpm.sh
@@ -0,0 +1,74 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -e
+
+VERSION=${IMPALA_VERSION%%-*}
+PKG_NAME=impala-udf-devel
+TOPDIR=${IMPALA_HOME}/${PKG_NAME}-rpmbuild
+SRC_DIR=${IMPALA_HOME}/${PKG_NAME}-${VERSION}
+INCLUDE_DIR=${SRC_DIR}/usr/include/impala_udf
+LIB_DIR=${SRC_DIR}/usr/lib64
+SPEC_FILE=impala-udf-devel.spec
+
+rm -rf "$SRC_DIR"
+mkdir -p "$INCLUDE_DIR" "$LIB_DIR"
+
+cp be/src/udf/uda-test-harness-impl.h \
+  be/src/udf/uda-test-harness.h \
+  be/src/udf/udf-debug.h \
+  be/src/udf/udf-test-harness.h \
+  be/src/udf/udf.h "$INCLUDE_DIR/"
+
+# UDF SDK uses impala_udf namespace to avoid namespace collision
+sed -i 's|#include "udf/\(.*\)"|#include <impala_udf/\1>|' ${INCLUDE_DIR}/*.h
+
+SO_ORIG=$(find be/build/release/udf -name libImpalaUdf.a | head -n1)
+if [ -z "$SO_ORIG" ]; then
+  echo "be/build/release/udf/libImpalaUdf.a not found."
+  echo "Build with ./buildall.sh -release_and_debug -notests 
-udf_devel_package."
+  exit 1
+fi
+
+cp "$SO_ORIG" "$LIB_DIR/libImpalaUdf-retail.a"
+
+SO_ORIG=$(find be/build/debug/udf -name libImpalaUdf.a | head -n1)
+if [ -z "$SO_ORIG" ]; then
+  echo "be/build/debug/udf/libImpalaUdf.a not found."
+  echo "Build with ./buildall.sh -release_and_debug -notests 
-udf_devel_package."
+  exit 1
+fi
+
+cp "$SO_ORIG" "$LIB_DIR/libImpalaUdf-debug.a"
+
+cd ~
+mkdir -p "$TOPDIR"/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
+tar czf "$TOPDIR/SOURCES/${PKG_NAME}-${VERSION}.tar.gz" -C \
+  "${IMPALA_HOME}" "${PKG_NAME}-${VERSION}"
+
+echo "Copying .spec file..."
+cp "${IMPALA_HOME}/bin/$SPEC_FILE" "$TOPDIR/SPECS/"
+
+echo "Building RPM..."
+rpmbuild -ba "$TOPDIR/SPECS/$SPEC_FILE" --define "_topdir $TOPDIR" \
+  --define "version ${VERSION}"
+
+echo "Done. RPM available at:"
+find "$TOPDIR/RPMS" -name "${PKG_NAME}*.rpm"
+
diff --git a/buildall.sh b/buildall.sh
index bca291789..f06c043b0 100755
--- a/buildall.sh
+++ b/buildall.sh
@@ -78,6 +78,7 @@ BUILD_TSAN=0
 BUILD_TSAN_FULL=0
 BUILD_DEBUG_NOOPT=0
 BUILD_SHARED_LIBS=0
+UDF_DEVEL=0
 # Export MAKE_CMD so it is visible in scripts that invoke make, e.g. 
copy-udfs-udas.sh
 export MAKE_CMD=make
 
@@ -208,6 +209,9 @@ do
     -package)
       GEN_PACKAGE=1
       ;;
+    -udf_devel_package)
+      UDF_DEVEL=1
+      ;;
     -help|*)
       echo "buildall.sh - Builds Impala and runs all tests."
       echo "[-noclean] : Omits cleaning all packages before building. Will not 
kill"\
@@ -263,6 +267,7 @@ do
       echo "[-ninja] : Use ninja instead of make"
       echo "[-cmake_only] : Generate makefiles only, instead of doing a full 
build"
       echo "[-package] : Generate a package for deployment."
+      echo "[-udf_devel_package] : Generate UDF development package."
       echo 
"-----------------------------------------------------------------------------
 Examples of common tasks:
 
@@ -294,7 +299,10 @@ Examples of common tasks:
   ./buildall.sh -testdata -format
 
   # Build and upgrade metastore schema to latest.
-  ./buildall.sh -upgrade_metastore_db"
+  ./buildall.sh -upgrade_metastore_db
+
+  # Build and generate UDF development package.
+  ./buildall.sh -release_and_debug -notests -udf_devel_package"
       exit 1
       ;;
     esac
@@ -725,3 +733,8 @@ if [[ ${NEEDS_RE_SOURCE_NOTE} -eq 1 ]]; then
   echo "   . \"${IMPALA_HOME}/bin/impala-config.sh\""
   echo
 fi
+
+if [[ ${UDF_DEVEL} -eq 1 ]]; then
+  echo "Building ImpalaUdf-retail & ImpalaUdf-debug RPM via 
make_impala_udf_retail_rpm.sh"
+  "${IMPALA_HOME}/bin/make-impala-udf-devel-rpm.sh"
+fi

Reply via email to