Daily Ports+ #9: Install v.s. Upgrade2008年02月14日 20時34分25秒

If you give "-n" option to ports+, you can see the exact commands to be executed.

Indeed, installing a new package is relatively simple.


# ports+ -n /usr/ports/misc/shc
(cd /usr/ports/misc/shc && MAKEFLAGS="" MFLAGS="" lockf /var/db/pkg/shc-3.8.6+lo
ck make  install && touch /var/db/pkg/shc-3.8.6/ports++install

Ports+ simply uses the FreeBSD port system to build and install. On the other hand, Ports+ will start building required packages as many as -j option where the Ports builds one by one.

Upgrading is rather more difficult. The Ports system doesn't have a way.


# ports+ -n /var/db/pkg/xterm-229_1
(cd /usr/ports/x11/xterm &&  echo xterm-229_1 to xterm-232 && MAKEFLAGS="" MFLAG
S="" lockf /var/db/pkg/xterm-232+lock make  build && ( [ -f /usr/local/ports+/xt
erm-229_1.tar ] || (cd /usr/local/ports+/ && pkg_create -b xterm-229_1.tar)) &&
lockf /var/db/pkg/ports++pkg+lock sh -c '(MAKEFLAGS="" MFLAGS="" lockf /var/db/p
kg/xterm-232+lock make  deinstall reinstall && find /var/db/pkg/ -name "+CONTENT
S" | xargs grep -l xterm-229_1 | xargs sed -i.ports+ -e "/pkgdep/s^xterm-229_1^x
term-232^g") || pkg_add -f /usr/local/ports+/xterm-229_1.tar'; ls -d /var/db/pkg
/xterm-232 >gt;/dev/null 2>gt;&1  && touch /var/db/pkg/xterm-232/ports++upgrade)

Ports+ first build a package and see if it is successful. If so, it will make a backup and install the new one. These conditions will not be too complicated in other languages. But using "Make" and shell script in it, all conditions need to be expressed with "&&" and "||" in a single line fashion. That makes hard to read.

コメント

コメントをどうぞ

※メールアドレスとURLの入力は必須ではありません。 入力されたメールアドレスは記事に反映されず、ブログの管理者のみが参照できます。

※なお、送られたコメントはブログの管理者が確認するまで公開されません。

名前:
メールアドレス:
URL:
コメント:

トラックバック

このエントリのトラックバックURL: http://uyota.asablo.jp/blog/2008/02/14/2627637/tb

※なお、送られたトラックバックはブログの管理者が確認するまで公開されません。