Repository navigation
Parse the version from cargo pkgid with parameter expansion - #421
Merged
Merged
Conversation
The version was parsed in the CI workflow and Toastfile in different ways. The CI workflow's `cut` commands expected Cargo's old `name:version` format and returned `name@version` with current Cargo when the directory name differs from the package name, and the Toastfile's `grep` truncated prerelease versions. Now each takes everything after the last `#`, `@`, or `:` in the package ID, which is the version in every format.
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.
Unifies how the version is read from
cargo pkgidon one form, parameter expansion:This strips everything through the last
#,@, or:, leaving the version for everycargo pkgidformat.Replaced:
.github/workflows/ci.yml:cut -d# -f2 | cut -d: -f2. It handled Cargo's oldname:versionformat, but with current Cargo it returnsname@versionwhenever the checkout directory's name differs from the package name.toast.yml(publishtask):grep --extended-regexp --only-matching '[0-9.]+$'. It handled every format but truncated prerelease versions (1.2.3-beta.1became.1).Verified: with Cargo 1.99,
cargo pkgidprints…/dir#1.2.3when the directory matches the package name,…/dir#name@1.2.3when it doesn't, and…#name@1.2.3-beta.1for a prerelease. The expansion gave the right version in all three, whilecutfailed the last two andgrepfailed the prerelease. In this repository, I ran each changed line, extracted from the files, in Bash withset -euo pipefail(the CI step's shell, and the shell Toast tasks run in), and each produced the versioncargo metadatareports. Both YAML files still parse.This is the same change in all the Rust projects.
Status: Ready
Fixes: N/A