Write a new version of a package from its newest one #9

Merged
jeff merged 2 commits from new-version into main 2026-10-14 01:12:04 -05:00
Owner

Closes #7.

Adds wingetsource new-version, which jeff/winget-submit will run (ADR 0004):

python3 -m wingetsource new-version --manifests manifests \
    --identifier JCOllie.Clipwatch --version 0.3.0 \
    --installer x64=<url> [--installer arm64=<url> ...] \
    [--release-notes-url <url>] [--release-date YYYY-MM-DD]
  • It copies the newest version, by version.py's winget ordering, and replaces PackageVersion in every file, ReleaseDate, and each installer's InstallerUrl and InstallerSha256, matched by Architecture. The hash comes from downloading the installer.
  • The default locale's ReleaseNotesUrl is set from --release-notes-url, or dropped when it isn't given.
  • The values are edited in the text, at the positions YAML reports for them, so the SPDX header, the schema comment and the layout come through unchanged. A value that wouldn't read back as plain YAML text is written double-quoted.
  • Nothing is written if the version already exists, if the package has no versions, if the architectures differ from the newest version's, or if a download fails.
  • README and CONTRIBUTING describe it.

Beyond the ticket

  • A bug fix in check, in its own commit. Cloudflare in front of git.jcollie.dev rejects urllib's default Python-urllib/3.x user agent with a 403, so check could never have downloaded an installer hosted there. That hadn't shown yet, because no change has made check download one. The shared download function now sends wingetsource (+https://git.jcollie.dev/jeff/winget-pkgs).
  • ReleaseNotes is always dropped. It's the old version's text, the same reason ReleaseNotesUrl is replaced.
  • Locale files other than the default are copied with both release-notes fields dropped.
  • Two installers for the same architecture are refused, since the architecture alone can't say which is which. Per-installer ReleaseDate is replaced where it appears.

Testing

  • 19 new unit tests. One of them copies every package in the repository and runs check_directory on the result.
  • An end-to-end run on a copy of the tree: Clipwatch 0.2.1 written from 0.2.0, with check --changed-since downloading the installer from git.jcollie.dev and finding 0 problems. The diff against 0.2.0 was exactly PackageVersion, ReleaseDate, the URL and hash, and ReleaseNotesUrl. The installer used was Clipwatch's source archive, because Clipwatch has no Windows asset on git.jcollie.dev yet.

Not handled

Version-dependent fields inside an installer — AppsAndFeaturesEntries' DisplayVersion, or an MSI's ProductCode — are copied unchanged. No package here has them; a package that does would need its versions written by hand, or an option added later.

🤖 Generated with Claude Code

https://claude.ai/code/session_01D31MsLkM9DkCauP1EB2zgw

Closes #7. Adds `wingetsource new-version`, which `jeff/winget-submit` will run (ADR 0004): ```console python3 -m wingetsource new-version --manifests manifests \ --identifier JCOllie.Clipwatch --version 0.3.0 \ --installer x64=<url> [--installer arm64=<url> ...] \ [--release-notes-url <url>] [--release-date YYYY-MM-DD] ``` - It copies the newest version, by `version.py`'s winget ordering, and replaces `PackageVersion` in every file, `ReleaseDate`, and each installer's `InstallerUrl` and `InstallerSha256`, matched by `Architecture`. The hash comes from downloading the installer. - The default locale's `ReleaseNotesUrl` is set from `--release-notes-url`, or dropped when it isn't given. - The values are edited in the text, at the positions YAML reports for them, so the SPDX header, the schema comment and the layout come through unchanged. A value that wouldn't read back as plain YAML text is written double-quoted. - Nothing is written if the version already exists, if the package has no versions, if the architectures differ from the newest version's, or if a download fails. - README and CONTRIBUTING describe it. ## Beyond the ticket - **A bug fix in `check`, in its own commit.** Cloudflare in front of git.jcollie.dev rejects urllib's default `Python-urllib/3.x` user agent with a 403, so `check` could never have downloaded an installer hosted there. That hadn't shown yet, because no change has made `check` download one. The shared download function now sends `wingetsource (+https://git.jcollie.dev/jeff/winget-pkgs)`. - **`ReleaseNotes` is always dropped.** It's the old version's text, the same reason `ReleaseNotesUrl` is replaced. - **Locale files other than the default** are copied with both release-notes fields dropped. - **Two installers for the same architecture are refused**, since the architecture alone can't say which is which. Per-installer `ReleaseDate` is replaced where it appears. ## Testing - 19 new unit tests. One of them copies every package in the repository and runs `check_directory` on the result. - An end-to-end run on a copy of the tree: Clipwatch 0.2.1 written from 0.2.0, with `check --changed-since` downloading the installer from git.jcollie.dev and finding 0 problems. The diff against 0.2.0 was exactly `PackageVersion`, `ReleaseDate`, the URL and hash, and `ReleaseNotesUrl`. The installer used was Clipwatch's source archive, because Clipwatch has no Windows asset on git.jcollie.dev yet. ## Not handled Version-dependent fields inside an installer — `AppsAndFeaturesEntries`' `DisplayVersion`, or an MSI's `ProductCode` — are copied unchanged. No package here has them; a package that does would need its versions written by hand, or an option added later. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01D31MsLkM9DkCauP1EB2zgw
Cloudflare, in front of git.jcollie.dev, answers urllib's default
`Python-urllib/3.x` user agent with a 403, so checking any installer
hosted there failed. It had not shown because no change has yet asked
for one to be downloaded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01D31MsLkM9DkCauP1EB2zgw
write a new version of a package from its newest one
All checks were successful
test / test (push) Successful in 1m55s
test / publish (push) Has been skipped
test / test (pull_request) Successful in 1m37s
test / publish (pull_request) Has been skipped
3a85e75afd
`wingetsource new-version` copies the newest version of a package, by
winget's version ordering, and replaces what changes with a release:
PackageVersion, ReleaseDate, each installer's URL and SHA-256 matched by
architecture, and the release notes. The files are edited as text where
YAML places each value, so comments and layout survive. Nothing is
written if the version exists, the package has none yet, or the
architectures differ.

Closes #7

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01D31MsLkM9DkCauP1EB2zgw
jeff scheduled this pull request to auto merge when all checks succeed 2026-10-14 01:11:37 -05:00
jeff merged commit 4e42d1b071 into main 2026-10-14 01:12:04 -05:00
jeff deleted branch new-version 2026-10-14 01:12:05 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jeff/winget-pkgs!9
No description provided.