Skip to content
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

Add Cargo package manager #2662

Merged
merged 20 commits into from
Sep 15, 2024
Merged

Conversation

wilt00
Copy link
Contributor

@wilt00 wilt00 commented Aug 24, 2024

  • I have read the contributing guidelines, and I agree with the Code of Conduct.
  • Have you checked that there aren't other open pull requests for the same changes?
  • Have you tested that the committed code can be executed without errors?
  • This PR is not composed of garbage changes used to farm GitHub activity to enter potential Crypto AirDrops.
    Any user suspected of farming GitHub activity with crypto purposes will get banned. Submitting broken code wastes the contributors' time, who have to spend their free time reviewing, fixing, and testing code that does not even compile breaks other features, or does not introduce any useful changes. Thank you for your understanding.

This PR adds basic support for Cargo, the Rust package manager.

Remaining blockers keeping this PR as a draft:

  • Currently, the process for installing and upgrading packages seems to hang without terminating, and the fact that logs aren't refreshed in the app until the end of execution is making this hard for me to debug. (The Live Output doesn't seem to be.) At one point I had this working, and I'm not sure what I changed to break it, so I'm posting this PR as-is in the hopes that you can spot what I'm doing wrong.
  • Missing package manager icon asset
  • Documentation

@marticliment
Copy link
Owner

Great! if you need help or guidance, please let me know!

@marticliment marticliment linked an issue Aug 26, 2024 that may be closed by this pull request
@marticliment
Copy link
Owner

[ ] Currently, the process for installing and upgrading packages seems to hang without terminating, and the fact that logs aren't refreshed in the app until the end of execution is making this hard for me to debug. (The Live Output doesn't seem to be.) At one point I had this working, and I'm not sure what I changed to break it, so I'm posting this PR as-is in the hopes that you can spot what I'm doing wrong.

This is weird, I have found that cargo.exe prints to STDERR instead of to STDOUT, effectively preventing the output from showing. I am going to fix this

@marticliment
Copy link
Owner

marticliment commented Sep 2, 2024

And this is why that happens: rust-lang/cargo#1473

@marticliment
Copy link
Owner

Operations are working now.

Do you think it would be possible to not show libraries on the Discover packages page? I mean, show only binary-containing packages?

@wilt00 wilt00 marked this pull request as ready for review September 3, 2024 01:33
@wilt00
Copy link
Contributor Author

wilt00 commented Sep 3, 2024

Thanks! I've added functionality to check each search result against the registry api to see if it has any binaries listed, which isn't perfect since some libraries include test binaries, but should handle most cases. Unfortunately it is quite slow, to comply with the one request per second rate limit.

@marticliment
Copy link
Owner

And do you think it would be possible to fetch this data directly from the https://github.com/rust-lang/crates.io-index ? In my understanding, since you can obtain the package's manifest, you should be able to parse it, right?

@wilt00
Copy link
Contributor Author

wilt00 commented Sep 3, 2024

Unfortunately the index files at that link don't include the bin_names field that indicates if a package has binaries. Another thing that would work, though, is getting that info from the daily DB dump at https://static.crates.io/db-dump.zip . That would either require users to download and parse a ~700MB file, or a small backend service to do the same thing and expose a lighter API. Possibly a github action?

@marticliment
Copy link
Owner

And if we parse the crates.io website? I have found that on binary packages, the install command is cargo install, while on libraries it is cargo add:

See here:

@marticliment
Copy link
Owner

marticliment commented Sep 3, 2024

The page's raw html does contain the info, so this should be easily doable:

image

@marticliment marticliment merged commit 05ff247 into marticliment:main Sep 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MANAGER] Cargo (rust)
2 participants