3. FreeBSD - メンテナンス・トラブルシュート - ruby - ruby23 から ruby24 への注意

 
3.1 概要
3.2 portupgrade をインストールする
3.3 ruby-gem

3.1 概要

 発生は、2017年12月25日のことです。  ruby が 2.3 から 2.4 へアップデートされると同時に vim のアップデートが走っていたのですが・・・。  vim の再インストールの最後の方で

install  -m 0644 /usr/ports/editors/vim/files/vimrc /usr/ports/editors/vim/work/stage/usr/local/etc/vim/vimrc.sample
====> Compressing man pages (compress-man)
** Command failed [exit code 127]: /usr/local/sbin/pkgdb -aFOQ
--->  Skipping 'editors/vim'
/usr/local/lib/ruby/site_ruby/2.3/pkgtools/pkgtools.rb:487:in `__system': Command failed [exit code 127]: /usr/local/sbin/pkgdb -aFOQ (CommandFailedError)
        from /usr/local/lib/ruby/site_ruby/2.3/pkgtools/pkgtools.rb:510:in `__sudo'
        from /usr/local/lib/ruby/site_ruby/2.3/pkgtools/pkgtools.rb:516:in `xsudo'
        from /usr/local/lib/ruby/site_ruby/2.3/pkgtools/pkgdb.rb:1062:in `autofix!'
        from /usr/local/lib/ruby/site_ruby/2.3/pkgtools/pkgdb.rb:1058:in `autofix'
        from /usr/local/sbin/portupgrade:519:in `block (2 levels) in main'
        from /usr/local/sbin/portupgrade:855:in `block in main'
        from /usr/local/lib/ruby/2.3/optparse.rb:1062:in `initialize'
        from /usr/local/sbin/portupgrade:238:in `new'
        from /usr/local/sbin/portupgrade:238:in `main'
        from /usr/local/sbin/portupgrade:2380:in `<main>'
 で止まっちゃいました。  もう一回、portupgrade を動かそうとしたら

> portupgrade -rR vim
portupgrade: コマンドが見つかりません.
 portsdb を見ようとしても

> portsdb -Fu
portsdb: コマンドが見つかりません.
 確認してみると

> ls -la /usr/local/sbin/port*
-r-xr-xr-x  2 root  wheel   12824  3月 31  2017 /usr/local/sbin/portcvsweb
-r-xr-xr-x  2 root  wheel   65076  3月 31  2017 /usr/local/sbin/portinstall
-r-xr-xr-x  1 root  wheel  113120 12月 25 08:39 /usr/local/sbin/portmaster
-r-xr-xr-x  2 root  wheel    5888  3月 31  2017 /usr/local/sbin/ports_glob
-r-xr-xr-x  1 root  wheel   17047  3月 31  2017 /usr/local/sbin/portsclean
-r-xr-xr-x  2 root  wheel    5888  3月 31  2017 /usr/local/sbin/portsdb
-r-xr-xr-x  2 root  wheel   12824  3月 31  2017 /usr/local/sbin/portsvnweb
-r-xr-xr-x  2 root  wheel   65076  3月 31  2017 /usr/local/sbin/portupgrade
-r-xr-xr-x  1 root  wheel    9825  3月 31  2017 /usr/local/sbin/portversion
 コマンドは実際にあるし

> echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
 パスも通っています。

3.2 portupgrade をインストールする

 しょうがないので
/usr/ports/ports-mgmt/portupgrade
 インストールし直してみることにしました。

> cd /usr/ports/ports-mgmt/portupgrade
> make
> make deinstall
> make install
 とりあえず、これで通常の状態に戻りました。  どうも ruby23 から ruby24 へは、他のものもアップデートが必要なようで・・・。

3.3 ruby-gem

 portsupgrade では、この辺までは面倒みてくれないようで。

> > pkg version -v | grep ruby
ruby-2.4.3,1                       =   up-to-date with index
ruby23-bdb-0.6.6_5                 ?   orphaned: databases/ruby-bdb
ruby23-gems-2.6.14                 ?   orphaned: devel/ruby-gems
ruby24-bdb-0.6.6_5                 =   up-to-date with index
rubygem-hpricot-0.8.6              =   up-to-date with index
rubygem-mustache-1.0.5             =   up-to-date with index
rubygem-rdiscount-2.2.0.1          =   up-to-date with index
rubygem-ronn-0.7.3                 =   up-to-date with index
 ruby23-bdb と ruby23-gems は

> > pkg delete ruby23-bdb
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
        ruby23-bdb-0.6.6_5

Number of packages to be removed: 1

Proceed with deinstalling packages? [y/N]: ← y を入力
[1/1] Deinstalling ruby23-bdb-0.6.6_5...
[1/1] Deleting files for ruby23-bdb-0.6.6_5: 100%
> > pkg delete pkg delete ruby23-gems
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 5 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
        ruby23-gems-2.6.14
        rubygem-hpricot-0.8.6
        rubygem-rdiscount-2.2.0.1
        rubygem-mustache-1.0.5
        rubygem-ronn-0.7.3

Number of packages to be removed: 5

The operation will free 8 MiB.

Proceed with deinstalling packages? [y/N]: ← y を入力
[1/5] Deinstalling rubygem-ronn-0.7.3...
[1/5] Deleting files for rubygem-ronn-0.7.3: 100%
[2/5] Deinstalling rubygem-hpricot-0.8.6...
[2/5] Deleting files for rubygem-hpricot-0.8.6: 100%
[3/5] Deinstalling rubygem-rdiscount-2.2.0.1...
[3/5] Deleting files for rubygem-rdiscount-2.2.0.1: 100%
[4/5] Deinstalling rubygem-mustache-1.0.5...
[4/5] Deleting files for rubygem-mustache-1.0.5: 100%
[5/5] Deinstalling ruby23-gems-2.6.14...
[5/5] Deleting files for ruby23-gems-2.6.14: 100%
 それから ports をインストール

> cd /usr/ports/databases/ruby-bdb
> make deinstall
> make install
> cd /usr/ports/devel/ruby-gems
> make
> make install
 sass も参照できなくなっていたので

> gem install sass
Fetching: rb-fsevent-0.10.2.gem (100%)
Successfully installed rb-fsevent-0.10.2
Fetching: ffi-1.9.18.gem (100%)
Building native extensions.  This could take a while...
Successfully installed ffi-1.9.18
Fetching: rb-inotify-0.9.10.gem (100%)
Successfully installed rb-inotify-0.9.10
Fetching: sass-listen-4.0.0.gem (100%)
Successfully installed sass-listen-4.0.0
Fetching: sass-3.5.4.gem (100%)
Successfully installed sass-3.5.4
Parsing documentation for rb-fsevent-0.10.2
Installing ri documentation for rb-fsevent-0.10.2
Parsing documentation for ffi-1.9.18
Installing ri documentation for ffi-1.9.18
Parsing documentation for rb-inotify-0.9.10
Installing ri documentation for rb-inotify-0.9.10
Parsing documentation for sass-listen-4.0.0
Installing ri documentation for sass-listen-4.0.0
Parsing documentation for sass-3.5.4
Installing ri documentation for sass-3.5.4
Done installing documentation for rb-fsevent, ffi, rb-inotify, sass-listen, sass after 26 seconds
5 gems installed
 今んとこ、これだけです。追加があれば追記します。