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

More Cargo improvements #8497

Merged
merged 9 commits into from
Apr 9, 2024
Merged

More Cargo improvements #8497

merged 9 commits into from
Apr 9, 2024

Conversation

sschuberth
Copy link
Member

Please have a look at the individual commit messages for the details.

Similar to like in e6b84fa, get the data directly from `projectPkg`
which already contains the processed declared licenses.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
Reduce the number of top-level functions for a better overview.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
@@ -93,6 +93,30 @@ internal data class CargoMetadata(
/** The Package ID of this node. */
val id: String,
/** The dependencies of this package, an array of Package IDs. */
val dependencies: List<String>
Copy link
Member

Choose a reason for hiding this comment

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

commit message: Would you have a link pointing to some definition of "renamed dependencies" ?

This will allow to track renamed dependencies [1] in the future.

[1]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
Rewrite getting the dependencies using `Node.deps` to be able to make
fewer assumptions about Cargo's internal package IDs as a preparation
for supporting Cargo 1.77 [1] and newer, which did "Stabilize the package
identifier format as Package ID Spec" [2].

[1]: https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-177-2024-03-21
[2]: https://doc.rust-lang.org/nightly/cargo/reference/pkgid-spec.html

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
Both lockfile versions 1 and 2 did not use a `version` field as part of
the lockfile yet. One way to distinguish these versions is to look for
the presence of "checksum" entries in the `metadata` field, see [1]. Do
that and treat version 2 like version 3, instead of treating version 2
like version 1 before.

[1]: rust-lang/cargo@34bca03

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
…kups

The `pkg.id` is Cargo's internal package ID which does not look like
"name version (source)" for all Cargo versions. So avoid using it and
instead be explicit about the key format that was used to build the
`hashes` map.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
Instead of determining projects based on Cargo's internal package ID,
use the `source` property which is `null` for local code.

Fixes #8480.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
Make higher-level functions go first for a better overview.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
@sschuberth sschuberth merged commit c7d24d9 into main Apr 9, 2024
20 of 21 checks passed
@sschuberth sschuberth deleted the cargo-imps branch April 9, 2024 12:57
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.

3 participants