2
2

More than 5 years have passed since last update.

FreeBSDのpkgコマンドで未インストールのパッケージの一行情報を知る方法

Posted at

FreeBSD-10には、pkgという新しいパッケージ管理システムが導入されています。(Debianのaptとかの類です。)

インストールされていないパッケージがどういうものか一行レベルで良いので知りたいケースがあります。
例えば、ドキュメント作成ツールのsphinxをインストールしようとしますが、pkg searchすると、以下のようにpy27-sphinxとsphinx3があり、どちらがドキュメント作成ツールなのかわかりません。

eria@eria-thinkpad:~ % pkg search sphinx
libsphinxclient-2.0.9
pecl-sphinx-1.3.0
pocketsphinx-0.8
py27-sphinx-1.2.2
py27-sphinxcontrib-adadomain-0.1_2
py27-sphinxcontrib-bitbucket-1.0
py27-sphinxcontrib-httpdomain-1.2.1
sphinx3-0.8_1
sphinxbase-0.8
sphinxsearch-2.1.8
sphinxsearch-devel-2.2.1,1

未インストールのpkgの一行情報を知りたい場合は、「pkg rquery "%c" パッケージ名」を実行します。

eria@eria-thinkpad:~ % pkg rquery "%c" py27-sphinx
Python documentation generator

eria@eria-thinkpad:~ % pkg rquery "%c" sphinx3
Speech recognition system

これでpy27-sphinxのほうがドキュメント作成ツールだということがわかりました。
pkg rqueryのあとの"%c"は「query pattern」というものです。
%cはComment of the matched packageです。
これを要するにprintfの引数のような感覚で指定すればよいわけです。

pkg rquery "%c:%v" sphinx3
Speech recognition system:0.8_1

query patternについては他にも色々指定ができます。
man pkg-rquery でどうぞ。(pkgとrqueryの間のハイフンを忘れずに!)

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2