Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/workflows/build-cloudberry-rocky10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,9 @@ jobs:
"${SRC_DIR}"/devops/build/packaging/rpm/build-rpm.sh --version "${CBDB_VERSION}" --release "${BUILD_NUMBER}" "${DEBUG_RPMBUILD_OPT}"

# Get OS version and move RPM
# build-rpm.sh normalizes the published file name to the historical
# format (without the "-<major>" segment); the package Name metadata
# still embeds the major version.
os_version=$(grep -oP '(?<=^VERSION_ID=")[0-9]+' /etc/os-release)
RPM_FILE="${HOME}"/rpmbuild/RPMS/x86_64/apache-cloudberry-db-incubating-"${CBDB_VERSION}"-"${BUILD_NUMBER}""${DEBUG_IDENTIFIER}".el"${os_version}".x86_64.rpm
cp "${RPM_FILE}" "${SRC_DIR}"
Expand Down Expand Up @@ -920,9 +923,9 @@ jobs:
fi

echo "Installation completed successfully"
rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
echo "Installed files:"
rpm -ql apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -ql
} 2>&1 | tee -a install-logs/details/rpm-installation.log

- name: Upload install logs
Expand All @@ -942,7 +945,7 @@ jobs:
echo "# Installed Package Summary"
echo "\`\`\`"

rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
echo "\`\`\`"
} >> "$GITHUB_STEP_SUMMARY" || true

Expand Down Expand Up @@ -1330,7 +1333,7 @@ jobs:
fi

echo "Installation completed successfully"
rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
} 2>&1 | tee -a build-logs/details/rpm-installation.log

# Clean up downloaded RPM artifacts to free disk space
Expand Down Expand Up @@ -1423,6 +1426,10 @@ jobs:
run: |
set -o pipefail

# Grant gpadmin write access to the install directory
# -H follows the command-line symlink to the real directory.
chown -RH gpadmin:gpadmin "${BUILD_DESTINATION}/"

# Initialize test status
overall_status=0

Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/build-cloudberry-rocky8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,9 @@ jobs:
"${SRC_DIR}"/devops/build/packaging/rpm/build-rpm.sh --version "${CBDB_VERSION}" --release "${BUILD_NUMBER}" "${DEBUG_RPMBUILD_OPT}"

# Get OS version and move RPM
# build-rpm.sh normalizes the published file name to the historical
# format (without the "-<major>" segment); the package Name metadata
# still embeds the major version.
os_version=$(grep -oP '(?<=^VERSION_ID=")[0-9]+' /etc/os-release)
RPM_FILE="${HOME}"/rpmbuild/RPMS/x86_64/apache-cloudberry-db-incubating-"${CBDB_VERSION}"-"${BUILD_NUMBER}""${DEBUG_IDENTIFIER}".el"${os_version}".x86_64.rpm
cp "${RPM_FILE}" "${SRC_DIR}"
Expand Down Expand Up @@ -919,9 +922,9 @@ jobs:
fi

echo "Installation completed successfully"
rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
echo "Installed files:"
rpm -ql apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -ql
} 2>&1 | tee -a install-logs/details/rpm-installation.log

- name: Upload install logs
Expand All @@ -941,7 +944,7 @@ jobs:
echo "# Installed Package Summary"
echo "\`\`\`"

rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
echo "\`\`\`"
} >> "$GITHUB_STEP_SUMMARY" || true

Expand Down Expand Up @@ -1329,7 +1332,7 @@ jobs:
fi

echo "Installation completed successfully"
rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
} 2>&1 | tee -a build-logs/details/rpm-installation.log

# Clean up downloaded RPM artifacts to free disk space
Expand Down Expand Up @@ -1414,6 +1417,10 @@ jobs:
run: |
set -o pipefail

# Grant gpadmin write access to the install directory
# -H follows the command-line symlink to the real directory.
chown -RH gpadmin:gpadmin "${BUILD_DESTINATION}/"

