Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@runesoerensen
Copy link
Contributor

@runesoerensen runesoerensen commented Sep 24, 2024

This PR imports and migrates the inventory code here to the libherokubuildpack crate. The code was copied as-is and added in the first commit, and I've tried to keep changes to integrate it to a minimum.

I'm not sure what the best approach is to adapt the sha2 and semver feature flags from the source inventory crate - perhaps it's fine as-is, or perhaps it'd make sense to use different feature names given the new context/crate for the code. Relevant commit with comment.

I've removed a couple re-exports that appear to be unnecessary - see explanation in this commit.

Copy all files currently living in https://github.com/Malax/inventory/tree/main/inventory/src without any changes.

Co-Authored-By: Manuel Fuchs <[email protected]>
Co-Authored-By: Josh W Lewis <[email protected]>
@runesoerensen runesoerensen marked this pull request as ready for review September 24, 2024 07:54
@runesoerensen runesoerensen requested a review from a team as a code owner September 24, 2024 07:54
We may want to consider another approach here (e.g. naming the feature `inventory-sha2` and/or pulling in the inventory dependency ["inventory", "dep:sha2"]).

While the crate will be pulled in if a user enables the `sha2`, the inventory-specific sha2 code won't be compiled unless the `inventory` feature is also enabled.
These re-exports appear to be unnecessary, and doesn't have any impact on code that rely on the `inventory` module (and have the `semver` and/or `sha2` features enabled). Also see related prior discussion here Malax/inventory#2 (comment).

The `semver` and `sha2` modules only contain implementations of public traits, so I don't think we need to re-export those (unlike bringing for instance a function or struct in to scope).

If I understand how trait implementations work correctly, it doesn't matter where an implementation lives (only the visibility of the trait and the type it's implemented for is relevant) - in other words, the implementation will be available to any code that can access both the trait and the type, even across crate binaries.
@schneems
Copy link
Contributor

schneems commented Oct 1, 2024

There's a few comments on docs. I took a stab at it in a stacked PR #864. Feedback/review is welcome over there or it's free to be merged in here and iterated on. The only known pending thing is i put the feature names in the docs as TODO.

runesoerensen and others added 3 commits October 2, 2024 14:25
* Add module docs and example

* Document resolve and partial_resolve

* Document more inventory methods

* Document Artifact

* Document ArtifactRequirement

I also suggest we change the name of `inventory/version` to `inventory/artifact_requirement.rs` or `requirement.rs`.

* Update example to compare Checksum instead of string

* Apply suggestions from code review

Co-authored-by: Rune Soerensen <[email protected]>

* Update feature names

* Rewrite example usage

* Show how to display checksum in example

---------

Co-authored-by: Rune Soerensen <[email protected]>
@runesoerensen
Copy link
Contributor Author

@joshwlewis I've merged Richard's documentation PR - I think should address your documentation comments?

@joshwlewis
Copy link
Member

@Malax I think this is waiting on you now. It looks like the changes you requested have been made. Can we get a 👍🏻?

@runesoerensen runesoerensen merged commit f8dc601 into main Oct 16, 2024
4 checks passed
@runesoerensen runesoerensen deleted the migrate-inventory-code branch October 16, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request libherokubuildpack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants