Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brew file initが失敗する #26

Closed
takuhito-h opened this issue Nov 7, 2015 · 7 comments
Closed

brew file initが失敗する #26

takuhito-h opened this issue Nov 7, 2015 · 7 comments

Comments

@takuhito-h
Copy link

初めまして、brew fileを使ってcaskのパッケージ管理をさせてもらおうと思ったんですが、brew file initで以下のようなエラーが出て止まってしまいます。

Traceback (most recent call last):
  File "/usr/local/bin/brew-file", line 2452, in <module>
    main()
  File "/usr/local/bin/brew-file", line 2449, in main
    b.execute()
  File "/usr/local/bin/brew-file", line 2132, in execute
    self.initialize()
  File "/usr/local/bin/brew-file", line 1343, in initialize
    self.initialize_write()
  File "/usr/local/bin/brew-file", line 1346, in initialize_write
    self.write(check_opt=check_opt)
  File "/usr/local/bin/brew-file", line 742, in write
    self.brewinfo.write(check_opt=check_opt)
  File "/usr/local/bin/brew-file", line 517, in write
    pack = self.packout(p) + self.get_options(p)
  File "/usr/local/bin/brew-file", line 398, in get_options
    if v[0] == "stable":
IndexError: list index out of range

Pythonのバージョンが悪いのかと思い、2系の最新にしてみましたが変わりません。
brew fileのバージョンはv3.7.0 6/Nov/2015、OSはEl Capitan、Pythonは2.7.10になっています。
何か助言いただければ嬉しいです。よろしくお願いします。

@rcmdnk
Copy link
Owner

rcmdnk commented Nov 7, 2015

どうも予期しないinfoのアウトプットをするパッケージがあるようですね。

$ brew file init -V 2

を実行してみて結果を教えてもらえますか?
どのパッケージで止まったかわかると思います。

@takuhito-h
Copy link
Author

迅速な回答ありがとうございます!

pkg-configというパッケージで止まったみたいですね。

You are using Brewfile of [email protected]:takuhito-h/brewfile.
Do you want to overwrite it? [y/n]: y

############################################################
# Initialize /usr/local/Library/takuhito-h_brewfile/Brewfile
############################################################


# tap repositories and their packages

## caskroom/cask
tap caskroom/cask
brew brew-cask
cask 1password
cask adobe-creative-cloud
cask adobe-illustrator-cc

...

brew pandoc
brew pango
brew peco
brew phantomjs
brew pkg-config
Traceback (most recent call last):
  File "/usr/local/bin/brew-file", line 2452, in <module>
    main()
  File "/usr/local/bin/brew-file", line 2449, in main
    b.execute()
  File "/usr/local/bin/brew-file", line 2132, in execute
    self.initialize()
  File "/usr/local/bin/brew-file", line 1343, in initialize
    self.initialize_write()
  File "/usr/local/bin/brew-file", line 1346, in initialize_write
    self.write(check_opt=check_opt)
  File "/usr/local/bin/brew-file", line 742, in write
    self.brewinfo.write(check_opt=check_opt)
  File "/usr/local/bin/brew-file", line 517, in write
    pack = self.packout(p) + self.get_options(p)
  File "/usr/local/bin/brew-file", line 398, in get_options
    if v[0] == "stable":
IndexError: list index out of range

ちなみに以下にbrew info pkg-configの内容を記載しておきますー。

↪ brew info pkg-config
pkg-config: stable 0.29 (bottled)
Manage compile and link flags for libraries
https://wiki.freedesktop.org/www/Software/pkg-config/
/usr/local/Cellar/pkg-config/0.28 (10 files, 604K)
  Poured from bottle
/usr/local/Cellar/pkg-config/0.29 (10 files, 648K) *
  Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/pkg-config.rb

とりあえず自分はこのライブラリを使っている覚えがないので、一旦削除して再度試してみます。

@takuhito-h
Copy link
Author

pkg-configを削除してもエラーが出るみたいですね。
単純に数の問題でしょうか。

You are using Brewfile of [email protected]:takuhito-h/brewfile.
Do you want to overwrite it? [y/n]: y

############################################################
# Initialize /usr/local/Library/takuhito-h_brewfile/Brewfile
############################################################


# tap repositories and their packages

