Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing previous versions of a formula with brew extract

Tags:

homebrew

Due to a problem with the Subversion 1.13 Brew formula I was installing an older revision of the formula:

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/0c3d786402ad7d9dd5eb6907e3ed3f2525a0472d/Formula/subversion.rb

That gives a warning:

Warning: Calling Installation of subversion from a GitHub commit URL is deprecated! Use 'brew extract subversion' to stable tap on GitHub instead.

The suggestion is the same as this tip.

Now, I'd like to do this properly using brew extract subversion rather than using the deprecated commit URL. I'd like to install Subversion 1.13_5 on some computers, but Subversion 1.14 is the latest formula.

I need to do something like this: brew extract --version 1.13.0_5 subversion <tap>.

The way I understand this I should:

  1. Create an empty repository for my versioned formulas
  2. Add the repository as a tap and initialize it
  3. Extract the versioned formula
  4. Commit and push the formula?

I created an empty repository, then:

$ brew tap rjollos/homebrew-versioned
Cloning into '/usr/local/Homebrew/Library/Taps/rjollos/homebrew-versioned'...
warning: You appear to have cloned an empty repository.
Tapped (16 files, 22.2KB).
$ brew tap-new rjollos/homebrew-versioned
==> Created rjollos/versioned
/usr/local/Homebrew/Library/Taps/rjollos/homebrew-versioned
$ brew extract --version '1.13.0_5' subversion rjollos/homebrew-versioned
==> Searching repository history
Warning: Calling 'devel' blocks in formulae is deprecated! Use 'head' blocks or @-versioned formulae instead.
Please report this issue to the homebrew/core tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
  /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/subversion.rb:16

Warning: Calling 'devel' blocks ... (repeats about a dozen times)

Error: subversion: undefined method `sha1' for #<SoftwareSpec:0x00007fceaf144490>

I think I'm doing several things wrong, but mainly I'm unsure why brew extract doesn't work. Also, is there a better way to create a new repository and populate it with the template files for a new tap?

$ brew --version
Homebrew 2.4.4-19-ge09802b
Homebrew/homebrew-core (git revision 5ee797; last commit 2020-07-07)
Homebrew/homebrew-cask (git revision 837ac; last commit 2020-07-08)
like image 704
RjOllos Avatar asked Jul 07 '20 23:07

RjOllos


People also ask

How do I install a specific version of a package with brew?

If you can't use the web interface, you can clone the repo and do it locally: use git log master -- Formula/PACKAGENAME. rb to get the commit history, check out the correct commit, and then run brew install Formula/PACKAGENAME. rb to install it. I think you need brew unlink before brew install of other version.

What does brew extract do?

Extract brewing is the form of brewing used by most new brewers. Extract brewing involves the use of concentrated Malt Extract in the brewing process. The use of malt extract lets the brewer skip the mashing process, and move directly to the boil and fermentation steps.

What is brew unlink?

brew unlink <formula> This can be useful if a package can't build against the version of something you have linked into Homebrew's prefix. And of course, you can simply brew link <formula> again afterwards!

How do I find my Swiftlint version?

Command Line USAGE: swiftlint <subcommand> OPTIONS: --version Show the version.


Video Answer


1 Answers

Taps can be created locally without actual github repository. Here is general example:

TAP=...     # <org>/<repo>, for example "my-org/homebrew-old"
MODULE=...  # name of module you want to install, e.g. "hugo"
VERS=...    # version of $MODULE you want to install, e.g., "0.80.0"
brew tap-new $TAP
brew extract --version $VERS $MODULE $TAP
brew install $TAP/$MODULE@$VERS
like image 50
fav Avatar answered Sep 16 '22 16:09

fav