[memo] homebrew で 過去のバージョンを利用する際の一例 ( brew upgrade の際に、vim7.4.1952.el_capitan が perl 5.24.0 を連れ立ってインストールしたので過去のコミットに巻き戻してなんとかする)

homebrew で 過去のバージョンを利用する際の一例。

brew upgrade の際に、vim-7.4.1952.el_capitan が perl 5.24.0 を連れ立ってインストールしたので過去のコミットに巻き戻してなんとかした。

かなり力技。
git log をチェックして、関係性をチェックしてから よさげなところを見つけて git checkout
何かむなしい。homebrew と言うより git の話になるか

追記:2016/06/27 時点ではこの問題は起きない
commit bc6d00a9347070c2f9d063cadd6ffc3096afbf2b かな
日付的に違う理由だったのか

perl は plenv で管理しているのでこの perl は余分かなぁ。
homebrew で管理しているのだから perl も homebrew で……。(-Mlocal::lib も忘れるし)
[zunermuka ~]$ vim
dyld: Library not loaded: /usr/local/opt/perl/lib/perl5/5.24.0/darwin-thread-multi-2level/CORE/libperl.dylib
  Referenced from: /usr/local/bin/vim
  Reason: image not found
Trace/BPT trap: 5

brew link を実行していないのでエラーになる。

とりあえずこの時点での、二択。

1.brew install vim --with-custom-perl
2.vim.rb を過去のコミットに戻して、brew uninstall vim;brew install vim

https://rt.perl.org/Public/Bug/Display.html?id=128093
も気になるし、消極的に 2.過去のコミットに戻すで一時凌ぐ。

vim-7.4.1941.el_capitan も同様だったため、vim-7.4.1910.el_capitan まで戻す。

[zunermuka ~]$ cd /usr/local/Library/Formula/
[zunermuka /usr/local/Library/Formula]$ git log vim.rb
[zunermuka /usr/local/Library/Formula]$ git checkout 6ff8dc859e8544e68d25dc39bf5c69b89a308fc1 vim.rb
[zunermuka /usr/local/Library/Formula]$ brew install vim
==> Downloading https://github.com/vim/vim/archive/v7.4.1910.tar.gz
==> Downloading from https://codeload.github.com/vim/vim/tar.gz/v7.4.1910
######################################################################## 100.0%
==> ./configure --prefix=/usr/local --mandir=/usr/local/Cellar/vim/7.4.1910/shar
==> make
==> make install prefix=/usr/local/Cellar/vim/7.4.1910 STRIP=true
🍺  /usr/local/Cellar/vim/7.4.1910: 1,689 files, 22.6M, built in 2 minutes 37 seconds]

試行錯誤

[zunermuka ~]$ cd /usr/local/Library/Formula/
[zunermuka /usr/local/Library/Formula]$ git log vim.rb
[zunermuka /usr/local/Library/Formula]$ git checkout fb9414d38439b673e16bb4fd43ace3fc574a4fa3 vim.rb
[zunermuka /usr/local/Library/Formula]$ brew install vim
==> Installing dependencies for vim: perl
==> Installing vim dependency: perl
==> Downloading https://homebrew.bintray.com/bottles/perl-5.24.0_1.el_capitan.bo
######################################################################## 100.0%
==> Pouring perl-5.24.0_1.el_capitan.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/ptar
Target /usr/local/bin/ptar
already exists. You may want to remove it:
  rm '/usr/local/bin/ptar'

To force the link and overwrite all conflicting files:
  brew link --overwrite perl

To list all files that would be deleted:
  brew link --overwrite --dry-run perl

Possible conflicting files are:
/usr/local/bin/ptar
/usr/local/bin/ptardiff
/usr/local/bin/shasum
==> Caveats
By default non-brewed cpan modules are installed to the Cellar. If you wish
for your modules to persist across updates we recommend using `local::lib`.

You can set that up like this:
  PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
  echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"' >> ~/.bash_profile
==> Summary
🍺  /usr/local/Cellar/perl/5.24.0_1: 2,291 files, 55.1M
==> Installing vim
==> Downloading https://homebrew.bintray.com/bottles/vim-7.4.1952.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring vim-7.4.1952.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/vim/7.4.1952: 1,691 files, 22.6M
[zunermuka /usr/local/Library/Formula]$ vim
dyld: Library not loaded: /usr/local/opt/perl/lib/perl5/5.24.0/darwin-thread-multi-2level/CORE/libperl.dylib
  Referenced from: /usr/local/bin/vim
  Reason: image not found
Trace/BPT trap: 5
[zunermuka /usr/local/Library/Formula]$ git log vim.rb
[zunermuka /usr/local/Library/Formula]$ git checkout eb5d9623bb63d38ba679e3a8ec66be8f29170dbd vim.rb
[zunermuka /usr/local/Library/Formula]$ brew install vim
==> Installing dependencies for vim: perl
==> Installing vim dependency: perl
==> Downloading https://homebrew.bintray.com/bottles/perl-5.24.0_1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring perl-5.24.0_1.el_capitan.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/ptar
Target /usr/local/bin/ptar
already exists. You may want to remove it:
  rm '/usr/local/bin/ptar'

To force the link and overwrite all conflicting files:
  brew link --overwrite perl

To list all files that would be deleted:
  brew link --overwrite --dry-run perl

Possible conflicting files are:
/usr/local/bin/ptar
/usr/local/bin/ptardiff
/usr/local/bin/shasum
==> Caveats
By default non-brewed cpan modules are installed to the Cellar. If you wish
for your modules to persist across updates we recommend using `local::lib`.

You can set that up like this:
  PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
  echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"' >> ~/.bash_profile
==> Summary
🍺  /usr/local/Cellar/perl/5.24.0_1: 2,291 files, 55.1M
==> Installing vim
==> Downloading https://homebrew.bintray.com/bottles/vim-7.4.1941.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring vim-7.4.1941.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/vim/7.4.1941: 1,689 files, 22.6M
[zunermuka ~]$ brew uninstall vim
Uninstalling /usr/local/Cellar/vim/7.4.1941... (1,689 files, 22.6M)

力技対応(考え方がわかったけれど次回からはしないかな)

[zunermuka /usr/local/Library/Formula]$ git log vim.rb
[zunermuka /usr/local/Library/Formula]$ git checkout 6ff8dc859e8544e68d25dc39bf5c69b89a308fc1 vim.rb
[zunermuka /usr/local/Library/Formula]$ brew install vim
==> Downloading https://github.com/vim/vim/archive/v7.4.1910.tar.gz
==> Downloading from https://codeload.github.com/vim/vim/tar.gz/v7.4.1910
######################################################################## 100.0%
==> ./configure --prefix=/usr/local --mandir=/usr/local/Cellar/vim/7.4.1910/shar
==> make
==> make install prefix=/usr/local/Cellar/vim/7.4.1910 STRIP=true
🍺  /usr/local/Cellar/vim/7.4.1910: 1,689 files, 22.6M, built in 2 minutes 37 seconds]

コメント

このブログの人気の投稿

[memo] LibreOffice バージョン: 5.2.6.2 Calc でエラーがでた BASIC を読み込む際の エラー:一般的なエラー.一般的な I/O エラー。

Amazonプライム会員の無料体験から継続しない手続きをする際「自動移行しない」が表示されないので悩んだ。(結果として自動更新をキャンセルする事ができました)

[memo] go get でインストールしたが利用しなくなったパッケージを削除する