mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
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
This commit is contained in:
parent
1e46f7351a
commit
3bbfa2ef78
@ -223,6 +223,20 @@ task:
|
|||||||
CCACHE_DIR: ${HOME}/ccache
|
CCACHE_DIR: ${HOME}/ccache
|
||||||
MACPORTS_CACHE: ${HOME}/macports-cache
|
MACPORTS_CACHE: ${HOME}/macports-cache
|
||||||
|
|
||||||
|
MACOS_PACKAGE_LIST: >-
|
||||||
|
ccache
|
||||||
|
gmake
|
||||||
|
icu
|
||||||
|
kerberos5
|
||||||
|
lz4
|
||||||
|
openldap
|
||||||
|
openssl
|
||||||
|
p5.34-io-tty
|
||||||
|
p5.34-ipc-run
|
||||||
|
python312
|
||||||
|
tcl
|
||||||
|
zstd
|
||||||
|
|
||||||
<<: *macos_task_template
|
<<: *macos_task_template
|
||||||
|
|
||||||
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
|
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
|
||||||
@ -250,26 +264,14 @@ task:
|
|||||||
macports_cache:
|
macports_cache:
|
||||||
folder: ${MACPORTS_CACHE}
|
folder: ${MACPORTS_CACHE}
|
||||||
fingerprint_script: |
|
fingerprint_script: |
|
||||||
# Include the OS major version in the cache key. If the OS image changes
|
# Reinstall packages if the OS major version, the list of the packages
|
||||||
# to a different major version, we need to reinstall.
|
# to install or the MacPorts install script changes.
|
||||||
sw_vers -productVersion | sed 's/\..*//'
|
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
|
md5 src/tools/ci/ci_macports_packages.sh
|
||||||
reupload_on_changes: true
|
reupload_on_changes: true
|
||||||
setup_additional_packages_script: |
|
setup_additional_packages_script: |
|
||||||
sh src/tools/ci/ci_macports_packages.sh \
|
sh src/tools/ci/ci_macports_packages.sh $MACOS_PACKAGE_LIST
|
||||||
ccache \
|
|
||||||
gmake \
|
|
||||||
icu \
|
|
||||||
kerberos5 \
|
|
||||||
lz4 \
|
|
||||||
openldap \
|
|
||||||
openssl \
|
|
||||||
p5.34-io-tty \
|
|
||||||
p5.34-ipc-run \
|
|
||||||
python312 \
|
|
||||||
tcl \
|
|
||||||
zstd
|
|
||||||
# system python doesn't provide headers
|
# system python doesn't provide headers
|
||||||
sudo /opt/local/bin/port select python3 python312
|
sudo /opt/local/bin/port select python3 python312
|
||||||
# Make macports install visible for subsequent steps
|
# Make macports install visible for subsequent steps
|
||||||
|
@ -59,11 +59,18 @@ if [ -n "$(port -q installed installed)" ] ; then
|
|||||||
sudo port unsetrequested installed
|
sudo port unsetrequested installed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if setting all the required packages as requested fails, we need
|
# If setting all the required packages as requested fails, we need
|
||||||
# to install at least one of them
|
# to install at least one of them. Need to do so one-by-one as
|
||||||
if ! sudo port setrequested $packages > /dev/null 2>&1 ; then
|
# port setrequested only reports failures for the first package.
|
||||||
echo not all required packages installed, doing so now
|
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
|
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...
|
# to keep the image small, we deleted the ports tree from the image...
|
||||||
sudo port selfupdate
|
sudo port selfupdate
|
||||||
# XXX likely we'll need some other way to force an upgrade at some
|
# XXX likely we'll need some other way to force an upgrade at some
|
||||||
|
Loading…
x
Reference in New Issue
Block a user