-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use script to pick the qemu formula for the desired version
This will automatically pick the right bottle for the OS of the runner, and we can easily change the QEMU version number without having to look up commit ids manually. Signed-off-by: Jan Dubois <jan.dubois@suse.com>
- Loading branch information
Showing
2 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
# This script only works for formulas in the homebrew-core | ||
|
||
set -eu -o pipefail | ||
|
||
FORMULA=$1 | ||
VERSION=$2 | ||
|
||
export HOMEBREW_NO_AUTO_UPDATE=1 | ||
export HOMEBREW_NO_INSTALL_UPGRADE=1 | ||
export HOMEBREW_NO_INSTALL_CLEANUP=1 | ||
|
||
# I never want to see the condescending warnings from Homebrew, like | ||
# > We (and Apple) do not provide support for this old version. | ||
export HOMEBREW_DEVELOPER=1 | ||
|
||
TAP=lima/tap | ||
if ! brew tap | grep -q "^${TAP}\$"; then | ||
brew tap-new "$TAP" | ||
fi | ||
|
||
# Get the commit id for the commit that updated this bottle | ||
SHA=$(gh search commits --repo homebrew/homebrew-core "${FORMULA}: update ${VERSION} bottle" --json sha --jq "last|.sha") | ||
if [[ -z $SHA ]]; then | ||
echo "${FORMULA} ${VERSION} not found" | ||
exit 1 | ||
fi | ||
|
||
OUTPUT="$(brew --repo "$TAP")/Formula/${FORMULA}.rb" | ||
RAW="https://raw.githubusercontent.com/Homebrew/homebrew-core" | ||
curl -s "${RAW}/${SHA}/Formula/${FORMULA::1}/${FORMULA}.rb" -o "$OUTPUT" | ||
|
||
if brew ls -1 | grep -q "^${FORMULA}\$"; then | ||
brew uninstall "$FORMULA" --ignore-dependencies | ||
fi | ||
brew install "${TAP}/${FORMULA}" |