Refactor macdeploycheck formula to use direct script installation and improve error handling in install_brew_deps.sh
This commit updates the `macdeploycheck` formula to install the script directly from the tapped repository, ensuring consistency with the tapped revision. Additionally, the `install_brew_deps.sh` script is modified to provide clearer error messages when loading formulae fails, enhancing the overall user experience during dependency checks.
This commit is contained in:
@@ -2,16 +2,16 @@ class Macdeploycheck < Formula
|
||||
desc "Sanity checks a macOS .app bundle for accidental Homebrew runtime dependencies"
|
||||
homepage "https://github.com/strawberrymusicplayer/strawberry"
|
||||
version "0.1.0"
|
||||
# Homebrew requires a URL stanza. Use the script shipped in this tap (file://),
|
||||
# so installs always match the tapped revision.
|
||||
url "file://#{File.expand_path("../../dist/macos/macdeploycheck.sh", __dir__)}"
|
||||
sha256 :no_check
|
||||
license "MIT"
|
||||
|
||||
depends_on :macos
|
||||
|
||||
def install
|
||||
# Install the script from the tapped repo working tree.
|
||||
# (__dir__ is .../Formula, so ../.. is the tap root)
|
||||
script = File.expand_path("../../dist/macos/macdeploycheck.sh", __dir__)
|
||||
bin.install script => "macdeploycheck"
|
||||
bin.install "macdeploycheck.sh" => "macdeploycheck"
|
||||
end
|
||||
|
||||
test do
|
||||
|
||||
@@ -94,10 +94,10 @@ run_with_heartbeat "Refreshing strawberry/local tap clone" bash -lc '
|
||||
'
|
||||
|
||||
for f in kdsingleapplication-qt6 qtsparkle-qt6 sparkle-framework libgpod macdeploycheck; do
|
||||
if ! brew info "strawberry/local/${f}" >/dev/null 2>&1; then
|
||||
echo "Error: Missing formula strawberry/local/${f} in the tapped repo." >&2
|
||||
if ! info_out="$(brew info "strawberry/local/${f}" 2>&1 >/dev/null)"; then
|
||||
echo "Error: Unable to load formula strawberry/local/${f} from the tapped repo (brew info failed)." >&2
|
||||
echo "Details (brew info):" >&2
|
||||
brew info "strawberry/local/${f}" >&2 || true
|
||||
echo "$info_out" >&2
|
||||
echo "If you recently added/changed formulae, ensure they are committed, then refresh the tap:" >&2
|
||||
echo " git -C \"$(brew --repo strawberry/local)\" pull --ff-only" >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user