Skip to content

Commit aa60bd7

Browse files
committed
fix(homebrew): formula must declare url + sha256
`brew install` failed with "formula requires at least a URL" because the formula had only version + depends_on. Point url at the released sdist and add its sha256 (byte-identical to the PyPI sdist); the install method still just writes the uv wrappers. The release `homebrew` job now hashes the published sdist and passes SHA256 to generate_formula.sh.
1 parent cdaa793 commit aa60bd7

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@ jobs:
159159
VERSION: ${{ steps.ver.outputs.version }}
160160
run: |
161161
chmod +x packaging/homebrew/generate_formula.sh
162-
./packaging/homebrew/generate_formula.sh > codeanalyzer-python.rb
162+
# The release job just published the sdist as a Release asset; hash the
163+
# exact bytes users will download so the formula checksum always matches.
164+
sdist="https://github.com/${REPO}/releases/download/v${VERSION}/codeanalyzer_python-${VERSION}.tar.gz"
165+
SHA256="$(curl -fLsS "$sdist" | shasum -a 256 | cut -d' ' -f1)"
166+
REPO="$REPO" VERSION="$VERSION" SHA256="$SHA256" \
167+
./packaging/homebrew/generate_formula.sh > codeanalyzer-python.rb
163168
cat codeanalyzer-python.rb
164169
165170
- name: Push formula to codellm-devkit/homebrew-tap

packaging/homebrew/generate_formula.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,30 @@
1414
# isolated environment on first run). This keeps `brew install` sandbox-safe (no
1515
# network at build time) while pinning the exact released version.
1616
#
17+
# Homebrew requires every formula to declare a source `url` + `sha256` for its
18+
# stable spec, so we point at the released sdist (byte-identical to the PyPI one).
19+
# The install method ignores the unpacked source and just writes uv wrappers, but
20+
# the url anchors the version and satisfies Homebrew's spec requirement.
21+
#
1722
# Usage:
18-
# REPO=codellm-devkit/codeanalyzer-python VERSION=0.2.0 \
23+
# REPO=codellm-devkit/codeanalyzer-python VERSION=0.2.0 SHA256=<sdist sha256> \
1924
# ./generate_formula.sh > codeanalyzer-python.rb
2025
#
2126
set -euo pipefail
2227

2328
REPO="${REPO:?set REPO, e.g. codellm-devkit/codeanalyzer-python}"
2429
VERSION="${VERSION:?set VERSION, e.g. 0.2.0}"
30+
SHA256="${SHA256:?set SHA256 of the released sdist}"
31+
SDIST_URL="https://github.com/${REPO}/releases/download/v${VERSION}/codeanalyzer_python-${VERSION}.tar.gz"
2532

2633
cat <<EOF
2734
# This file is auto-generated by packaging/homebrew/generate_formula.sh on release.
2835
# Do not edit by hand -- changes will be overwritten on the next tag.
2936
class CodeanalyzerPython < Formula
3037
desc "CLDK Python analyzer (canpy) -- emits canonical analysis.json or a Neo4j graph"
3138
homepage "https://github.com/${REPO}"
39+
url "${SDIST_URL}"
40+
sha256 "${SHA256}"
3241
version "${VERSION}"
3342
license "Apache-2.0"
3443

0 commit comments

Comments
 (0)