Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/actions/checkout-4
Browse files Browse the repository at this point in the history
  • Loading branch information
cooljeanius authored Jun 27, 2024
2 parents e046fec + 5ad60cf commit f1748d1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 28 deletions.
62 changes: 35 additions & 27 deletions .github/workflows/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ MACPORTS_FILENAME=MacPorts-${MACPORTS_VERSION}-${OS_MAJOR}.tar.bz2

begingroup "Fetching files"
# Download resources in background ASAP but use later.
# Use /usr/bin/curl so that we don't use Homebrew curl.
# Use /usr/bin/curl to avoid using Homebrew curl.
echo "Fetching getopt..."
/usr/bin/curl -fsSLO "https://distfiles.macports.org/_ci/getopt/getopt-v1.1.6.tar.bz2" &
curl_getopt_pid=$!
echo "Fetching MacPorts..."
/usr/bin/curl -fsSLO "https://github.com/macports/macports-ci-files/releases/download/v${MACPORTS_VERSION}/${MACPORTS_FILENAME}" &
curl_mpbase_pid=$!
PORTINDEX_URL="https://ftp.fau.de/macports/release/ports/PortIndex_darwin_${OS_MAJOR}_${OS_ARCH}/PortIndex"
echo "Fetching PortIndex from $PORTINDEX_URL ..."
/usr/bin/curl -fsSLo ports/PortIndex -o ports/PortIndex.quick "$PORTINDEX_URL" "${PORTINDEX_URL}.quick" &
echo "Fetching PortIndex from ${PORTINDEX_URL} ..."
/usr/bin/curl -fsSLo ports/PortIndex -o ports/PortIndex.quick "${PORTINDEX_URL}" "${PORTINDEX_URL}.quick" &
curl_portindex_pid=$!
endgroup

Expand All @@ -50,12 +50,12 @@ begingroup "Info"
echo "macOS version: $(sw_vers -productVersion)"
echo "IP address: $(/usr/bin/curl -fsS https://www-origin.macports.org/ip.php)"
/usr/bin/curl -fsSIo /dev/null https://packages-private.macports.org/.org.macports.packages-private.healthcheck.txt && private_packages_available=yes || private_packages_available=no
echo "Can reach private packages server: $private_packages_available"
echo "Can reach private packages server: ${private_packages_available}"
endgroup


begingroup "Disabling Spotlight"
# Disable Spotlight indexing. We don't need it, and it might cost performance
# Disable Spotlight indexing. We never use it, and it might cost performance:
sudo mdutil -a -i off
endgroup

Expand All @@ -66,18 +66,18 @@ echo "Moving directories..."
sudo mkdir /opt/off
/usr/bin/sudo /usr/bin/find /usr/local -mindepth 1 -maxdepth 1 -type d -print -exec /bin/mv {} /opt/off/ \;

# Unlink files
# Unlink files:
echo "Removing files..."
/usr/bin/sudo /usr/bin/find /usr/local -mindepth 1 -maxdepth 1 -type f -print -delete

# Rehash to forget about the deleted files
# Rehash to forget about the deleted files:
hash -r
endgroup


begingroup "Installing getopt"
# Install getopt required by mpbb
if ! wait $curl_getopt_pid; then
# Install getopt required by mpbb:
if ! wait ${curl_getopt_pid}; then
echo "Fetching getopt failed: $?"
fi
echo "Extracting..."
Expand All @@ -88,7 +88,7 @@ endgroup

begingroup "Installing MacPorts"
# Install MacPorts built by https://github.com/macports/macports-base/tree/master/.github
if ! wait $curl_mpbase_pid; then
if ! wait ${curl_mpbase_pid}; then
echo "Fetching base failed: $?"
fi
echo "Extracting..."
Expand All @@ -104,7 +104,7 @@ if test -r /opt/local/share/macports/setupenv.bash; then
else
echo "/opt/local/share/macports/setupenv.bash is missing!" >&2 && exit 1
fi
# Set ports tree to $PWD/ports
# Set ports tree to ${PWD}/ports
sudo sed -i "" "s|rsync://rsync.macports.org/macports/release/tarballs/ports.tar|file://${PWD}/ports|; /^file:/s/default/nosync,default/" /opt/local/etc/macports/sources.conf
# CI is not interactive
echo "ui_interactive no" | sudo tee -a /opt/local/etc/macports/macports.conf >/dev/null
Expand All @@ -120,23 +120,31 @@ if test "${TRAC_57720_IS_FIXED}" = "yes"; then
fi
endgroup


begingroup "Updating PortIndex"
## Run portindex on recent commits if PR is newer
git -C ports/ remote add macports https://github.com/macports/macports-ports.git
git -C ports/ fetch macports master
git -C ports/ checkout -qf macports/master~10
if ! wait $curl_portindex_pid; then
echo "Fetching PortIndex failed: $?"
if test -d ports/ && test -r ports/ && test -w ports/; then
begingroup "Updating PortIndex"
sync && echo "Run portindex on recent commits if PR is newer"
git -C ports/ remote add macports https://github.com/macports/macports-ports.git
git -C ports/ fetch macports master
git -C ports/ checkout -qf macports/master~10
if ! wait ${curl_portindex_pid}; then
sync && echo "Fetching PortIndex failed: $?"
fi
git -C ports/ checkout -qf -
git -C ports/ checkout -qf "$(git -C ports/ merge-base macports/master HEAD || echo ".")" || git -C ports/ status
sync && echo "Ignore portindex errors on common ancestor:"
(cd ports/ && (portindex || portindex . || (stat PortIndex && stat PortIndex.quick))) || portindex ports/
git -C ports/ checkout -qf -
# shellcheck disable=SC2235
if test ! -e ports/PortIndex || (test -e PortIndex && test ports/PortIndex -ot PortIndex); then
sync && echo "...and now portindex for real now:"
(cd ports/ && (portindex -e || portindex -e .)) || portindex -e ports/
else
sync && echo "...ok, that ought to be enough."
fi
endgroup
else
echo "Missing accessible 'ports/' subdir; skipping attempt to update its PortIndex"
fi
git -C ports/ checkout -qf -
git -C ports/ checkout -qf "$(git -C ports/ merge-base macports/master HEAD)"
## Ignore portindex errors on common ancestor
(cd ports/ && portindex)
git -C ports/ checkout -qf -
(cd ports/ && portindex -e)
endgroup


begingroup "Running postflight"
# Create macports user
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ jobs:
-exec chmod -R go+rX {} \;
- name: Archive build logs
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.os }}.zip
path: /tmp/mpbb/*/logs

0 comments on commit f1748d1

Please sign in to comment.