homebrew-formula-maintenance
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHomebrew Formula Maintenance
Homebrew Formula维护
Overview
概述
Use this workflow to keep Homebrew formulas in sync with PyPI releases for Python CLIs. The pattern in your taps is: update version + sha, refresh resource blocks when needed, run brew install/test/audit, then push the tap update (manually or via CI).
使用此工作流可让Homebrew formula与Python CLI的PyPI发布保持同步。你的tap中的操作模式为:更新版本+SHA,必要时刷新资源块,运行brew install/test/audit,然后推送tap更新(手动或通过CI)。
Quick Start (manual bump)
快速开始(手动升级版本)
- Verify the PyPI release exists and grab the sdist URL + SHA256.
- Update the and
urlin the formula.sha256 - Refresh stanzas if the formula uses
resource.virtualenv_install_with_resources - Test: +
brew install --build-from-source+brew test.brew audit --strict - Update changelog/tag and push the tap repo.
- 确认PyPI版本已发布,获取sdist URL及SHA256值。
- 更新formula中的和
url字段。sha256 - 若formula使用,则刷新
virtualenv_install_with_resources代码块。resource - 测试:执行+
brew install --build-from-source+brew test。brew audit --strict - 更新变更日志/标签并推送tap仓库。
Local Scripts You Already Use
你已在使用的本地脚本
homebrew-claude-mpm/scripts/update_formula.sh <version>- Verifies PyPI, updates url/sha, regenerates resources, optional brew test/audit.
homebrew-claude-mpm/scripts/generate_resources.py- Emits Python dependency blocks from PyPI.
resource
- Emits Python dependency
homebrew-claude-mpm/scripts/test_formula.sh- End-to-end brew install/test/audit/style.
mcp-vector-search/scripts/update_homebrew_formula.py- End-to-end tap update with ,
--dry-run,--versionand--tap-repo-path.HOMEBREW_TAP_TOKEN
- End-to-end tap update with
homebrew-claude-mpm/scripts/update_formula.sh <version>- 验证PyPI版本,更新url/sha,重新生成资源,可选执行brew test/audit。
homebrew-claude-mpm/scripts/generate_resources.py- 从PyPI生成Python依赖的代码块。
resource
- 从PyPI生成Python依赖的
homebrew-claude-mpm/scripts/test_formula.sh- 端到端执行brew install/test/audit/style检查。
mcp-vector-search/scripts/update_homebrew_formula.py- 支持、
--dry-run、--version和--tap-repo-path参数的端到端tap更新脚本。HOMEBREW_TAP_TOKEN
- 支持
Standard Workflow
标准工作流
1. Confirm PyPI Release
1. 确认PyPI版本发布
- Check the sdist is available and capture URL/SHA.
- Typical command: .
curl -s https://pypi.org/pypi/<package>/<version>/json
- 检查sdist是否可用并获取URL/SHA值。
- 常用命令:。
curl -s https://pypi.org/pypi/<package>/<version>/json
2. Update Formula URL + SHA
2. 更新Formula的URL + SHA
- Replace and
urlinsha256.Formula/<name>.rb - Keep the formula version implicit via the sdist URL (your taps do this).
- 替换中的
Formula/<name>.rb和url字段。sha256 - 通过sdist URL隐式指定formula版本(你的tap已采用此方式)。
3. Refresh Resources (Python Virtualenv Formula)
3. 刷新资源(Python虚拟环境Formula)
If the formula uses and :
Language::Python::Virtualenvvirtualenv_install_with_resources- Regenerate stanzas after dependency changes.
resource - Use or equivalent; review output before pasting.
generate_resources.py
若formula使用和:
Language::Python::Virtualenvvirtualenv_install_with_resources- 依赖变更后重新生成代码块。
resource - 使用或等效工具,粘贴前需检查输出内容。
generate_resources.py
4. Test and Audit
4. 测试与审计
Run these in the tap repo:
bash
brew install --build-from-source ./Formula/<name>.rb
brew test <name>
brew audit --strict ./Formula/<name>.rb
brew style ./Formula/<name>.rb在tap仓库中执行以下命令:
bash
brew install --build-from-source ./Formula/<name>.rb
brew test <name>
brew audit --strict ./Formula/<name>.rb
brew style ./Formula/<name>.rb5. Commit and Push
5. 提交并推送
- Update if the tap repo tracks releases.
CHANGELOG.md - Commit, tag, and push as required by the tap workflow.
- 若tap仓库跟踪版本,更新。
CHANGELOG.md - 按照tap工作流要求提交、打标签并推送。
Formula Patterns (From Your Taps)
Formula模式(来自你的Tap)
Full Virtualenv Formula (claude-mpm)
完整虚拟环境Formula(claude-mpm)
include Language::Python::Virtualenvvirtualenv_install_with_resources- Large blocks to pin dependencies
resource - uses CLI commands like
test doand subcommands--version
include Language::Python::Virtualenvvirtualenv_install_with_resources- 用于固定依赖的大型代码块
resource - 部分使用
test do等CLI命令及子命令--version
Minimal Venv Formula (mcp-vector-search)
极简虚拟环境Formula(mcp-vector-search)
- Create venv explicitly and
pip install -v buildpath - for CLI entrypoint
bin.install_symlink - Minimal uses
test doand--version--help
- 显式创建虚拟环境并执行
pip install -v buildpath - 使用配置CLI入口
bin.install_symlink - 部分仅使用
test do和--version命令--help
CI Automation Pattern
CI自动化模式
Your GitHub Actions workflow for Homebrew updates follows this flow:
- Trigger on tag or after CI succeeds.
workflow_run - Run .
scripts/update_homebrew_formula.py - Require (and optional
HOMEBREW_TAP_TOKEN).HOMEBREW_TAP_REPO - On failure, open an issue with manual update steps.
你的Homebrew更新GitHub Actions工作流遵循以下流程:
- 由标签触发或在CI成功后通过触发。
workflow_run - 执行脚本。
scripts/update_homebrew_formula.py - 需要(可选
HOMEBREW_TAP_TOKEN)。HOMEBREW_TAP_REPO - 若执行失败,创建包含手动更新步骤的Issue。
Troubleshooting
故障排查
- PyPI release missing: verify tag push and publish step completed.
- SHA mismatch: re-fetch sdist SHA from PyPI JSON.
- brew audit failures: confirm dependency resource blocks match the sdist and dependency is present.
python@x.y - Install failures: verify dependency and
python@x.yusage.virtualenv_install_with_resources
- PyPI版本缺失:确认标签推送及发布步骤已完成。
- SHA不匹配:重新从PyPI JSON获取sdist的SHA值。
- brew audit失败:确认依赖资源块与sdist一致,且已添加依赖。
python@x.y - 安装失败:验证依赖及
python@x.y的使用是否正确。virtualenv_install_with_resources
Related Skills
相关技能
toolchains/universal/infrastructure/github-actionstoolchains/universal/infrastructure/docker
toolchains/universal/infrastructure/github-actionstoolchains/universal/infrastructure/docker