From 067826b3ee9457709046ae9d60eba832084f5852 Mon Sep 17 00:00:00 2001 From: Dianjin Wang Date: Tue, 10 Mar 2026 12:10:09 +0800 Subject: [PATCH] Update Makefile to include fdw in DEB/RPM --- Makefile | 17 +++++++++++++++-- package/DEBIAN/postinst | 7 ++++++- package/README.md | 2 +- package/cloudberry-pxf.spec | 5 +++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 826ed8d6..00079649 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ export PXF_VERSION export SKIP_EXTERNAL_TABLE_BUILD_REASON export SKIP_FDW_BUILD_REASON +export SKIP_EXTERNAL_TABLE_PACKAGE_REASON +export SKIP_FDW_PACKAGE_REASON SOURCE_EXTENSION_DIR = external-table TARGET_EXTENSION_DIR = gpextable @@ -65,7 +67,7 @@ it: install: ifneq ($(SKIP_EXTERNAL_TABLE_BUILD_REASON),) - @echo "Skipping installing FDW extension because $(SKIP_EXTERNAL_TABLE_BUILD_REASON)" + @echo "Skipping installing external-table extension because $(SKIP_EXTERNAL_TABLE_BUILD_REASON)" $(eval PXF_MODULES := $(filter-out external-table,$(PXF_MODULES))) endif ifneq ($(SKIP_FDW_BUILD_REASON),) @@ -85,10 +87,15 @@ install-server: stage: rm -rf build/stage make -C $(SOURCE_EXTENSION_DIR) stage +ifeq ($(SKIP_FDW_PACKAGE_REASON),) + make -C fdw stage +else + @echo "Skipping staging FDW extension because $(SKIP_FDW_PACKAGE_REASON)" +endif make -C cli stage make -C server stage ifneq ($(SKIP_EXTERNAL_TABLE_PACKAGE_REASON),) - @echo "Skipping staging FDW extension because $(SKIP_EXTERNAL_TABLE_PACKAGE_REASON)" + @echo "Skipping staging external-table extension because $(SKIP_EXTERNAL_TABLE_PACKAGE_REASON)" $(eval PXF_MODULES := $(filter-out external-table,$(PXF_MODULES))) endif ifneq ($(SKIP_FDW_PACKAGE_REASON),) @@ -101,6 +108,9 @@ endif PXF_PACKAGE_NAME=pxf-cloudberry$${GP_MAJOR_VERSION}-$${PXF_VERSION}-$${GP_BUILD_ARCH} ;\ mkdir -p build/stage/$${PXF_PACKAGE_NAME} ;\ cp -a $(SOURCE_EXTENSION_DIR)/build/stage/* build/stage/$${PXF_PACKAGE_NAME} ;\ + if [[ -z "$${SKIP_FDW_PACKAGE_REASON:-}" ]]; then \ + cp -a fdw/build/stage/* build/stage/$${PXF_PACKAGE_NAME} ;\ + fi ;\ cp -a cli/build/stage/* build/stage/$${PXF_PACKAGE_NAME} ;\ cp -a server/build/stage/* build/stage/$${PXF_PACKAGE_NAME} ;\ echo $$(git rev-parse --verify HEAD) > build/stage/$${PXF_PACKAGE_NAME}/commit.sha ;\ @@ -169,6 +179,9 @@ deb: stage rm -rf build/debbuild ;\ mkdir -p build/debbuild/usr/local/cloudberry-pxf/$(TARGET_EXTENSION_DIR) ;\ cp -a $(SOURCE_EXTENSION_DIR)/build/stage/* build/debbuild/usr/local/cloudberry-pxf/ ;\ + if [[ -z "$${SKIP_FDW_PACKAGE_REASON:-}" ]] && [[ -d fdw/build/stage ]]; then \ + cp -a fdw/build/stage/* build/debbuild/usr/local/cloudberry-pxf/ ;\ + fi ;\ cp -a cli/build/stage/* build/debbuild/usr/local/cloudberry-pxf ;\ cp -a server/build/stage/* build/debbuild/usr/local/cloudberry-pxf ;\ echo $$(git rev-parse --verify HEAD) > build/debbuild/usr/local/cloudberry-pxf/commit.sha ;\ diff --git a/package/DEBIAN/postinst b/package/DEBIAN/postinst index 35578858..46270d49 100755 --- a/package/DEBIAN/postinst +++ b/package/DEBIAN/postinst @@ -1,4 +1,9 @@ #!/bin/sh sed -i "s|directory =.*|directory = '/usr/local/cloudberry-pxf/gpextable/'|g" "/usr/local/cloudberry-pxf/gpextable/pxf.control" -sed -i "s|module_pathname =.*|module_pathname = '/usr/local/cloudberry-pxf/gpextable/pxf'|g" "/usr/local/cloudberry-pxf/gpextable/pxf.control" \ No newline at end of file +sed -i "s|module_pathname =.*|module_pathname = '/usr/local/cloudberry-pxf/gpextable/pxf'|g" "/usr/local/cloudberry-pxf/gpextable/pxf.control" + +if [ -f "/usr/local/cloudberry-pxf/fdw/pxf_fdw.control" ]; then + sed -i "s|directory =.*|directory = '/usr/local/cloudberry-pxf/fdw/'|g" "/usr/local/cloudberry-pxf/fdw/pxf_fdw.control" + sed -i "s|module_pathname =.*|module_pathname = '/usr/local/cloudberry-pxf/fdw/pxf_fdw'|g" "/usr/local/cloudberry-pxf/fdw/pxf_fdw.control" +fi diff --git a/package/README.md b/package/README.md index e235b0a1..025b42a6 100644 --- a/package/README.md +++ b/package/README.md @@ -3,7 +3,7 @@ PXF Packaging Apache Cloudberry PXF (Platform Extension Framework) consists of 3 groups of artifacts, each developed using a different underlying technology: -* Apache Cloudberry extension -- written in C; when built, produces a `pxf.so` library and configuration files +* Apache Cloudberry extensions -- written in C; when built, produces the `pxf` (external table) and `pxf_fdw` (foreign data wrapper) libraries and extension files * PXF Server -- written in Java; when built, produces a `pxf.war` file, Tomcat server, dependent JAR files, templates and scripts * Script Cluster Plugin -- written in Go; when built, produces a `pxf-cli` executable diff --git a/package/cloudberry-pxf.spec b/package/cloudberry-pxf.spec index 24fea781..6ee9bf36 100644 --- a/package/cloudberry-pxf.spec +++ b/package/cloudberry-pxf.spec @@ -84,6 +84,11 @@ fi sed -i "s|directory =.*|directory = '${RPM_INSTALL_PREFIX}/gpextable/'|g" "${RPM_INSTALL_PREFIX}/gpextable/pxf.control" sed -i "s|module_pathname =.*|module_pathname = '${RPM_INSTALL_PREFIX}/gpextable/pxf'|g" "${RPM_INSTALL_PREFIX}/gpextable/pxf.control" +if [ -f "${RPM_INSTALL_PREFIX}/fdw/pxf_fdw.control" ]; then + sed -i "s|directory =.*|directory = '${RPM_INSTALL_PREFIX}/fdw/'|g" "${RPM_INSTALL_PREFIX}/fdw/pxf_fdw.control" + sed -i "s|module_pathname =.*|module_pathname = '${RPM_INSTALL_PREFIX}/fdw/pxf_fdw'|g" "${RPM_INSTALL_PREFIX}/fdw/pxf_fdw.control" +fi + # Change ownership to gpadmin.gpadmin if the gpadmin user exists if id "gpadmin" &>/dev/null; then chown -R gpadmin:gpadmin ${RPM_INSTALL_PREFIX}