New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkgid output appears to no longer output package name even when the directory name and package name are the same #5612
Comments
I've asked about this over on the forums in case it's always behaved like this and the advice I got wasn't the 100% accurate answer for all cases. |
Hello, @colindean! This appears to be completely expected behavior, as it's fully consistent with the formal grammar. It's honestly a wonder that you hadn't run into issues earlier with your existing parsing method. I guess you got lucky. 😄 The package ID from Travis refers to a package named If you wanted to get the binary name consistently from a package ID, I'd say you could check the string from the end backwards and see if it runs into a Consider the following example:
Here is another example using the same algorithm:
Here is a bonus example where the package ID does not specify a source URL:
Hope this helps. |
Thanks for the thorough explanation, @ebkalderon. I found another way to do it: use the
The folks on the Rust user forum helped me figure it out in What is the best way to get the name of the binary that cargo will produce? . I guess I'll close this since it's working as expected and seems not to have ever changed… |
I've got a Makefile wrapping my Rust binary project that gets the name of the artifact using this:
On my workstation, this returns the name of the package, same as what's as defined at
package.name
in Cargo.toml.Recently, this started returning the version in Travis. I can't quite put my finger on when it started doing this, but I think it's with the release of 1.26 as our Travis builds are always against latest stable.
Confused, I debugged a bit.
On my mac:
On travis:
Maybe it's a directory thing? If I change the name of the directory locally:
It appears that the name of the artifact no longer prints separately in the pkgid if the name of the binary and the directory name are the same. I believe this is a change in behavior.
My true need is "how I can I reliably get the name of the produced artifact?" and the snippet above was what was recommended in
#cargo
on IRC a few months ago…The text was updated successfully, but these errors were encountered: