-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
unpack_strategy: allow unpacking .crate (as a gzipped tar) #16951
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
Conversation
Library/Homebrew/unpack_strategy.rb
Outdated
|
|
||
| def self.strategies | ||
| @strategies ||= [ | ||
| Crate, # Needs to be before Tar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to think about this a bit more as Crate needs to be detected before Tar, but we don't want reverse also too for UnpackStrategy.from_magic(...).
Options:
- May need to add explicit check on extension inside
Crate.can_extract?. - Could just allow
.crateextension insideTarinstead. Simplest change as it only adds extra string tounpack_strategy/tar.rb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Could just allow
.crateextension insideTarinstead. Simplest change as it only adds extra string tounpack_strategy/tar.rb.
If .crate is just a renamed .tar.gz then it makes sense to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
.crateis just a renamed.tar.gzthen it makes sense to do this.
Currently it is though there is no documentation guaranteeing it. Assuming Rust doesn't switch to some obscure/specialized format, shouldn't be too difficult to maintain.
https://github.com/rust-lang/cargo/blob/0.78.0/src/cargo/ops/cargo_package.rs#L689-L694
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently it is though there is no documentation guaranteeing it.
I think we can assume it is for now and then deal with it if/when things break.
Perhaps leave a comment mentioning that we make an assumption based on undocumented behaviour of cargo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it is an implementation detail, realistically a change to the format would likely break older cargo versions without branching off the API to download it.
And if it did break in-place, we would still have to adjust anyway if it was a separate strategy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can assume it is for now and then deal with it if/when things break.
Agreed 👍🏻
Signed-off-by: Michael Cho <michael@michaelcho.dev>
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me, thanks again @cho-m!
|
May still need Homebrew/homebrew-core#167208 beforehand for existing usage. And then need to follow up to drop the |
brew stylewith your changes locally?brew typecheckwith your changes locally?brew testswith your changes locally?Related to discussion in Homebrew/homebrew-core#166955 (comment)
Will need Homebrew/homebrew-core#167208 first to avoid breaking corresponding formula builds