summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund2024-11-27 16:28:59 +0000
committerAndres Freund2024-11-27 16:51:54 +0000
commit262283d5eec3d582a8645692fede2e8f5e6029bd (patch)
treea3a5d199ca3aee2696e673ef6d28e5a99ccdcb88
parent61171a632d10ad7abe1d7ad891176266cc5ef0e1 (diff)
ci: Fix cached MacPorts installation management
1. The error reporting of "port setrequested list-of-packages..." changed, hiding errors we were relying on to know if all packages in our list were already installed. Use a loop instead. 2. The cached MacPorts installation was shared between PostgreSQL major branches, though each branch wanted different packages. Add the list of packages to cache key, so that different branches, when tested in one github account/repo such as postgres/postgres, stop fighting with each other, adding and removing packages. Back-patch to 15 where CI began. Author: Thomas Munro <[email protected]> Author: Nazir Bilal Yavuz <[email protected]> Suggested-by: Andres Freund <[email protected]> Discussion: https://postgr.es/m/au2uqfuy2nf43nwy2txmc5t2emhwij7kzupygto3d2ffgtrdgr%40ckvrlwyflnh2
-rw-r--r--.cirrus.tasks.yml34
-rwxr-xr-xsrc/tools/ci/ci_macports_packages.sh15
2 files changed, 29 insertions, 20 deletions
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index fc413eb11ef..18e944ca89d 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -427,6 +427,20 @@ task:
CCACHE_DIR: ${HOME}/ccache
MACPORTS_CACHE: ${HOME}/macports-cache
+ MACOS_PACKAGE_LIST: >-
+ ccache
+ icu
+ kerberos5
+ lz4
+ meson
+ openldap
+ openssl
+ p5.34-io-tty
+ p5.34-ipc-run
+ python312
+ tcl
+ zstd
+
CC: ccache cc
CXX: ccache c++
CFLAGS: -Og -ggdb
@@ -463,26 +477,14 @@ task:
macports_cache:
folder: ${MACPORTS_CACHE}
fingerprint_script: |
- # Include the OS major version in the cache key. If the OS image changes
- # to a different major version, we need to reinstall.
+ # Reinstall packages if the OS major version, the list of the packages
+ # to install or the MacPorts install script changes.
sw_vers -productVersion | sed 's/\..*//'
- # Also start afresh if we change our MacPorts install script.
+ echo $MACOS_PACKAGE_LIST
md5 src/tools/ci/ci_macports_packages.sh
reupload_on_changes: true
setup_additional_packages_script: |
- sh src/tools/ci/ci_macports_packages.sh \
- ccache \
- icu \
- kerberos5 \
- lz4 \
- meson \
- openldap \
- openssl \
- p5.34-io-tty \
- p5.34-ipc-run \
- python312 \
- tcl \
- zstd
+ sh src/tools/ci/ci_macports_packages.sh $MACOS_PACKAGE_LIST
# system python doesn't provide headers
sudo /opt/local/bin/port select python3 python312
# Make macports install visible for subsequent steps
diff --git a/src/tools/ci/ci_macports_packages.sh b/src/tools/ci/ci_macports_packages.sh
index b3df6d36a4e..63e97b37c78 100755
--- a/src/tools/ci/ci_macports_packages.sh
+++ b/src/tools/ci/ci_macports_packages.sh
@@ -59,11 +59,18 @@ if [ -n "$(port -q installed installed)" ] ; then
sudo port unsetrequested installed
fi
-# if setting all the required packages as requested fails, we need
-# to install at least one of them
-if ! sudo port setrequested $packages > /dev/null 2>&1 ; then
- echo not all required packages installed, doing so now
+# If setting all the required packages as requested fails, we need
+# to install at least one of them. Need to do so one-by-one as
+# port setrequested only reports failures for the first package.
+echo "checking if all required packages are installed"
+for package in $packages ; do
+ if ! sudo port setrequested $package > /dev/null 2>&1 ; then
update_cached_image=1
+ fi
+done
+echo "done"
+if [ "$update_cached_image" -eq 1 ]; then
+ echo not all required packages installed, doing so now
# to keep the image small, we deleted the ports tree from the image...
sudo port selfupdate
# XXX likely we'll need some other way to force an upgrade at some