MacPort導入メモ

パッケージ管理用にMacPortを導入した。

http://www.macports.org/

インストールは簡単で'.pkg'を展開するだけ。
(事前にXCode + X11を導入しておく必要有)

PASSを'~/.bashrc'に追加

$ export PASS=/opt/local/bin:$PATH
$ export MANPATH=/opt/local/share/man:$MANPATH

あとは適当に

# port -d selfupdate ----MacPort本体のupdate

# port -d sync ----リスト更新

# port search **** ----リスト内検索(****は検索語)

# port install **** +** ----インストール(**=variants)

# port variants **** ----variants一覧

# port upgrade **** ----アップグレード

# port uninstall **** ----アンインストール

# port deactivate **** ----無効化

# port activate **** ---- 有効化

# port installed ----インストール済一覧

# port outdated ----アップグレード可能一覧

# port upgrade installed ----すべてアップグレード

(****=パッケージ名)

として使う。

簡単に終了、、、かと思いきや、

$ sudo port install pTeX +utf8

に対して

Error: Checksum (sha1) mismatch for util-macros-1.1.5.tar.bz2
Error: Target org.macports.checksum returned: Unable to verify file checksums
Error: The following dependencies failed to build: openmotif Xft2 xorg-xproto xorg-util-macros xrender render t1lib libtool texi2html texinfo gettext
Error: Status 1 encountered during processing.

なんてエラーを吐く。=>思うところがあったので、面倒だがOS入れ直し。

しかし、OSX(10.5)をクリーンインストールし直したシステムでも再現。

md5やらの一種らしいsha1チェックサムが違ってるみたい。

二度やって再現するってことはパケットが化けたとも考えにくいし、、、

MacPortのサポートに以下の記述を発見した。

I get Error: checksum (md5/sha1/rmd160) mismatch for port. What can I do about it?

MacPorts computes checksums of downloaded files to ensure they aren't corrupted and haven't been tampered with. Each portfile lists the checksums for the files that the port will download (using md5, sha1 or rmb160). If the computed checksum of the downloaded file doesn't match the one listed in the portfile, that means the file you downloaded is not the one the port designer used when creating the port, and so MacPorts stops the installation.

The first thing you should do if you get a checksum error is update your ports with sudo port sync — can you install the port now? If so, it means somebody else encountered the same checksum mismatch before and already fixed it.

If updating doesn't help, then you should attempt to discover why there is a checksum mismatch. There are several possible reasons:

The file is corrupt. If it was corrupted by the transfer, download it again (port clean --dist and port install ). If it is corrupted on the server, there is not much you can do about it. Open a bug in Trac and assign it to the port's maintainer. As for solving the problem: if there are other mirrors, try one of them. You can also ask if someone has a complete file they can send you on the MacPorts users' mailing list.
The developer has performed a "stealth upgrade". Sometimes upstream developers make "stealth upgrades" in which they change the contents of their distribution archive but not its version number, without informing MacPorts of this change. Perhaps the developer has repackaged the distribution with a different archiving program, or has fixed typos in the included documentation or made other presumably minor changes that did not warrant a regular release. This practice is not recommended because of the obvious difficulties it presents to MacPorts and other port systems that compute package checksums. Attempt to get confirmation from the developer of the software that this has occurred. If the developer cannot be reached, attempt to determine yourself whether a stealth upgrade has happened. Search the Internet and try to locate the older version of the archive that matches the checksum in the portfile. Also download the version currently available on the developer's site, extract both, and compare the contents (for example with diff -r -u ). If the changes look minor and benign, or there are no changes at all, then it is safe for you to update the checksum in the portfile, and the port maintainer should be informed of this so that they can make the change official. If you cannot determine whether a stealth upgrade has taken place, ask for help on the users' mailing list.
The file has been tampered with. It is perhaps somewhat unlikely yet theoretically possible (and it has happened a few times in practice) that the archive being distributed by the developer (or by a mirror) has been genuinely compromised. If a hacker was able to manipulate the developer's (or the mirror's) server, the hacker could have uploaded a revised archive containing malware (a virus, a trojan horse, a spam-sending platform, etc.) of the hacker's choosing, and you would certainly not want to install such software. You must attempt to determine, as above, whether this has occurred by contacting the developer, or by locating an older version of the archive and comparing them. You can also contact the port maintainer or the users' mailing list.

