Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions scripts/check-updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def download_and_hash(url: str) -> str | None:
return None


def update_formula_file(path: Path, new_version: str, new_url: str, new_sha256: str) -> None:
def update_formula_file(path: Path, old_version: str, new_version: str, new_url: str, new_sha256: str) -> None:
"""Update a formula TOML file with new version, source URL, and SHA-256."""
content = path.read_text()

Expand Down Expand Up @@ -134,10 +134,6 @@ def update_formula_file(path: Path, new_version: str, new_url: str, new_sha256:
)

# Update mirrors that contain the old version
# Read old version to find/replace in mirror URLs
with open(path, "rb") as f:
old_data = tomllib.load(f)
old_version = old_data["package"]["version"]
if old_version != new_version:
content = content.replace(old_version, new_version)

Comment on lines 136 to 139

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content.replace(old_version, new_version) runs over the entire TOML, not just [source].mirrors as the comment suggests. In existing formulas (e.g., formulas/curl.toml), the version string appears in [bottle.*].url values; this replacement will rewrite those URLs to the new version while leaving the bottle sha256 unchanged (and likely pointing at assets that don’t exist yet), which can break installs between the version-bump commit and the later bottle rebuild/update. Please scope the replacement to the [source] mirrors entries (or alternatively clear/remove bottle sections on version bumps) so bottle URLs/SHAs aren’t mutated here.

Copilot uses AI. Check for mistakes.
Expand Down Expand Up @@ -233,6 +229,7 @@ def main() -> None:
print(f" Applying update to {formula_path}...", file=sys.stderr)
update_formula_file(
formula_path,
result["current_version"],
result["new_version"],
result["new_url"],
result["new_sha256"],
Expand Down
Loading