-
Notifications
You must be signed in to change notification settings - Fork 0
Add script to test Homebrew formula with local build #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4606fad
fbd9b93
36ab9e6
fcaf2e7
6fb77da
56da442
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,64 @@ | ||||||||||||
| #!/usr/bin/env bash | ||||||||||||
| set -euo pipefail | ||||||||||||
|
|
||||||||||||
| # Test the Homebrew formula against a local build of deepwork | ||||||||||||
| # Usage: ./scripts/test-homebrew.sh [path-to-homebrew-tap] | ||||||||||||
|
|
||||||||||||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||||||||||||
| REPO_DIR="$(dirname "$SCRIPT_DIR")" | ||||||||||||
| HOMEBREW_TAP="${1:-$REPO_DIR/../homebrew-deepwork}" | ||||||||||||
|
|
||||||||||||
| if [[ ! -f "$HOMEBREW_TAP/Formula/deepwork.rb" ]]; then | ||||||||||||
| echo "Error: homebrew-deepwork tap not found at $HOMEBREW_TAP" | ||||||||||||
| echo "Usage: $0 [path-to-homebrew-tap]" | ||||||||||||
| exit 1 | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| echo "==> Building deepwork from $REPO_DIR" | ||||||||||||
| cd "$REPO_DIR" | ||||||||||||
|
|
||||||||||||
| # Clean previous builds | ||||||||||||
| rm -rf dist/ | ||||||||||||
|
|
||||||||||||
| # Build the sdist tarball | ||||||||||||
| uv build --sdist | ||||||||||||
|
||||||||||||
|
|
||||||||||||
| # Find the built tarball | ||||||||||||
| TARBALL=$(ls dist/deepwork-*.tar.gz | head -1) | ||||||||||||
|
||||||||||||
| TARBALL=$(ls dist/deepwork-*.tar.gz | head -1) | |
| shopt -s nullglob | |
| tarballs=(dist/deepwork-*.tar.gz) | |
| shopt -u nullglob | |
| TARBALL="${tarballs[0]:-}" |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script does not clean up the temporary local tap created for testing. After the script completes (successfully or on error), the local tap local/deepwork-test will remain in the Homebrew installation directory. Consider adding a trap to ensure cleanup happens even if the script fails, similar to the pattern used in nix/claude-code/update.sh which uses trap "rm -rf $TMPDIR" EXIT. Add cleanup at the end or use a trap to remove the tap directory.
| # Ensure the local test tap is cleaned up on exit, even on failure | |
| trap 'brew untap "$TAP_NAME" >/dev/null 2>&1 || true; rm -rf "$TAP_DIR"' EXIT |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sed command uses unquoted variable substitution within the replacement pattern, which could be vulnerable to injection if the tarball path contains special sed metacharacters like &, /, or \. While this is low-risk since the path is constructed by the script itself, it's a best practice to escape variables used in sed patterns. Consider using a delimiter other than | in the sed command and properly escaping the variables, or use alternative tools like awk or perl for more robust text replacement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script changes the working directory with
cd "$REPO_DIR"but never restores it. If this script is sourced or called from another script expecting the current directory to be preserved, this could cause issues. While this is less critical for a standalone utility script, consider either documenting this behavior or saving and restoring the original directory at the end of the script.