## caskroom/cask
tap caskroom/cask
brew brew-cask
cask 1password
cask adobe-creative-cloud
cask adobe-illustrator-cc
cask adobe-photoshop-cc
cask alfred
cask appcleaner
cask bettertouchtool
cask chromecast
cask cleanarchiver
cask coteditor
cask diskwave
cask dropbox
cask filezilla
cask firefox
cask framer-studio
cask glueprint
cask google-chrome
cask google-drive
cask insomniax
cask java
cask keyboard-cleaner
cask language-switcher
cask libreoffice
cask mou
cask principle
cask selfcontrol
cask sequel-pro
cask skype
cask sourcetree
cask spotify
cask techstoreclub-simple-comic
cask the-unarchiver
cask totalfinder
cask totalterminal
cask tunnelbear
cask vagrant
cask virtualbox
cask vlc

## caskroom/versions
tap caskroom/versions
cask google-chrome-canary
cask sublime-text3

## homebrew/dupes
tap homebrew/dupes

## homebrew/versions
tap homebrew/versions
brew maven2

## josegonzalez/php
tap josegonzalez/php
brew php56

## rcmdnk/file
tap rcmdnk/file
brew brew-file

# Other Homebrew packages
brew ansible
brew autoconf
brew automake
brew cabal-install
brew cairo
brew cask
brew casperjs --devel
brew chruby
brew clamav
brew cloog
brew cmake
brew composer
brew coreutils
brew ctags
brew czmq
brew emacs
brew fish
brew fontconfig
brew fontforge
brew freetype
brew gcc
brew gdbm
brew gettext
brew ghc
brew git
brew glib
brew gmp
brew gobject-introspection
brew harfbuzz
brew hub
brew icu4c
brew imagemagick
brew isl
brew jpeg
brew jpeg-turbo
brew libffi
brew libmpc
brew libpng
brew libsodium
brew libtiff
brew libtool
brew libxml2
brew libyaml
brew makedepend
brew mongodb
brew mpfr
brew mysql
brew nasm
brew node
brew openssl
brew pandoc
brew pango
brew peco
Traceback (most recent call last):
  File "/usr/local/bin/brew-file", line 2452, in <module>
    main()
  File "/usr/local/bin/brew-file", line 2449, in main
    b.execute()
  File "/usr/local/bin/brew-file", line 2132, in execute
    self.initialize()
  File "/usr/local/bin/brew-file", line 1343, in initialize
    self.initialize_write()
  File "/usr/local/bin/brew-file", line 1346, in initialize_write
    self.write(check_opt=check_opt)
  File "/usr/local/bin/brew-file", line 742, in write
    self.brewinfo.write(check_opt=check_opt)
  File "/usr/local/bin/brew-file", line 517, in write
    pack = self.packout(p) + self.get_options(p)
  File "/usr/local/bin/brew-file", line 398, in get_options
    if v[0] == "stable":
IndexError: list index out of range

@rcmdnk
Copy link
Owner

rcmdnk commented Nov 8, 2015

あ、これだとどこで止まったか分からないですね、すいません。
この次のものだと思うのですが、
brew lsの結果(パッケージ一覧)を教えてもらえますか?

@takuhito-h
Copy link
Author

ansible         clamav          fontforge       harfbuzz        libsodium       nasm            pstree          sbt
autoconf        cloog           freetype        hub         libtiff         node            putty           sqlite
automake        cmake           gcc         icu4c           libtool         openssl         pyenv           tidy
brew-cask       composer        gdbm            imagemagick     libxml2         pandoc          pyenv-virtualenv    tomcat
brew-file       coreutils       gettext         isl         libyaml         pango           python          unixodbc
cabal-install       ctags           ghc         jpeg            makedepend      peco            rbenv           wget
cairo           czmq            git         jpeg-turbo      maven2          php56           readline        xz
cask            emacs           glib            libffi          mongodb         play            rename          z
casperjs        fish            gmp         libmpc          mpfr            pngquant        ruby            zeromq
chruby          fontconfig      gobject-introspection   libpng          mysql           postgresql      ruby-build      zlib

pecoの次なのでphp56ですかね。
brew info php56をすると以下の結果ですね。

josegonzalez/php/php56: stable 5.6.15 (bottled), HEAD
https://php.net
Conflicts with: php53, php54, php55, php70
/usr/local/Cellar/php56/5.6.9 (500 files, 52M) *
  Poured from bottle
From: https://github.com/josegonzalez/homebrew-php/blob/master/Formula/php56.rb
==> Dependencies
Required: freetype ✔, gettext ✔, icu4c ✔, jpeg ✔, libpng ✔, libxml2 ✔, unixodbc ✔, readline ✔, openssl ✔
Optional: enchant ✘, gmp ✔
==> Options
--with-cgi
    Enable building of the CGI executable (implies --without-fpm)
--with-debug
    Compile with debugging symbols
--with-enchant
    Build with enchant support
--with-gmp
    Build with gmp support
--with-homebrew-apxs
    Build against apxs in Homebrew prefix