# Initialize test status
overall_status=0

Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/build-cloudberry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@ jobs:
"${SRC_DIR}"/devops/build/packaging/rpm/build-rpm.sh --version "${CBDB_VERSION}" --release "${BUILD_NUMBER}" "${DEBUG_RPMBUILD_OPT}"

# Get OS version and move RPM
# build-rpm.sh normalizes the published file name to the historical
# format (without the "-<major>" segment); the package Name metadata
# still embeds the major version.
os_version=$(grep -oP '(?<=^VERSION_ID=")[0-9]+' /etc/os-release)
RPM_FILE="${HOME}"/rpmbuild/RPMS/x86_64/apache-cloudberry-db-incubating-"${CBDB_VERSION}"-"${BUILD_NUMBER}""${DEBUG_IDENTIFIER}".el"${os_version}".x86_64.rpm
cp "${RPM_FILE}" "${SRC_DIR}"
Expand Down Expand Up @@ -918,9 +921,9 @@ jobs:
fi

echo "Installation completed successfully"
rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
echo "Installed files:"
rpm -ql apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -ql
} 2>&1 | tee -a install-logs/details/rpm-installation.log

- name: Upload install logs
Expand All @@ -940,7 +943,7 @@ jobs:
echo "# Installed Package Summary"
echo "\`\`\`"

rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
echo "\`\`\`"
} >> "$GITHUB_STEP_SUMMARY" || true

Expand Down Expand Up @@ -1328,7 +1331,7 @@ jobs:
fi

echo "Installation completed successfully"
rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
} 2>&1 | tee -a build-logs/details/rpm-installation.log

# Clean up downloaded RPM artifacts to free disk space
Expand Down Expand Up @@ -1421,6 +1424,10 @@ jobs:
run: |
set -o pipefail

# Grant gpadmin write access to the install directory
# -H follows the command-line symlink to the real directory.
chown -RH gpadmin:gpadmin "${BUILD_DESTINATION}/"

# Initialize test status
overall_status=0

Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/build-dbg-cloudberry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ jobs:
"${SRC_DIR}"/devops/build/packaging/rpm/build-rpm.sh --version "${CBDB_VERSION}" --release "${BUILD_NUMBER}" "${DEBUG_RPMBUILD_OPT}"

# Get OS version and move RPM
# build-rpm.sh normalizes the published file name to the historical
# format (without the "-<major>" segment); the package Name metadata
# still embeds the major version.
os_version=$(grep -oP '(?<=^VERSION_ID=")[0-9]+' /etc/os-release)
RPM_FILE="${HOME}"/rpmbuild/RPMS/x86_64/apache-cloudberry-db-incubating-"${CBDB_VERSION}"-"${BUILD_NUMBER}""${DEBUG_IDENTIFIER}".el"${os_version}".x86_64.rpm
cp "${RPM_FILE}" "${SRC_DIR}"
Expand Down Expand Up @@ -723,9 +726,9 @@ jobs:
fi

echo "Installation completed successfully"
rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
echo "Installed files:"
rpm -ql apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -ql
} 2>&1 | tee -a install-logs/details/rpm-installation.log

- name: Upload install logs
Expand All @@ -745,7 +748,7 @@ jobs:
echo "# Installed Package Summary"
echo "\`\`\`"

rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
echo "\`\`\`"
} >> "$GITHUB_STEP_SUMMARY" || true

Expand Down Expand Up @@ -1095,7 +1098,7 @@ jobs:
fi

echo "Installation completed successfully"
rpm -qi apache-cloudberry-db-incubating
rpm -qa 'apache-cloudberry-db-incubating*' | xargs -r rpm -qi
} 2>&1 | tee -a build-logs/details/rpm-installation.log

- name: Extract source tarball
Expand Down
120 changes: 99 additions & 21 deletions devops/build/packaging/rpm/apache-cloudberry-db-incubating.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,32 @@
# specific language governing permissions and limitations
# under the License.

