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

leborchuk pushed a commit to branch REL_2_STABLE
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 1dfe22a81f65a39198eb6876d260a5137c161db0
Author: Dianjin Wang <[email protected]>
AuthorDate: Fri Aug 28 16:04:18 2026 +0800

    Packaging: fix unsatisfiable self-dependencies on bundled sonames
    
    %__provides_exclude_from drops the auto-generated Provides for every
    shared object under the install prefix, while %__requires_exclude only
    removes a hand-maintained list of sonames from the auto-generated
    Requires. The .so symlinks the package ships (libfoo.so -> libfoo.so.N.M)
    make rpm emit a Requires on libfoo.so.N, so any bundled library missing
    from that list turns into an external dependency.
    
    REL_2_STABLE builds src/interfaces with SUBDIRS = libpq ecpg gppc, where
    main builds libpq only, so the package additionally ships libecpg.so.6,
    libecpg_compat.so.3, libpgtypes.so.3 and libgppc.so.1. None of them were
    covered, and installing the RPM failed with:
    
      nothing provides libecpg_compat.so.3()(64bit) needed by ...
      nothing provides libgppc.so.1()(64bit) needed by ...
    
    libecpg.so.6 and libpgtypes.so.3 did not fail the install, they resolved
    against system libraries instead of the bundled ones, which is equally
    wrong.
    
    Add the four sonames to %__requires_exclude, and make build-rpm.sh reject
    any package whose auto-generated Requires names a soname the package
    itself installs, so the two filters cannot drift apart unnoticed again.
---
 .../rpm/apache-cloudberry-db-incubating.spec       |  8 ++++-
 devops/build/packaging/rpm/build-rpm.sh            | 40 ++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/devops/build/packaging/rpm/apache-cloudberry-db-incubating.spec 
b/devops/build/packaging/rpm/apache-cloudberry-db-incubating.spec
index 707af2352eb..22be01e0e54 100644
--- a/devops/build/packaging/rpm/apache-cloudberry-db-incubating.spec
+++ b/devops/build/packaging/rpm/apache-cloudberry-db-incubating.spec
@@ -39,7 +39,13 @@
 
 # Do not require these bundled libraries from the system;
 # they are shipped inside the package and located via RPATH.
-%global __requires_exclude 
^(libpax\.so|libpaxformat\.so|libpostgres\.so|libpq\.so\.5|libxerces-c-3\.3\.so)
+#
+# This list must cover every soname the package installs, because
+# __provides_exclude_from above drops the matching Provides: the .so
+# symlinks we ship (libfoo.so -> libfoo.so.N.M) make rpm generate a
+# Requires on libfoo.so.N, which would otherwise be resolved outside the
+# package -- or not at all.  build-rpm.sh verifies the two stay in sync.
+%global __requires_exclude 
^(libecpg\.so|libecpg_compat\.so|libgppc\.so|libpax\.so|libpaxformat\.so|libpgtypes\.so|libpostgres\.so|libpq\.so\.5|libxerces-c-3\.3\.so)
 
 # Default to non-debug build
 %bcond_with debug
diff --git a/devops/build/packaging/rpm/build-rpm.sh 
b/devops/build/packaging/rpm/build-rpm.sh
index bc284c73cd0..6b893206990 100755
--- a/devops/build/packaging/rpm/build-rpm.sh
+++ b/devops/build/packaging/rpm/build-rpm.sh
@@ -224,5 +224,45 @@ for rpm_path in 
"${RPMS_DIR}"/*/apache-cloudberry-db-incubating-"${MAJOR_VERSION
 done
 shopt -u nullglob
 
+# Verify that the package does not depend on sonames it ships itself.
+#
+# The spec drops the auto-generated Provides for every shared object under
+# the install prefix (%__provides_exclude_from, a path pattern) but removes
+# only a hand-maintained list of sonames from the auto-generated Requires
+# (%__requires_exclude, a name pattern).  The .so symlinks in the package
+# (libfoo.so -> libfoo.so.N.M) make rpm emit a Requires on libfoo.so.N, so
+# whenever a bundled library is missing from that list the dependency turns
+# into an external one.  Such a package either fails to install ("nothing
+# provides libfoo.so.N") or silently resolves against a system library.
+#
+# rpmbuild cannot detect this, and the failure only surfaces in downstream
+# install jobs, so check it here while the failing artifact is at hand.
+shopt -s nullglob
+for rpm_path in 
"${RPMS_DIR}"/*/apache-cloudberry-db-incubating-*"${VERSION}"-*.rpm; do
+  case "$rpm_path" in
+    *debuginfo*|*debugsource*) continue ;;
+  esac
+
+  required_sonames="$(mktemp)"
+  shipped_sonames="$(mktemp)"
+
+  # "libfoo.so.1(GLIBC_2.34)(64bit)" -> "libfoo.so.1"
+  rpm -qp --requires "$rpm_path" | awk '{print $1}' | sed -E 's/\(.*//' \
+    | grep -E '\.so' | sort -u > "$required_sonames" || true
+  rpm -qpl "$rpm_path" | sed 's#.*/##' \
+    | grep -E '\.so(\.[0-9]+)*$' | sort -u > "$shipped_sonames" || true
+
+  self_requires="$(comm -12 "$required_sonames" "$shipped_sonames")"
+  rm -f "$required_sonames" "$shipped_sonames"
+
+  if [ -n "$self_requires" ]; then
+    echo "Error: $(basename "$rpm_path") requires sonames that it ships 
itself:"
+    echo "$self_requires" | sed 's/^/  /'
+    echo "Add them to %__requires_exclude in 
apache-cloudberry-db-incubating.spec."
+    exit 1
+  fi
+done
+shopt -u nullglob
+
 # Print completion message
 echo "RPM build completed successfully with Version: $VERSION, Release: 
$RELEASE"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to