なので

$ sudo port clean --dist xorg-util-macros

を実行。さらに

$ sudo port install xorg-util-macros

とするも、、、

      • > Verifying checksum(s) for xorg-util-macros

Error: Target org.macports.checksum returned: Could not open file: /opt/local/var/macports/distfiles/xorg-util-macros/util-macros-1.1.5.tar.bz2
Error: Status 1 encountered during processing.

となる。
ん?/opt/local/var/macports/distfiles/xorg-util-macros/util-macros-1.1.5.tar.bz2のアクセス権が変、、なのか?

見に行ってみるが、どうも/opt/local/var/macports/distfiles迄は確認できるも、それ以下の階層が見当たらない。

cleanして無くなるのは解るが、そのあとでinstallしても取って来てくれんのか?謎だ、、、

なので、ココは強制的にutil-macros-1.1.5.tar.bz2を落として、指定された場所にぶち込む作戦で行ってみようと思う。

Google先生、util-macros-1.1.5.tar.bz2は何処ですか?っと。」

こいつはX関係のファイルらしいが、何故か検索のトップに来たのは山形Univだった。まぁ、バージョンさえ合ってればいいべ。

$ mkdir -p /opt/local/var/macports/distfiles/xorg-util-macros
$ mv ~/util-macros-1.1.5.tar.bz2 /opt/local/var/macports/distfiles/xorg-util-macros

んで、

$ sudo port install xorg-util-macros

を実行、、、

      • > Verifying checksum(s) for xorg-util-macros
      • > Extracting xorg-util-macros
      • > Configuring xorg-util-macros
      • > Building xorg-util-macros with target all
      • > Staging xorg-util-macros into destroot
      • > Installing xorg-util-macros 1.1.5_0
      • > Activating xorg-util-macros 1.1.5_0
      • > Cleaning xorg-util-macros

$

うおっ!通ったよ!!やった!

では、本題のpTeXインストールを試みる。

$ sudo port install pTeX +utf8

お、お、お。行きそうだ〜とか思ってたら止まった。

今度は

Error: Checksum (md5) mismatch for xproto-7.0.11.tar.bz2
Error: Checksum (sha1) mismatch for xproto-7.0.11.tar.bz2
Error: Checksum (rmd160) mismatch for xproto-7.0.11.tar.bz2
Error: Target org.macports.checksum returned: Unable to verify file checksums
Error: The following dependencies failed to build: openmotif Xft2 xorg-xproto xrender render t1lib libtool texi2html texinfo gettext
Error: Status 1 encountered during processing.

だそうで、悔しいのでコイツもぶち込む。

$ mv ~/xproto-7.0.11.tar.bz2 /opt/local/var/macports/distfiles/xorg-xproto/
$ sudo port install xorg-xproto

として実行してみるも、あっさり通る。

ん〜、MacPortのサーバは何かに憑かれているのか?

再々度実行。

$ sudo port install pTeX +utf8

で、また止まる。

今度はlibXft-2.1.12.tar.bz2のチェックサムらしい。

ぐむむ、、ココまでくると根本的な何かに問題がある気が。

チェックする側が壊れてるか、ホントにサーバの中身のメンテナンスがなってね〜かのどっちかですね。
おそらくは前者でしょう。

まぁ、ココまで来たら最後までコツコツやりますよ、、、


と、こんな作業を繰り返し、やっとこさ完了。
ホントに動くのか心配でなりませんが、、、



導入済リスト

$ sudo port install pTeX +utf8
$ sudo port install gnuplot