FreeBSD - メンテナンス・トラブルシュート - Python - python3.6 → python3.7

 クラウディア
1. 概要
2. /etc/make.conf 編集
3. アップグレード

1. 概要

 これを書いているのが、2019年12月19日です。  何日か前から、

$ pkg version -vl "<"
python-3.6_3,2                     <   needs updating (index has 3.7_3,2)
 てなことになっておる。  まだ、「python27」を使用しているモジュールもあるというのに・・・。

2. /etc/make.conf 編集

 「python2.7」から「python3.6」にアップグレードしたときの記憶をたどりながら・・・。

vi /etc/make.conf

DEFAULT_VERSIONS+=python=3.6 python3=3.6
 を書き換えます。

#DEFAULT_VERSIONS+=python=3.6 python3=3.6
DEFAULT_VERSIONS+=python=3.7 python3=3.7

3. アップグレード


portupgrade -f python36 -o lang/python37
pkg set -o lang/python36:lang/python37
 2つ目のコマンドは

Change origin from lang/python36 to lang/python37 for python36-3.6.9_3? [y/N]: y
 ときいてきますので、y Enter で応えます。

portupgrade -rR python
 これが

====> Compressing man pages (compress-man)
===>  Installing for python3-3_3
===>  Checking if python3 is already installed
===>   python3-3_3 is already installed
      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 python3
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/lang/python3
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/python
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade20191219-40060-1u4qdkh env UPGRADE_TOOL=portupgrade UPGRADE_PORT=python-3.6_3,2 UPGRADE_PORT_VER=3.6_3,2 make
** Fix the problem and try again.
** Listing the failed packages (-:ignored / *:skipped / !:failed)
        ! lang/python (python-3.6_3,2)  (unknown build error)
 てなことになりました。  うむむ?  「Python」の「ports」を見てみます。

$ ls -d /usr/ports/lang/python*
/usr/ports/lang/python                 /usr/ports/lang/python-mode.el  /usr/ports/lang/python35
/usr/ports/lang/python-doc-html        /usr/ports/lang/python-tools    /usr/ports/lang/python36
/usr/ports/lang/python-doc-pdf-a4      /usr/ports/lang/python2         /usr/ports/lang/python37
/usr/ports/lang/python-doc-pdf-letter  /usr/ports/lang/python27        /usr/ports/lang/python38
/usr/ports/lang/python-doc-text        /usr/ports/lang/python3
 「/usr/ports/lang/python3」を削除すればいいんかなぁ?

vi /etc/make.conf
 で、いったん

DEFAULT_VERSIONS+=python=3.7 pythonr3=3.7
 をコメントアウトして

cd /usr/ports/lang/python3
make deinstall clean

vi /etc/make.conf
 で、コメントアウトしたものを復活させて

cd /usr/ports/lang/python37
make deinstall clean
make
make install
 これでインストールできたので、安心かな・・・と思ったら・・・。

$ pkg version -vl "<"
python-3.6_3,2                     <   needs updating (index has 3.7_3,2)
 気を取り直して、もう一回。

portupgrade -rR python
 今度は、エラーになりませんでした。  今度は、データベースもうまく更新されたと見えて、「pkg version -vl "<"」には、何も表示されなくなりました。  でめたし、でめたし(しんのすけ風)。  後は、他のパッケージのアップグレードの際、競合や衝突が発生する都度、対処していくしかないかな。
ハイスピードプラン