%define cloudberry_install_dir /usr/local/cloudberry-db
# Validate required macros early so rpmbuild fails with a clear message
# before reaching the header.
%{!?version:%{error:The macro 'version' must be supplied as --define 'version ...'}}
%{!?release:%{error:The macro 'release' must be supplied as --define 'release ...'}}

%define cloudberry_base_dir /usr/local
%define cloudberry_name cloudberry-db
%define cloudberry_install_dir %{cloudberry_base_dir}/%{cloudberry_name}

# Major version, used to build a versioned package Name so that different
# major versions can be installed side by side (like greenplum-db-6 vs
# greenplum-db-7). Derived from the version macro by default (single source
# of truth), but can be overridden via --define 'cloudberry_major_version N'.
%{!?cloudberry_major_version:%define cloudberry_major_version %(echo %{version} | cut -d. -f1)}

# Suppress build-id links so they are not created outside the relocatable prefix.
%define _build_id_links none

# Do not expose bundled/private shared libraries as RPM Provides.
# (e.g., libpq.so.5 would conflict with system postgresql-libs.)
%global __provides_exclude_from ^%{cloudberry_install_dir}-%{version}/.*\.so

# 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)

# Add at the top of the spec file
# Default to non-debug build
%bcond_with debug

Expand All @@ -27,7 +50,11 @@
%define __strip /bin/true
%endif

Name: apache-cloudberry-db-incubating
Name: apache-cloudberry-db-incubating-%{cloudberry_major_version}
# Replace the previous unversioned package on upgrade. This targets only the
# old fixed name; it does NOT match apache-cloudberry-db-incubating-<major>,
# so different major versions still coexist.
Obsoletes: apache-cloudberry-db-incubating < %{version}-%{release}
Version: %{version}
Comment on lines +53 to 58
# In the release definition section
%if %{with debug}
Expand All @@ -37,11 +64,11 @@ Release: %{release}%{?dist}
%endif
Summary: High-performance, open-source data warehouse based on PostgreSQL/Greenplum

License: ASL 2.0
License: Apache-2.0
URL: https://cloudberry.apache.org
Vendor: Apache Cloudberry (Incubating)
Group: Applications/Databases
Prefix: %{cloudberry_install_dir}
Prefix: %{cloudberry_base_dir}

# Disabled as we are shipping GO programs (e.g. gpbackup)
%define _missing_build_ids_terminate_build 0
Expand All @@ -62,6 +89,10 @@ Requires: openssh-server
Requires: rsync
Requires: which

# Scriptlet dependencies (ln, readlink, rm are from coreutils).
Requires(post): coreutils
Requires(postun): coreutils

%if 0%{?rhel} == 8
Requires: apr
Requires: audit
Expand Down Expand Up @@ -105,6 +136,7 @@ Requires: pam
Requires: pcre2
Requires: perl
Requires: readline
Requires: python3
Requires: xz
%endif

Expand Down Expand Up @@ -145,41 +177,87 @@ project has yet to be fully endorsed by the ASF.
# No prep needed for binary RPM

%build
# No prep needed for binary RPM
# No build needed for binary RPM

%install
rm -rf %{buildroot}

# Create the versioned directory
mkdir -p %{buildroot}%{cloudberry_install_dir}-%{version}

cp -R %{cloudberry_install_dir}/* %{buildroot}%{cloudberry_install_dir}-%{version}
# Use cp -a with /. to include all the files
cp -a %{cloudberry_install_dir}/. %{buildroot}%{cloudberry_install_dir}-%{version}/

# Copy Apache mandatory compliance files from the SOURCES directory into the installation directory
cp %{_sourcedir}/LICENSE %{buildroot}%{cloudberry_install_dir}-%{version}/
cp %{_sourcedir}/NOTICE %{buildroot}%{cloudberry_install_dir}-%{version}/
cp %{_sourcedir}/DISCLAIMER %{buildroot}%{cloudberry_install_dir}-%{version}/
cp -R %{_sourcedir}/licenses %{buildroot}%{cloudberry_install_dir}-%{version}/

# Create the symbolic link
ln -sfn %{cloudberry_install_dir}-%{version} %{buildroot}%{cloudberry_install_dir}
cp -a %{_sourcedir}/licenses %{buildroot}%{cloudberry_install_dir}-%{version}/

%files
%{prefix}-%{version}
%{prefix}
%{cloudberry_install_dir}-%{version}
%config(noreplace) %{cloudberry_install_dir}-%{version}/cloudberry-env.sh
Comment on lines 197 to +199

%debug_package

%post
# Change ownership to gpadmin.gpadmin if the gpadmin user exists
if id "gpadmin" &>/dev/null; then
chown -R gpadmin:gpadmin %{cloudberry_install_dir}-%{version}
chown gpadmin:gpadmin %{cloudberry_install_dir}
# RPM_INSTALL_PREFIX is set dynamically by RPM to the actual --prefix value.
# Fall back to cloudberry_base_dir when --prefix was not used.
INSTALL_PREFIX="${RPM_INSTALL_PREFIX:-%{cloudberry_base_dir}}"
INSTALL_BASE="${INSTALL_PREFIX%/}"

LINK_PATH="${INSTALL_BASE}/%{cloudberry_name}"
VERSIONED_DIR="${INSTALL_BASE}/%{cloudberry_name}-%{version}"

if [ ! -e "${LINK_PATH}" ] && [ ! -L "${LINK_PATH}" ]; then
# Nothing at the symlink location yet — create it.
ln -s "${VERSIONED_DIR}" "${LINK_PATH}" || :
elif [ -L "${LINK_PATH}" ]; then
# A symlink already exists. Update it when it points to a
# recognized Cloudberry versioned directory.
EXISTING_TARGET=$(readlink -f -- "${LINK_PATH}" 2>/dev/null || :)
EXISTING_NAME=${EXISTING_TARGET##*/}

case "${EXISTING_NAME}" in
%{cloudberry_name}-*)
EXISTING_VERSION=${EXISTING_NAME#%{cloudberry_name}-}
EXISTING_MAJOR=${EXISTING_VERSION%%.*}
if [ "${EXISTING_MAJOR}" = "%{cloudberry_major_version}" ]; then
# Same major version: move the generic symlink to this build.
ln -sfnT "${VERSIONED_DIR}" "${LINK_PATH}" || :
else
Comment on lines +209 to +228
# Different major version: leave the existing symlink untouched
# so that multiple major versions can coexist under one prefix.
echo "Warning: ${LINK_PATH} points to Cloudberry major version ${EXISTING_MAJOR}; leaving it unchanged so major versions can coexist" >&2
fi
;;
*)
echo "Warning: ${LINK_PATH} does not point to a recognized Cloudberry installation; leaving it unchanged" >&2
;;
esac
else
echo "Warning: ${LINK_PATH} exists and is not a symbolic link; leaving it unchanged" >&2
fi

exit 0

%postun
if [ $1 -eq 0 ] ; then
if [ "$(readlink -f "%{cloudberry_install_dir}")" == "%{cloudberry_install_dir}-%{version}" ]; then
unlink "%{cloudberry_install_dir}" || true
fi
INSTALL_PREFIX="${RPM_INSTALL_PREFIX:-%{cloudberry_base_dir}}"
INSTALL_BASE="${INSTALL_PREFIX%/}"

LINK_PATH="${INSTALL_BASE}/%{cloudberry_name}"
VERSIONED_DIR="${INSTALL_BASE}/%{cloudberry_name}-%{version}"

if [ -L "${LINK_PATH}" ]; then
LINK_TARGET=$(readlink "${LINK_PATH}" 2>/dev/null || :)

# Remove the symlink only when it still points to the version
# being removed (handles both absolute and relative targets).
case "${LINK_TARGET}" in
"${VERSIONED_DIR}"|"%{cloudberry_name}-%{version}")
rm -f -- "${LINK_PATH}" || :
;;
esac
fi

exit 0
Loading
Loading