--with-homebrew-curl
    Include Curl support via Homebrew
--with-homebrew-libressl
    Include LibreSSL instead of OpenSSL via Homebrew
--with-homebrew-libxml2
    Include Libxml2 support via Homebrew
--with-homebrew-libxslt
    Include LibXSLT support via Homebrew
--with-imap
    Include IMAP extension
--with-libmysql
    Include (old-style) libmysql support instead of mysqlnd
--with-mssql
    Include MSSQL-DB support
--with-pdo-oci
    Include Oracle databases (requries ORACLE_HOME be set)
--with-pear
    Build with PEAR
--with-phpdbg
    Enable building of the phpdbg SAPI executable (PHP 5.4 and above)
--with-postgresql
    Build with postgresql support
--with-thread-safety
    Build with thread safety
--without-apache
    Disable building of shared Apache 2.0 Handler module
--without-bz2
    Build without bz2 support
--without-fpm
    Disable building of the fpm SAPI executable
--without-ldap
    Build without LDAP support
--without-mysql
    Remove MySQL/MariaDB support
--without-pcntl
    Build without Process Control support
--HEAD
    Install HEAD version
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php5_module    /usr/local/opt/php56/libexec/apache2/libphp5.so

The php.ini file can be found in:
    /usr/local/etc/php/5.6/php.ini

✩✩✩✩ PEAR ✩✩✩✩

If PEAR complains about permissions, 'fix' the default PEAR permissions and config:
    chmod -R ug+w /usr/local/Cellar/php56/5.6.15/lib/php
    pear config-set php_ini /usr/local/etc/php/5.6/php.ini system

✩✩✩✩ Extensions ✩✩✩✩

If you are having issues with custom extension compiling, ensure that
you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH:

      PATH="/usr/local/bin:$PATH"

PHP56 Extensions will always be compiled against this PHP. Please install them
using --without-homebrew-php to enable compiling against system PHP.

✩✩✩✩ PHP CLI ✩✩✩✩

If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc,
~/.zshrc, ~/.profile or your shell's equivalent configuration file:

      export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"

✩✩✩✩ FPM ✩✩✩✩

To launch php-fpm on startup:
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

The control script is located at /usr/local/opt/php56/sbin/php56-fpm

OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH:

  PATH="/usr/local/sbin:$PATH"

You may also need to edit the plist to use the correct "UserName".

Please note that the plist was called 'homebrew-php.josegonzalez.php56.plist' in old versions
of this formula.

To have launchd start josegonzalez/php/php56 at login:
  ln -sfv /usr/local/opt/php56/*.plist ~/Library/LaunchAgents
Then to load josegonzalez/php/php56 now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

なんか長いですね。。

@rcmdnk
Copy link
Owner

rcmdnk commented Nov 9, 2015

php56はtapしたものなので上の方で既にチェックされてて大丈夫です。

問題なのはplayで、これが今はblacklist(/usr/local/Library/Homebrew/blacklist.rb)入りしていて

$ brew info play
Play 2.3 replaces the play command with activator:
  brew install typesafe-activator

You can read more about this change at:
  https://www.playframework.com/documentation/2.3.x/Migration23
  https://www.playframework.com/documentation/2.3.x/Highlights23

と表示されます。(playのformulaも削除されているので今後新しくはインストール出来ないと思います。)
Remove play, replaced by typesafe-activator · Homebrew/homebrew@5f88f5a

ですのでplayをアンインストールしてtypesafe-activatorをインストールするのが正しい様です。
ただ、playのformulaが消えてしまっているので、
brew rm playが上手く行かない場合、以前のファイルを使って

$ brew rm https://raw.githubusercontent.com/Homebrew/homebrew/b433345662711abea9c234448f51c663754c6e11/Library/Formula/play.rb

の様にする必要があるかもしれません。
(この方法で上手くいくかどうかわかりませんが、これでもダメなら上のファイルを一旦取ってきて
/usr/local/Library/Formula/に入れてrmしてみるとか)

取り敢えずbrew-file側ではこの様な場合にこのメッセージの表示をして
リストには残す様にはしておきました。

それからpkg-configなのですが、なんらかのパッケージをインストールする際に
依存していて追加されたものだと思います。
恐らくインストールの際だけに使われるものでなくても困らないものだとは思いますが、
入れておいた方が無難だと思います。

@rcmdnk rcmdnk closed this as completed Nov 15, 2015
@takuhito-h
Copy link
Author

返事が遅くなってすみません。回答、ありがとうございます!
言われた通りにやってみましたら正常に動きました。
迅速な対応と回答ありがとうございました!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants