2014年10月15日水曜日

FreeBSD 9.2とruby20

FreeBSD 9.2でパッケージをアップデートしようとしたら、以下のようなメッセージが出ました。
===>  Installing for ruby-2.0.0.576_1,1
===>  Checking if ruby already installed
===>   An older version of ruby is already installed (ruby-1.9.3.547_3,1)
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of ruby
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
パッケージの更新情報を確認すると、以下のような作業が必要なようです。
# pkg updating
...
20141008:
  AFFECTS: users of lang/ruby19
  AUTHOR: swills@FreeBSD.org

  The default ruby version has been updated from 1.9 to 2.0.

  If you compile your own ports you may keep 1.9 as the default version by
  adding the following lines to your /etc/make.conf file:

  #
  # Keep ruby 1.9 as default version
  #
  DEFAULT_VERSIONS+=ruby=1.9

  If you wish to update to the new default version, you need to first stop any
  software that uses ruby. Then, you will need to follow these steps, depending
  upon how you manage your system.

  If you use pkgng, simply upgrade:
  # pkg upgrade

  If you use portmaster, install new ruby, then rebuild all ports that depend
  on ruby:
  # portmaster -o lang/ruby20 lang/ruby19
  # portmaster -R -r ruby-2.0

  If you use portupgrade, install new ruby, then rebuild all ports that depend
  on ruby:

  # pkg delete -f ruby ruby-iconv portupgrade
  # make -C /usr/ports/ports-mgmt/portupgrade install clean
  # pkg set -o lang/ruby19:lang/ruby20
  # portupgrade -x ruby-2.0.\* -fr lang/ruby20
portupgradeを利用しているので上記の4行を実行したところ、無事にアップデートすることができました。
このとき、パッケージの依存関係を見たくなったので、 /usr/ports/ports-mgmt/porttreeをインストールして利用しました。