由于子版本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.
这个建议和这个建议是一样的。
现在,我希望使用brew extract subversion
而不是使用不推荐使用的提交URL来正确地执行此操作。我想在一些计算机上安装Subversion 1.13_5,但Subversion 1.14是最新的公式。
我需要做这样的事情:brew extract --version 1.13.0_5 subversion <tap>
。
我应该这样理解:
- 为我的版本化公式创建一个空存储库
- 将存储库添加为tap并对其进行初始化
- 提取版本化的公式
- 提交并推送公式
我创建了一个空的存储库,然后:
$ 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
不起作用。此外,有没有更好的方法来创建一个新的存储库,并用新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)
Tap可以在本地创建,而无需实际的github存储库。下面是一个一般的例子:
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
仍然不确定这是创建新抽头的最佳方式。我在GitHub上创建了homebrew-repo
,然后添加了tap,然后使用tap-new
初始化了tap。
$ 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
我尝试了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