Skip to content

Commit a16ad2b

Browse files
authored
Fix DEB packaging to support multi-arch builds
Fix DEB build failures on arm64 by addressing three issues: - Change Architecture from 'amd64' to 'any' in control file to support building on any architecture - Fix DESTDIR path in rules to correctly install cloudberry-env.sh to the debian staging directory - Use DEB_HOST_MULTIARCH variable instead of hardcoded x86_64 path for libfakeroot in dh_shlibdeps - Update workflow to support new deb format Also update package version format to include OS distribution name (e.g., ubuntu22.04) instead of git commit info for clearer package identification. The file name format will be like: ``` apache-cloudberry-db-incubating_2.1.0-1-ubuntu22.04_arm64.deb ``` Before: ``` apache-cloudberry-db-incubating_2.1.0-1-1.bdf90c55_arm64.deb ```
1 parent 4101d34 commit a16ad2b

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

.github/workflows/build-deb-cloudberry.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,15 @@ jobs:
554554
exit 1
555555
fi
556556
557-
ARCH="amd64"
558-
CBDB_PKG_VERSION=${CBDB_VERSION}-${BUILD_NUMBER}-$(git --git-dir=.git rev-list HEAD --count).$(git --git-dir=.git rev-parse --short HEAD)
557+
ARCH=$(dpkg --print-architecture)
558+
# Detect OS distribution (e.g., ubuntu22.04, debian12)
559+
if [ -f /etc/os-release ]; then
560+
. /etc/os-release
561+
OS_DISTRO=$(echo "${ID}${VERSION_ID}" | tr '[:upper:]' '[:lower:]')
562+
else
563+
OS_DISTRO="unknown"
564+
fi
565+
CBDB_PKG_VERSION=${CBDB_VERSION}-${BUILD_NUMBER}-${OS_DISTRO}
559566
560567
echo "Produced artifacts"
561568
ls -l ../

devops/build/packaging/deb/build-deb.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,17 @@ if [ -z ${BUILD_USER+x} ]; then
124124
export BUILD_USER=github
125125
fi
126126

127-
export CBDB_PKG_VERSION=${CBDB_FULL_VERSION}-${BUILD_NUMBER}-$(git --git-dir=.git rev-list HEAD --count).$(git --git-dir=.git rev-parse --short HEAD)
127+
# Detect OS distribution (e.g., ubuntu22.04, debian12)
128+
if [ -z ${OS_DISTRO+x} ]; then
129+
if [ -f /etc/os-release ]; then
130+
. /etc/os-release
131+
OS_DISTRO=$(echo "${ID}${VERSION_ID}" | tr '[:upper:]' '[:lower:]')
132+
else
133+
OS_DISTRO="unknown"
134+
fi
135+
fi
136+
137+
export CBDB_PKG_VERSION=${CBDB_FULL_VERSION}-${BUILD_NUMBER}-${OS_DISTRO}
128138

129139
# Check if required commands are available
130140
check_commands

devops/build/packaging/deb/ubuntu22.04/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Build-Depends: debhelper (>= 9),
4343

4444
Package: apache-cloudberry-db-incubating
4545
Provides: apache-cloudberry-db
46-
Architecture: amd64
46+
Architecture: any
4747
Depends: curl,
4848
cgroup-tools,
4949
iputils-ping,

devops/build/packaging/deb/ubuntu22.04/rules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ include /usr/share/dpkg/default.mk
1919
dh $@ --parallel
2020

2121
gpinstall:
22-
make install
22+
make install DESTDIR=${DEBIAN_DESTINATION} prefix=
2323

2424
override_dh_auto_install: gpinstall
2525
# the staging directory for creating a debian is NOT the right GPHOME.
@@ -43,7 +43,7 @@ override_dh_gencontrol:
4343
dh_gencontrol -- -v${CBDB_PKG_VERSION} -p${PACKAGE_CBDB}
4444

4545
override_dh_shlibdeps:
46-
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/libfakeroot:${DEBIAN_DESTINATION}/lib dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
46+
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/$(DEB_HOST_MULTIARCH)/libfakeroot:${DEBIAN_DESTINATION}/lib dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
4747

4848
clean_dev_local:
4949
rm -rf ${DEBIAN_DESTINATION}

0 commit comments

Comments
 (0)