You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by es...@apache.org on 2024/12/16 05:05:16 UTC
(cloudberry-devops-release) 03/05: Add RPM Debug support.
This is an automated email from the ASF dual-hosted git repository.
espino pushed a commit to branch debugging-core
in repository https://gitbox.apache.org/repos/asf/cloudberry-devops-release.git
commit d300d79e6a820524c010250841d24cda0ebdd212
Author: Ed Espino <es...@apache.org>
AuthorDate: Fri Dec 13 01:40:52 2024 -0800
Add RPM Debug support.
---
.../cloudberry/scripts/analyze_core_dumps.sh | 23 +++++++-----------
.../el/SPECS/apache-cloudberry-db-incubating.spec | 16 +++++++++++++
scripts/build-rpm.sh | 28 +++++++++++++++++-----
3 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/build_automation/cloudberry/scripts/analyze_core_dumps.sh b/build_automation/cloudberry/scripts/analyze_core_dumps.sh
index 16ee648..2a812d3 100755
--- a/build_automation/cloudberry/scripts/analyze_core_dumps.sh
+++ b/build_automation/cloudberry/scripts/analyze_core_dumps.sh
@@ -122,17 +122,14 @@ analyze_core_file() {
# Run GDB analysis
log_message "Starting GDB analysis..."
- gdb -quiet --batch \
- -ex "set logging enabled" \
- -ex "set pagination off" \
- -ex "set print pretty on" \
- -ex "info target" \
- -ex "info proc mappings" \
- -ex "thread apply all bt full" \
- -ex "info registers" \
- -ex "print \$_siginfo" \
- -ex "info sharedlibrary" \
- -ex "quit" \
+
+ gdb -quiet \
+ --batch \
+ -ex 'set pagination off' \
+ -ex 'info target' \
+ -ex 'thread apply all bt' \
+ -ex 'print $_siginfo' \
+ -ex quit \
"$executable" "$core_file" 2>&1 >> "$log_file"
local gdb_rc=$?
@@ -211,10 +208,6 @@ main() {
log_message "Log file: $log_file"
- # Display the analysis results
- echo "=== Analysis Results ==="
- cat "$log_file"
-
return $return_code
}
diff --git a/packaging/rpm/el/SPECS/apache-cloudberry-db-incubating.spec b/packaging/rpm/el/SPECS/apache-cloudberry-db-incubating.spec
index da73305..f2f29a5 100644
--- a/packaging/rpm/el/SPECS/apache-cloudberry-db-incubating.spec
+++ b/packaging/rpm/el/SPECS/apache-cloudberry-db-incubating.spec
@@ -1,8 +1,24 @@
%define cloudberry_install_dir /usr/local/cloudberry-db
+# Add at the top of the spec file
+# Default to non-debug build
+%bcond_with debug
+
+# Conditional stripping based on debug flag
+%if %{with debug}
+%define __os_install_post %{nil}
+%define __strip /bin/true
+%define debug_package %{nil}
+%endif
+
Name: apache-cloudberry-db-incubating
Version: %{version}
+# In the release definition section
+%if %{with debug}
+Release: %{release}.debug%{?dist}
+%else
Release: %{release}%{?dist}
+%endif
Summary: High-performance, open-source data warehouse based on PostgreSQL/Greenplum
License: ASL 2.0
diff --git a/scripts/build-rpm.sh b/scripts/build-rpm.sh
index c68102b..1c2b0d8 100755
--- a/scripts/build-rpm.sh
+++ b/scripts/build-rpm.sh
@@ -9,17 +9,19 @@
# also includes error handling to provide meaningful feedback in case of failure.
#
# Usage:
-# ./build-rpm.sh -v <version> [-r <release>] [-h] [--dry-run]
+# ./build-rpm.sh -v <version> [-r <release>] [-d|--with-debug] [-h] [--dry-run]
#
# Options:
# -v, --version <version> : Specify the version (required)
# -r, --release <release> : Specify the release (optional, default is 1)
+# -d, --with-debug : Build with debug symbols (optional)
# -h, --help : Display this help and exit
# -n, --dry-run : Show what would be done, without making any changes
#
# Example:
-# ./build-rpm.sh -v 1.5.5 -r 2 # Build with version 1.5.5 and release 2
-# ./build-rpm.sh -v 1.5.5 # Build with version 1.5.5 and default release 1
+# ./build-rpm.sh -v 1.5.5 -r 2 # Build with version 1.5.5 and release 2
+# ./build-rpm.sh -v 1.5.5 # Build with version 1.5.5 and default release 1
+# ./build-rpm.sh -v 1.5.5 --with-debug # Build with debug symbols
#
# Prerequisites:
# - The rpm-build package must be installed (provides the rpmbuild command).
@@ -38,12 +40,14 @@ set -euo pipefail
# Default values
VERSION=""
RELEASE="1"
+DEBUG_BUILD=false
# Function to display usage information
usage() {
echo "Usage: $0 -v <version> [-r <release>] [-h] [--dry-run]"
echo " -v, --version <version> : Specify the version (required)"
echo " -r, --release <release> : Specify the release (optional, default is 1)"
+ echo " -d, --with-debug : Build with debug symbols (optional)"
echo " -h, --help : Display this help and exit"
echo " -n, --dry-run : Show what would be done, without making any changes"
exit 1
@@ -71,6 +75,10 @@ while [[ "$#" -gt 0 ]]; do
RELEASE="$2"
shift 2
;;
+ -d|--with-debug)
+ DEBUG_BUILD=true
+ shift
+ ;;
-h|--help)
usage
;;
@@ -103,16 +111,24 @@ if [ ! -f "$SPEC_FILE" ]; then
exit 1
fi
+# Build the rpmbuild command based on options
+RPMBUILD_CMD="rpmbuild -bb \"$SPEC_FILE\" --define \"version $VERSION\" --define \"release $RELEASE\""
+if [ "$DEBUG_BUILD" = true ]; then
+ RPMBUILD_CMD+=" --with debug"
+else
+ RPMBUILD_CMD+=" --without debug"
+fi
+
# Dry-run mode
if [ "${DRY_RUN:-false}" = true ]; then
echo "Dry-run mode: This is what would be done:"
- echo " rpmbuild -bb \"$SPEC_FILE\" --define \"version $VERSION\" --define \"release $RELEASE\""
+ echo " $RPMBUILD_CMD"
exit 0
fi
# Run rpmbuild with the provided options
-echo "Building RPM with Version: $VERSION, Release: $RELEASE..."
-if ! rpmbuild -bb "$SPEC_FILE" --define "version $VERSION" --define "release $RELEASE"; then
+echo "Building RPM with Version: $VERSION, Release: $RELEASE$([ "$DEBUG_BUILD" = true ] && echo ", Debug: enabled")..."
+if ! eval "$RPMBUILD_CMD"; then
echo "Error: rpmbuild failed."
exit 1
fi
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org