使用Brew Extract安装公式的早期版本

时间:2020-07-07 23:23:23

标签: homebrew

由于problem使用Subversion 1.13 Brew公式,因此我安装了该公式的旧版本:

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

发出警告:

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

建议与this tip相同。

现在,我想使用brew extract subversion而不是不推荐使用的提交URL正确地执行此操作。我想在某些计算机上安装Subversion 1.13_5,但是Subversion 1.14是最新的公式。

我需要执行以下操作:brew extract --version 1.13.0_5 subversion <tap>

我应该理解的方式:

  1. 为我的版本化公式创建一个空的存储库
  2. 将存储库添加为水龙头并对其进行初始化
  3. 提取版本化的公式
  4. 提交并推送公式?

我创建了一个empty repository,然后:

$ 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>

我认为我做错了几件事,但主要是我不确定brew extract为什么行不通。另外,是否有更好的方法来创建新的存储库并用模板文件填充新的存储库?

$ 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)

3 个答案:

答案 0 :(得分:9)

可以在没有实际github存储库的情况下在本地创建提示。这是一般示例:

brew tap-new <org>/<repo>
brew extract --version <version you want to install> <module name you would use> <org>/<repo>
brew install <org>/<repo>/<module name>@<version>

答案 1 :(得分:3)

仍不确定这是创建新水龙头的最佳方法。我在GitHub上创建了homebrew-repo,然后添加了水龙头,然后使用tap-new初始化了水龙头。

$ TAP=rjollos/homebrew-repo
$ TAP_PATH=$(brew --repository)/Library/Taps/$TAP

$ brew tap $TAP
==> Tapping rjollos/repo
Cloning into '/usr/local/Homebrew/Library/Taps/rjollos/homebrew-repo'...
warning: You appear to have cloned an empty repository.
Tapped (16 files, 22.2KB).

$ brew tap-new $TAP
==> Created rjollos/repo
/usr/local/Homebrew/Library/Taps/rjollos/homebrew-repo

$ cd $TAP_PATH

$ git add .

$ git commit -m "Initialized with template files"
[master (root-commit) c7c4bed] Initialized with template files
 2 files changed, 29 insertions(+)
 create mode 100644 .github/workflows/main.yml
 create mode 100644 README.md

$ git remote -v
origin  https://github.com/rjollos/homebrew-repo (fetch)
origin  https://github.com/rjollos/homebrew-repo (push)

提取版本化的公式:

$ brew extract --version 1.13.0 subversion $TAP
==> Searching repository history
==> Writing formula for subversion from revision dab5452 to:
/usr/local/Homebrew/Library/Taps/rjollos/homebrew-repo/Formula/subversion@1.13.0.rb

添加公式:

$ cd $TAP_PATH
$ git add Formula
$ git commit -m "Add Subversion 1.13 formula"
 1 file changed, 203 insertions(+)
 create mode 100644 Formula/subversion@1.13.0.rb
$ git push
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 8 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (10/10), 3.99 KiB | 2.00 MiB/s, done.
Total 10 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/rjollos/homebrew-repo
 * [new branch]      master -> master

答案 2 :(得分:1)

我尝试过brew install <url>的方法,对我来说似乎运作良好?

安装日志:

$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/0c3d786402ad7d9dd5eb6907e3ed3f2525a0472d/Formula/subversion.rb
Warning: Calling Installation of subversion from a GitHub commit URL is deprecated! Use 'brew extract subversion' to stable tap on GitHub instead.
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/subversion-1.13.0_5.mojave.bottle.tar.gz
Already downloaded: /Users/rchen/Library/Caches/Homebrew/downloads/6c15ae92fb6a09985f1679367588188829b69a4dbc53bb324597fb9fdf588d9e--subversion-1.13.0_5.mojave.bottle.tar.gz
Warning: subversion 1.14.0_2 is available and more recent than version 1.13.0_5.
==> Pouring subversion-1.13.0_5.mojave.bottle.tar.gz
==> Caveats
svntools have been installed to:
  /usr/local/opt/subversion/libexec

The perl bindings are located in various subdirectories of:
  /usr/local/opt/subversion/lib/perl5

You may need to link the Java bindings into the Java Extensions folder:
  sudo mkdir -p /Library/Java/Extensions
  sudo ln -s /usr/local/lib/libsvnjavahl-1.dylib /Library/Java/Extensions/libsvnjavahl-1.dylib

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
?  /usr/local/Cellar/subversion/1.13.0_5: 234 files, 30.3MB
Removing: /Users/rchen/Library/Caches/Homebrew/subversion--1.13.0_5.mojave.bottle.tar.gz... (8.6MB)

版本检查

$ svn --version
svn, version 1.13.0 (r1867053)
   compiled Apr 17 2020, 12:01:27 on x86_64-apple-darwin18.7.0

Copyright (C) 2019 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository access (RA) modules are available:

* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - using serf 1.3.9 (compiled with 1.3.9)
  - handles 'http' scheme
  - handles 'https' scheme

The following authentication credential caches are available:

* Mac OS X Keychain