Skip to content

Commit e5f2d5a

Browse files
committed
feat: Add ARM64 support for the PostgrSQL release
1 parent 1a735fe commit e5f2d5a

8 files changed

Lines changed: 82 additions & 35 deletions

File tree

‎ci/pipeline.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
params:
5151
globs:
5252
- yq_linux_amd64
53+
- yq_linux_arm64
5354
- checksums
5455
- checksums_hashes_order
5556
- task: bump-yq-package

‎ci/tasks/bump-yq-packages/task.sh‎

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,48 @@ pushd postgres-release
1010
CURRENT_VERSION=$(cat ../yq-release/version)
1111

1212
sha256_col=$(grep -n "^SHA-256$" ../yq-release/checksums_hashes_order | cut -f1 -d:)
13-
expected_sha256=$(awk -v col="$((sha256_col + 1))" '/^yq_linux_amd64[[:space:]]/{print $col}' ../yq-release/checksums)
14-
actual_sha256=$(sha256sum ../yq-release/yq_linux_amd64 | awk '{print $1}')
15-
if [ "$expected_sha256" != "$actual_sha256" ]; then
16-
echo "SHA-256 verification failed for yq_linux_amd64"
17-
echo "Expected: $expected_sha256"
18-
echo "Actual: $actual_sha256"
19-
exit 1
20-
fi
21-
echo "SHA-256 verified: $actual_sha256"
22-
cp ../yq-release/yq_linux_amd64 ../yq-bin/yq && chmod +x ../yq-bin/yq
2313

24-
mv ../yq-release/yq_linux_amd64 ../yq-release/postgres-yq-${CURRENT_VERSION}
25-
BLOB_PATH=$(ls ../yq-release/postgres-yq-${CURRENT_VERSION})
26-
FILENAME=$( basename ${BLOB_PATH} )
27-
OLD_BLOB_PATH=$(cat config/blobs.yml | grep "postgres-yq" | cut -f1 -d:)
28-
if ! echo "${CURRENT_BLOBS}" | grep "${FILENAME}" ; then
14+
for ARCH in amd64 arm64; do
15+
src_file="yq_linux_${ARCH}"
16+
blob_name="postgres-yq-${ARCH}-${CURRENT_VERSION}"
17+
18+
expected_sha256=$(awk -v col="$((sha256_col + 1))" "/^${src_file}[[:space:]]/{print \$col}" ../yq-release/checksums)
19+
actual_sha256=$(sha256sum "../yq-release/${src_file}" | awk '{print $1}')
20+
if [ "$expected_sha256" != "$actual_sha256" ]; then
21+
echo "SHA-256 verification failed for ${src_file}"
22+
echo "Expected: $expected_sha256"
23+
echo "Actual: $actual_sha256"
24+
exit 1
25+
fi
26+
echo "SHA-256 verified for ${src_file}: $actual_sha256"
27+
28+
cp "../yq-release/${src_file}" "../yq-release/${blob_name}"
29+
30+
if ! echo "${CURRENT_BLOBS}" | grep -q "${blob_name}"; then
31+
NEED_COMMIT=true
32+
echo "adding ${blob_name}"
33+
bosh add-blob --sha2 "../yq-release/${blob_name}" "yq/${blob_name}"
34+
fi
35+
done
36+
37+
# Remove any old yq blobs that are not the current amd64 or arm64 blobs
38+
while IFS= read -r old_blob; do
39+
echo "removing old blob: ${old_blob}"
40+
bosh remove-blob "${old_blob}"
2941
NEED_COMMIT=true
30-
echo "adding ${FILENAME}"
31-
bosh add-blob --sha2 "${BLOB_PATH}" "yq/${FILENAME}"
32-
bosh remove-blob ${OLD_BLOB_PATH}
42+
done < <(grep "^yq/" config/blobs.yml \
43+
| grep -vF "postgres-yq-amd64-${CURRENT_VERSION}" \
44+
| grep -vF "postgres-yq-arm64-${CURRENT_VERSION}" \
45+
| cut -f1 -d:)
46+
47+
if [ "${NEED_COMMIT}" = "true" ]; then
3348
bosh upload-blobs
3449
fi
3550

36-
if ${NEED_COMMIT}; then
51+
# Always populate yq-bin from amd64 binary (CI workers are x86_64)
52+
cp ../yq-release/yq_linux_amd64 ../yq-bin/yq && chmod +x ../yq-bin/yq
53+
54+
if [ "${NEED_COMMIT}" = "true" ]; then
3755
echo "-----> $(date): Creating git commit"
3856
git config user.name "$GIT_USER_NAME"
3957
git config user.email "$GIT_USER_EMAIL"
@@ -44,4 +62,4 @@ pushd postgres-release
4462
git commit -am "Bump packages"
4563
fi
4664
fi
47-
popd
65+
popd

‎packages/postgres-15/packaging‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ function extract_archive() {
1717
function compile() {
1818

1919
pushd postgresql-* > /dev/null
20-
if [[ "$(uname -a)" =~ "x86_64" || "$(uname -a)" =~ "ppc64le" ]] ; then
20+
ARCH=$(uname -m)
21+
if [[ "$ARCH" == "x86_64" || "$ARCH" == "ppc64le" ]]; then
22+
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
23+
elif [[ "$ARCH" == "aarch64" ]]; then
2124
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2225
else
23-
CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
26+
CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2427
fi
2528

2629
pushd src/bin/pg_config > /dev/null

‎packages/postgres-16/packaging‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ function extract_archive() {
1616
function compile() {
1717

1818
pushd postgresql-* > /dev/null
19-
if [[ "$(uname -a)" =~ "x86_64" || "$(uname -a)" =~ "ppc64le" ]] ; then
20-
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
19+
ARCH=$(uname -m)
20+
if [[ "$ARCH" == "x86_64" || "$ARCH" == "ppc64le" ]]; then
21+
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" \
22+
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
23+
elif [[ "$ARCH" == "aarch64" ]]; then
24+
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/aarch64-linux-gnu -licui18n -licuuc -licudata" \
25+
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2126
else
22-
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
27+
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" \
28+
CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2329
fi
2430

2531
pushd src/bin/pg_config > /dev/null

‎packages/postgres-17/packaging‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ function extract_archive() {
1616
function compile() {
1717

1818
pushd postgresql-* > /dev/null
19-
if [[ "$(uname -a)" =~ "x86_64" || "$(uname -a)" =~ "ppc64le" ]] ; then
20-
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
19+
ARCH=$(uname -m)
20+
if [[ "$ARCH" == "x86_64" || "$ARCH" == "ppc64le" ]]; then
21+
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" \
22+
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
23+
elif [[ "$ARCH" == "aarch64" ]]; then
24+
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/aarch64-linux-gnu -licui18n -licuuc -licudata" \
25+
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2126
else
22-
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
27+
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" \
28+
CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2329
fi
2430

2531
pushd src/bin/pg_config > /dev/null

‎packages/postgres-18/packaging‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ function extract_archive() {
1616
function compile() {
1717

1818
pushd postgresql-* > /dev/null
19-
if [[ "$(uname -a)" =~ "x86_64" || "$(uname -a)" =~ "ppc64le" ]] ; then
20-
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
19+
ARCH=$(uname -m)
20+
if [[ "$ARCH" == "x86_64" || "$ARCH" == "ppc64le" ]]; then
21+
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" \
22+
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
23+
elif [[ "$ARCH" == "aarch64" ]]; then
24+
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/aarch64-linux-gnu -licui18n -licuuc -licudata" \
25+
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2126
else
22-
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
27+
ICU_CFLAGS=" " ICU_LIBS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" \
28+
CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2329
fi
2430

2531
pushd src/bin/pg_config > /dev/null

‎packages/postgres-yq-4/packaging‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@
22

33
function main() {
44
install
5-
65
}
76

87
function install() {
8+
local arch
9+
arch=$(uname -m)
910

1011
echo "Install yq..."
1112
mkdir -p "${BOSH_INSTALL_TARGET}/bin"
12-
cp -a yq/postgres-yq-4.* "${BOSH_INSTALL_TARGET}/bin/yq"
13-
chmod +x "${BOSH_INSTALL_TARGET}/bin/yq"
1413

14+
case "$arch" in
15+
x86_64) cp yq/postgres-yq-amd64-* "${BOSH_INSTALL_TARGET}/bin/yq" ;;
16+
aarch64) cp yq/postgres-yq-arm64-* "${BOSH_INSTALL_TARGET}/bin/yq" ;;
17+
*) echo "Unsupported architecture: $arch"; exit 1 ;;
18+
esac
19+
20+
chmod +x "${BOSH_INSTALL_TARGET}/bin/yq"
1521
}
1622

1723
main

‎packages/postgres-yq-4/spec‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
22
name: postgres-yq-4
33
files:
4-
- yq/postgres-yq-4.*
4+
- yq/postgres-yq-amd64-*
5+
- yq/postgres-yq-arm64-*

0 commit comments

Comments
 (0)