Skip to content

Commit aee3d10

Browse files
committed
fix: Vendor libicu as a BOSH package to fix postgres-16/17/18 on Ubuntu Resolute
libicu-dev was dropped from the Ubuntu Resolute stemcell, breaking postgres-16/17/18 compilation which requires ICU at build time. - Add postgres-libicu BOSH package that compiles ICU4C from a vendored source tarball (static-only, --disable-shared) so postgres links ICU statically with no runtime .so dependency - Update postgres-16, -17, -18 to declare postgres-libicu as a dependency and use ${BOSH_PACKAGES_PATH}/postgres-libicu in configure flags instead of hardcoded system paths - Drop ARM64/aarch64 support from all packaging scripts and CI tasks - Fix packaging scripts: replace ignored #!/bin/bash -exu shebang with #!/bin/bash + set -euo pipefail per BOSH conventions - Add bump-libicu-package CI task and icu-src Concourse resource so ICU blob bumps are automated in the bump-packages pipeline job Closes #98
1 parent 28174bd commit aee3d10

15 files changed

Lines changed: 189 additions & 50 deletions

File tree

‎ci/pipeline.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ jobs:
4545
trigger: true
4646
- get: postgres-18-src
4747
trigger: true
48+
- get: icu-src
49+
trigger: true
50+
params:
51+
globs:
52+
- icu4c-*-src.tgz
4853
- get: yq-release
4954
trigger: true
5055
params:
@@ -61,6 +66,15 @@ jobs:
6166
options:
6267
access_key_id: ((postgres-release-blobstore-user.username))
6368
secret_access_key: ((postgres-release-blobstore-user.password))
69+
- task: bump-libicu-package
70+
file: postgres-release/ci/tasks/bump-libicu-package/task.yml
71+
image: bosh-integration-image
72+
params:
73+
PRIVATE_YML: |
74+
blobstore:
75+
options:
76+
access_key_id: ((postgres-release-blobstore-user.username))
77+
secret_access_key: ((postgres-release-blobstore-user.password))
6478
- task: bump-postgres-15-package
6579
file: postgres-release/ci/tasks/bump-postgres-packages/task.yml
6680
image: bosh-integration-image
@@ -321,6 +335,16 @@ resources:
321335
regex: 'href="v(?P<version>18\.[0-9.]+)/"'
322336
uri: "https://ftp.postgresql.org/pub/source/v{version}/postgresql-{version}.tar.gz"
323337

338+
- name: icu-src
339+
type: github-release
340+
source:
341+
owner: unicode-org
342+
repository: icu
343+
tag_filter: release-([0-9]+-[0-9]+)
344+
access_token: ((github_public_repo_token))
345+
globs:
346+
- icu4c-*-src.tgz
347+
324348
- name: yq-release
325349
type: github-release
326350
source:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
NEED_COMMIT=false
3+
4+
set -euo pipefail
5+
6+
echo "${PRIVATE_YML}" > postgres-release/config/private.yml
7+
8+
get_old_blob_path() {
9+
local blobs_file="config/blobs.yml"
10+
if grep -q "^icu/" "$blobs_file"; then
11+
grep "^icu/" "$blobs_file" | head -1 | cut -f1 -d:
12+
else
13+
echo ""
14+
fi
15+
}
16+
17+
pushd postgres-release
18+
CURRENT_BLOBS=$(bosh blobs)
19+
BLOB_PATH=$(echo ../icu-src/icu4c-*-src.tgz)
20+
FILENAME=$(basename "${BLOB_PATH}")
21+
OLD_BLOB_PATH=$(get_old_blob_path)
22+
23+
if ! echo "${CURRENT_BLOBS}" | grep -q "${FILENAME}"; then
24+
NEED_COMMIT=true
25+
echo "adding ${FILENAME}"
26+
bosh add-blob --sha2 "${BLOB_PATH}" "icu/${FILENAME}"
27+
if [[ -n "${OLD_BLOB_PATH}" ]]; then
28+
bosh remove-blob "${OLD_BLOB_PATH}"
29+
fi
30+
bosh upload-blobs
31+
fi
32+
33+
if [ "${NEED_COMMIT}" = "true" ]; then
34+
echo "-----> $(date): Creating git commit"
35+
git config user.name "$GIT_USER_NAME"
36+
git config user.email "$GIT_USER_EMAIL"
37+
git add .
38+
39+
git --no-pager diff --cached
40+
if [[ "$( git status --porcelain )" != "" ]]; then
41+
git commit -am "Bump packages"
42+
fi
43+
fi
44+
popd
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
platform: linux
3+
4+
inputs:
5+
- name: postgres-release
6+
- name: icu-src
7+
8+
outputs:
9+
- name: postgres-release
10+
11+
run:
12+
path: postgres-release/ci/tasks/bump-libicu-package/task.sh
13+
14+
params:
15+
PRIVATE_YML:
16+
GIT_USER_NAME: CI Bot
17+
GIT_USER_EMAIL: bots@cloudfoundry.org

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

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,47 @@ 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; 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 blob
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+
| cut -f1 -d:)
45+
46+
if [ "${NEED_COMMIT}" = "true" ]; then
3347
bosh upload-blobs
3448
fi
3549

