Skip to content

Conversation

@cho-m
Copy link
Member

@cho-m cho-m commented Mar 23, 2024

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

New release needed for #166949

Signed-off-by: Michael Cho <michael@michaelcho.dev>
@github-actions github-actions bot added the rust Rust use is a significant feature of the PR or issue label Mar 23, 2024
@chenrui333
Copy link
Member

@github-actions
Copy link
Contributor

🤖 An automated task has requested bottles to be published to this PR.

@github-actions github-actions bot added the CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. label Mar 23, 2024
@BrewTestBot BrewTestBot enabled auto-merge March 23, 2024 02:36
@BrewTestBot BrewTestBot added this pull request to the merge queue Mar 23, 2024
Merged via the queue into master with commit 5d46a03 Mar 23, 2024
@BrewTestBot BrewTestBot deleted the cargo-outdated-0.15.0 branch March 23, 2024 02:42

def install
ENV["LIBGIT2_SYS_USE_PKG_CONFIG"] = "1"
system "tar", "--strip-components", "1", "-xzvf", "cargo-outdated-#{version}.crate" if build.stable?
Copy link
Member

Choose a reason for hiding this comment

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

We should just add crate handling to brew I think

Copy link
Member Author

@cho-m cho-m Mar 24, 2024

Choose a reason for hiding this comment

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

We could create a subclass of Tar and just let Tar handle all the logic. I don't think there is an official spec of .crate, but currently it looks like a renamed .tar.gz file.

Our UnpackStrategy::from_magic sees it this way:

brew ruby -e 'p UnpackStrategy::from_magic(Pathname("cargo-outdated-0.15.0.crate"))'
UnpackStrategy::Tar

Copy link
Member Author

@cho-m cho-m Mar 24, 2024

Choose a reason for hiding this comment

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

EDIT: Actually was trying subclass of Gzip instead of Tar. Should work with something like:

diff --git a/Library/Homebrew/unpack_strategy.rb b/Library/Homebrew/unpack_strategy.rb
index 3ce46060d3..5a09f314a2 100644
--- a/Library/Homebrew/unpack_strategy.rb
+++ b/Library/Homebrew/unpack_strategy.rb
@@ -13,6 +13,7 @@ module UnpackStrategy

   def self.strategies
     @strategies ||= [
+      Crate, # Needs to be before Tar
       Tar, # Needs to be before Bzip2/Gzip/Xz/Lzma/Zstd.
       Pax,
       Gzip,
@@ -174,6 +175,7 @@ require "unpack_strategy/bazaar"
 require "unpack_strategy/bzip2"
 require "unpack_strategy/cab"
 require "unpack_strategy/compress"
+require "unpack_strategy/crate"
 require "unpack_strategy/cvs"
 require "unpack_strategy/directory"
 require "unpack_strategy/dmg"
diff --git a/Library/Homebrew/unpack_strategy/crate.rb b/Library/Homebrew/unpack_strategy/crate.rb
new file mode 100644
index 0000000000..6b6216c6b4
--- /dev/null
+++ b/Library/Homebrew/unpack_strategy/crate.rb
@@ -0,0 +1,14 @@
+# typed: true
+# frozen_string_literal: true
+
+require_relative "tar"
+
+module UnpackStrategy
+  # Strategy for unpacking crate archives.
+  class Crate < Tar
+    sig { returns(T::Array[String]) }
+    def self.extensions
+      [".crate"]
+    end
+  end
+end

@github-actions github-actions bot added the outdated PR was locked due to age label Apr 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. outdated PR was locked due to age rust Rust use is a significant feature of the PR or issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants