aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2024-11-27 11:30:19 -0500
committerAndres Freund <andres@anarazel.de>2024-11-27 11:30:19 -0500
commit3bbfa2ef785a36c6aa48d9a7780274dcbc6d63fd (patch)
treec1465943c0cf2d399704f0582101cb5693ee9042 /src
parent1e46f7351abcc8f17d37b0d7498fb672a105eb26 (diff)
downloadpostgresql-3bbfa2ef785a36c6aa48d9a7780274dcbc6d63fd.tar.gz
postgresql-3bbfa2ef785a36c6aa48d9a7780274dcbc6d63fd.zip
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 <thomas.munro@gmail.com> Author: Nazir Bilal Yavuz <byavuz81@gmail.com> Suggested-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/au2uqfuy2nf43nwy2txmc5t2emhwij7kzupygto3d2ffgtrdgr%40ckvrlwyflnh2
Diffstat (limited to 'src')
-rwxr-xr-xsrc/tools/ci/ci_macports_packages.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/tools/ci/ci_macports_packages.sh b/src/tools/ci/ci_macports_packages.sh
index 692fa88c325..8aa60f701cf 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