-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
unpack_strategy: allow unpacking .crate (as a gzipped tar) #16951
Conversation
Library/Homebrew/unpack_strategy.rb
Outdated
@@ -13,6 +13,7 @@ module UnpackStrategy | |||
|
|||
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
.crate
extension insideTar
instead. 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
.crate
extension insideTar
instead. 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
.crate
is just a renamed.tar.gz
then 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 <[email protected]>
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 style
with your changes locally?brew typecheck
with your changes locally?brew tests
with 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