36-
if ${NEED_COMMIT}; then
50+
# Always populate yq-bin from amd64 binary (CI workers are x86_64)
51+
cp ../yq-release/yq_linux_amd64 ../yq-bin/yq && chmod +x ../yq-bin/yq
52+
53+
if [ "${NEED_COMMIT}" = "true" ]; then
3754
echo "-----> $(date): Creating git commit"
3855
git config user.name "$GIT_USER_NAME"
3956
git config user.email "$GIT_USER_EMAIL"
@@ -44,4 +61,4 @@ pushd postgres-release
4461
git commit -am "Bump packages"
4562
fi
4663
fi
47-
popd
64+
popd

‎packages/postgres-15/packaging‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ 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
2122
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2223
else
23-
CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
24+
CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2425
fi
2526

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

‎packages/postgres-16/packaging‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
#!/bin/bash -exu
1+
#!/bin/bash
2+
3+
set -euo pipefail
24

35
function main() {
46
extract_archive
57
compile
6-
78
}
89

910
function extract_archive() {
10-
1111
echo "Extracting archive..."
1212
tar xzf postgres/postgresql-*
13-
1413
}
1514

1615
function compile() {
17-
1816
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
17+
ARCH=$(uname -m)
18+
if [[ "$ARCH" == "x86_64" || "$ARCH" == "ppc64le" ]]; then
19+
ICU_CFLAGS="-I${BOSH_PACKAGES_PATH}/postgres-libicu/include" \
20+
ICU_LIBS="-L${BOSH_PACKAGES_PATH}/postgres-libicu/lib -licui18n -licuuc -licudata" \
21+
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2122
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
23+
ICU_CFLAGS="-I${BOSH_PACKAGES_PATH}/postgres-libicu/include" \
24+
ICU_LIBS="-L${BOSH_PACKAGES_PATH}/postgres-libicu/lib -licui18n -licuuc -licudata" \
25+
CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2326
fi
2427

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

‎packages/postgres-16/spec‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
22
name: postgres-16
3+
dependencies:
4+
- postgres-libicu
35
files:
46
- postgres/postgresql-16.*.tar.gz

‎packages/postgres-17/packaging‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
#!/bin/bash -exu
1+
#!/bin/bash
2+
3+
set -euo pipefail
24

35
function main() {
46
extract_archive
57
compile
6-
78
}
89

910
function extract_archive() {
10-
1111
echo "Extracting archive..."
1212
tar xzf postgres/postgresql-*
13-
1413
}
1514

1615
function compile() {
17-
1816
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
17+
ARCH=$(uname -m)
18+
if [[ "$ARCH" == "x86_64" || "$ARCH" == "ppc64le" ]]; then
19+
ICU_CFLAGS="-I${BOSH_PACKAGES_PATH}/postgres-libicu/include" \
20+
ICU_LIBS="-L${BOSH_PACKAGES_PATH}/postgres-libicu/lib -licui18n -licuuc -licudata" \
21+
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2122
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
23+
ICU_CFLAGS="-I${BOSH_PACKAGES_PATH}/postgres-libicu/include" \
24+
ICU_LIBS="-L${BOSH_PACKAGES_PATH}/postgres-libicu/lib -licui18n -licuuc -licudata" \
25+
CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2326
fi
2427

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

‎packages/postgres-17/spec‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
22
name: postgres-17
3+
dependencies:
4+
- postgres-libicu
35
files:
46
- postgres/postgresql-17.*.tar.gz

‎packages/postgres-18/packaging‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
#!/bin/bash -exu
1+
#!/bin/bash
2+
3+
set -euo pipefail
24

35
function main() {
46
extract_archive
57
compile
6-
78
}
89

910
function extract_archive() {
10-
1111
echo "Extracting archive..."
1212
tar xzf postgres/postgresql-*
13-
1413
}
1514

1615
function compile() {
17-
1816
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
17+
ARCH=$(uname -m)
18+
if [[ "$ARCH" == "x86_64" || "$ARCH" == "ppc64le" ]]; then
19+
ICU_CFLAGS="-I${BOSH_PACKAGES_PATH}/postgres-libicu/include" \
20+
ICU_LIBS="-L${BOSH_PACKAGES_PATH}/postgres-libicu/lib -licui18n -licuuc -licudata" \
21+
./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2122
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
23+
ICU_CFLAGS="-I${BOSH_PACKAGES_PATH}/postgres-libicu/include" \
24+
ICU_LIBS="-L${BOSH_PACKAGES_PATH}/postgres-libicu/lib -licui18n -licuuc -licudata" \
25+
CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix="${BOSH_INSTALL_TARGET}" --with-openssl
2326
fi
2427

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

0 commit comments

Comments
 (0)