Repository navigation
fix: move bottle block below url in image formulas - #16
Merged
Merged
Conversation
brew style rejects the bottle block position that pr-pull produced: FormulaAudit/ComponentsOrder: url (line 12) should be put before bottle (line 5) The two tools disagree because of the VERSION/LINUX_IMAGE constants sitting between homepage and url. pr-pull inserts the bottle block via FormulaAST#add_stanza, which scans the body top-to-bottom and stops at the first node it does not recognise as a stanza -- a constant assignment -- so it lands the block right after homepage. The ComponentsOrder cop ignores the constants entirely and only compares the relative order of known components, so it sees bottle before url. Removing the constants lets both agree: url now sits in its canonical position and install derives the filename from the url instead. Note that `brew style --fix` does not fix this correctly -- it hoists url above the constants it interpolates, and the formulas then fail to load with "uninitialized constant LINUX_IMAGE". Version and revision are unchanged, so the published bottles remain valid and no republish is needed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brew stylecurrently fails onmain, which blocks every PR against the tap (including #15):Why this happened
pr-pullput the bottle block there itself, in the two commits it pushed tomainearlier today (1fad0bb, 061fefe). The two tools disagree because of theVERSION/LINUX_IMAGEconstants sitting betweenhomepageandurl:pr-pullinserts the block viaFormulaAST#add_bottle_block→add_stanza(Library/Homebrew/utils/ast.rb). That walks the formula body top-to-bottom and breaks at the first node it does not recognise as a stanza. A constant assignment is not a stanza, so it stops there and inserts after the last thing it did recognise —homepage.FormulaAudit/ComponentsOrderdoes no positional scanning. It ignores the constants entirely and compares the relative order of known components, so it seesbottlebeforeurl.With the constants between
homepageandurl, the two can never agree.This did not fail CI on
mainbecause pushes made by Actions withGITHUB_TOKENdo not trigger workflows, sotests.ymlnever ran afterpr-pullrewrote the files.The fix
Remove the constants and inline the URL, so
urlsits in its canonical position andinstallderives the filename from it. Both tools then agree, and a futurepr-pulltakes thereplace_bottle_blockpath anyway, which edits in place.brew style --fixdoes not fix this correctly — it hoistsurlabove the constants it interpolates, and both formulas then fail to load withuninitialized constant LINUX_IMAGE/ROOTFS_IMAGE.Bottles
Version and revision are unchanged and the
bottleblocks are preserved verbatim, so the published bottles stay valid. This should be merged normally rather than with thepr-pulllabel, to avoid republishing bottles for a version+revision already in ghcr.io.Verification
Locally on arm64 macOS:
brew style cartesi/tap— 6 files, no offenses (fails with 2 offenses before this change)brew readall --aliases --os=all --arch=all cartesi/tap— cleanbrew info --json=v2— still0.21.0revision 2 for both, so existing bottles matchbrew reinstall --build-from-source— identical cellar layout andetc/cartesi/imagessymlinks as before🤖 Generated with Claude Code