用户指南 - 6. 在命令行使用 Fink 工具
6.1 使用 Fink 工具
fink
工具使用几个后缀命令来处理源程序发行包。其中的一些需要至少有一个软件包名称,但同时可以处理多个软件包。你可以简单地应用软件包的名称(例如, gimp),或包括版本号的全名(例如 gimp-1.2.1) 或包含版本号和修订版号的名称 (例如 gimp-1.2.1-3)。在没有指明版本的情况下,Fink 会自动选择最新的版本。其它还具有不同的选项。
下面是 fink
工具的命令清单:
6.2 Global options
There are some options, which apply to all fink commands. If you
type fink --help
you get the list of options:
(as of fink-0.26.0
)
-h, --help - displays help text.
-q, --quiet - causes fink
to be less verbose, opposite of --verbose. Overrides the Verbose flag in fink.conf
.
-V, --version - display version information.
-v, --verbose - causes fink
to be more verbose, opposite of --quiet. Overrides the Verbose field in fink.conf.
-y, --yes - assume default answer for all interactive questions.
-K, --keep-root-dir - Causes fink
not to delete the
root-[name]-[version]-[revision]
directory in the Buildpath after building a package. Corresponds to the KeepRootDir field in fink.conf
.
-k, --keep-build-dir - Causes fink
not to delete the
[name]-[version]-[revision]
directory in the Buildpath after building a package. Corresponds to the KeepBuildDir field in fink.conf
.
-b, --use-binary-dist - download pre-compiled packages from the binary
distribution if available (e.g. to reduce compile
time or disk usage).
Note that this mode instructs fink to download the
version it wants if that version is available for
download; it does not cause fink to choose a version
based on its binary availability. Corresponds to the UseBinaryDist flag in fink.conf
.
--no-use-binary-dist - Don't use pre-compiled binary packages from the binary
distribution, opposite of the --use-binary-dist flag.
This is the default unless overridden by setting UseBinaryDist: true
in
the fink.conf
configuration file.
--build-as-nobody - Drop to a non-root user when performing the unpack, patch, compile, and install phases. Note that packages built with this option may be non-functional. You should use this mode for package development and debugging only.
-m, --maintainer
- (fink-0.25
and later) Perform actions useful to package maintainers: run validation on
the .info
file before building and on the .deb
after building a
package; turn certain build-time warnings into fatal errors; (fink-0.26
and later) run the test suites as specified in the field. This sets --tests and --validate to on
.
--tests[=on|off|warn] - (fink-0.26.0
and later) Causes InfoTest
fields to be activated and test suites specified
via TestScript
to be executed (see the Fink Packaging Manual). If no argument is given to this
option or if the argument is on
then failures in test suites will
be considered fatal errors during builds. If the argument is warn
then failures will be treated as warnings.
--validate[=on|off|warn] -
Causes packages to be validated during a build. If no argument is
given to this option or if the argument is on
then validation failures will be considered fatal errors during builds. If the argument is warn
then failures will be treated as warnings.
-l, --log-output
- Save a copy of the terminal output during each package building
process. By default, the file is stored in
/tmp/fink-build-log_[name]-[version]-[revision]_[date]-[time]
but
one can use the --logfile flag to specify an alternate filename.
--no-log-output - Don't save a copy of the output during package-building, opposite of the --log-output flag. This is the default.
--logfile=filename
- Save package build logs to the file filename
instead of the default
file (see the --log-output flag, which is implicitly set by the
--logfile flag). You can use percent-expansion codes to include
specific package information automatically. A complete list of percent-expanions is available in the Fink Packaging Manual; some common percent-expansions are:
- %n - package name
- %v - package version
- %r - package revision
-t, --trees=expr
- Consider only packages in trees matching expr.
The format of expr is a comma-delimited list of tree specifica-
tions. Trees listed in fink.conf
are compared against expr. Only
those which match at least one tree specification are considered by
fink
, in the order of the first specifications which they match. If
no --trees option is used, all trees listed in fink.conf
are
included in order.
A tree specification may contain a slash (/) character, in which
case it requires an exact match with a tree. Otherwise, it matches
against the first path-element of a tree. For example,
--trees=unstable/main would match only the unstable/main tree,
while --trees=unstable would match both unstable/main and
unstable/crypto.
There exist magic tree specifications which can be included in
expr:
- status - Includes packages in the dpkg status database.
- virtual - Includes virtual packages which reflect the capabili- ties of the system.
Exclusion of (or failure to include) these magic trees is currently only supported for operations which do not install or remove packages.
-T, --exclude-trees=expr Consider only packages in trees not matching expr. The syntax of expr is the same as for --trees, including the magic tree specifications. However, matching trees are here excluded rather than included. Note that trees matching both --trees and --exclude-trees are excluded.
Examples of --trees and --exclude-trees:
fink --trees=stable,virtual,status install foo
Install foo as if
fink
was using the stable tree, even if unstable is enabled infink.conf
.fink --exclude-trees=local install foo
Install the version of foo in Fink, not the locally modified version.
fink --trees=local/main list -i
List the locally modified packages which are installed.
Most of these options are self-explanatory (see here for the definition of Buildpath). They can also be set in the
Fink configuration file (fink.conf) if you want
to set them permanently and not just for that invocation of fink
.
6.3 install
install 命令用于安装软件包。它下载,配置,构建和安装你指名的软件包。它还会自动安装需要的依赖关系,但在此之前会要求你确认。例如:
fink install nedit Reading package info... Information about 131 packages read. The following additional package will be installed: lesstif Do you want to continue? [Y/n]
Use of the --use-binary-dist option with fink install
can speed the build process for complicated packages by quite a lot.
install 命令的别名包括: update, enable, activate, use (这些别名多数是因为历史原因形成的)。
6.4 remove
The remove command removes packages from the system by calling 'dpkg --remove
'. The current default implementation has a flaw: it
doesn't check dependencies itself but rather completely leaves that to
the dpkg tool (usually this poses no problem, though).
The remove command only removes the actual package files,
(excluding configuration files), but leaves
the .deb
compressed package file intact. This means that you can
re-install the package later without going through the compile process
again. If you need the disk space, you can remove the .deb
from the
/opt/sw/fink/dists
tree.
These flags can be used with the fink remove command
-h,--help - Show the options which are available. -r,--recursive - Also remove packages that depend on the package(s) to be removed (i.e. overcome the above-mentioned flaw).
Aliases: disable, deactivate, unuse, delete.
6.5 purge
The purge command purges packages from the system. This is the same as the remove command except that it removes configuration files as well.
This command takes the:
-h,--help -r,--recursive
options.
6.6 update-all
这个命令会更新所有已经安装的软件包到最新的版本。它不需要输入要更新的软件包清单,你只需要输入:
fink update-all
--use-binary-dist is also useful with this command.
6.7 list
这个命令产生一个可用的软件包,它的安装情况,最新版本和简单的描述。 如果你不使用其它参数的话,它会列出所有可用软件包。 你可以附上一个名称或 shell 模式,fink 会列出所有匹配的软件包。
第一列显示的安装状态的意义为:
未安装 i 已安装最新版本 (i) 已安装,但不是最新版本 p a virtual package provided by a package that is installed
The version column always lists the latest (highest) version known for the package, regardless of what version (if any) you have installed. To see all versions of a package available on your sys- tem, use the dumpinfo command.
fink list
命令可以使用下面这些标志:
-h,--help 显示可用的选项。 -t,--tab 按制表位输出清单,这对需要在脚本中使用输出很有用。 -i,--installed 只显示已安装的软件包。 -o,--outdated 只显示已过期的软件包。 -u,--uptodate 只显示没有过期的软件包。 -n,--notinstalled 只显示没有安装的软件包。 -s expr,--section=expr 只显示满足正则表达式的软件包。 -m expr,--maintainer=expr Show only packages with the maintainer matching the regular expression expr. -r expr,--tree=expr Show only packages in the trees matching the regular expression expr. -w=xyz,--width=xyz 设定你希望输出格式化为的宽度。xyz 可以为一个数字或者 auto。 auto 会根据终端的宽度来设置输出宽度。 默认值是 auto。
一些有用的例子:
fink list - 列出所有的软件包 fink list bash - 检查 bash 是否可用,以及它的版本 fink list --outdated - 列出过期的软件包 fink list --section=kde - 列出属于 kde 部分的软件包 fink list "gnome*" - 列出所有以 'gnome' 开头的软件包
在最后一个例子中,引号是必须的。因为这样才可以避免 shell 自己来匹配这个模式。
6.8 apropos
这个命令的作用几乎和 fink list 一样。最主要区别是 fink apropos
还会搜索软件包描述来寻找软件包。第二个区别是必需提供一个搜索字符串,而不是可选的。
fink apropos irc - 寻找在名称或描述中包含 'irc' 的软件包 fink apropos -s=kde irc - 同上,但只在 kde 部分寻找
6.9 describe
你在这个命令中给出软件包的名称,命令会输出它的描述。 注意,目前只有一小部分软件包有描述信息。
别名: desc, description, info
6.10 plugins
List the (optional) plugins available to the fink
program. Currently lists the notification mechanisms and the source-tarball
checksum algorithms.
6.11 fetch
下载指定的软件包,但不安装它。这个命令下载压缩档,即使以前已经下载过。
The following flags can be used with the fetch command:
-h,--help Show the options which are available. -i,--ignore-restrictive Do not fetch packages that are "License: Restrictive". Useful for mirrors, because some restrictive packages do not allow source mirroring. -d,--dry-run Just display information about the file(s) that would be downloaded for the package(s) to be fetched; do not actually download anything. -r,--recursive Also fetch packages that are dependencies of the package(s) to be fetched.
6.12 fetch-all
下载 所有 软件包源程序文件。和 fetch
一样,它会下载即使已经下载过的压缩档。
These flags can be used with the fink fetch-all
command:
-h,--help -i,--ignore-restrictive -d,--dry-run
6.13 fetch-missing
下载 所有 缺失的软件包源程序文件。这个命令只下载系统中没有的文件。
These flags can be used with the fink fetch-missing
command:
-h,--help -i,--ignore-restrictive -d,--dry-run
6.14 build
构建一个软件包,并不安装它。通常,缺少的源压缩档会自动被下载。这个命令的结果是产生一个可用于安装的 .deb 软件包文件,以后你可以使用 install 命令迅速地安装它。如果 .deb 文件已经存在,这个命令会什么都不干。注意,依赖关系会被安装,而不仅仅是构建。
6.15 rebuild
构建一个软件包(和 build 命令类似),但忽略和覆盖现存的 .deb 文件。如果这个软件包已经安装,新创建的 .deb 文件也会通过 dpkg
安装到系统。对软件包开发过程很有用。
The --use-binary-dist option is applicable here.
6.16 reinstall
和 install 相同,但会使用 dpkg
安装,即使它已经被安装。你可以用这个命令安装被意外删除的软件包文件或者改变了设置文件以后希望恢复回默认的设置。
6.17 configure
重新运行 fink
的配置过程。
你可以改变镜像站点和代理服务器设置等。
New in fink-0.26.0
: This command will also let you turn on the unstable trees if desired.
6.18 selfupdate
这个命令会自动更新到一个新的 Fink 版本。它检查 Fink 网站确定是否有新的版本。然后下载软件包描述并升级核心软件包,包括 fink
本身。这个命令可以升级标准的发布版本,但也可以设置你的 /opt/sw/fink/dists
目录树来使用直接 git 或 rsync 进行升级, if you select one of those options the first time this command is run。这意味着你可以访问所有软件包的最新修订版。
If the --use-binary-dist option is enabled, the list of available packages in the binary distribution is also updated.
6.19 selfupdate-rsync
Use this command to make fink selfupdate
use rsync to update its package list.
This is the recommended way to update Fink when building from source.
Note: rsync updates only update the active trees (e.g. if unstable isn't turned on in fink.conf
the list of unstable packages won't be updated.
6.20 selfupdate-git
Use this command to make fink selfupdate
use Git access to update its package list.
Rsync updating is preferred, except for developers and those people who are behind firewalls that disallow rsync.
6.21 index
重建软件包缓存。通常你不应该手工运行这个命令,因为 fink
应该能够自动检测到什么时候需要更新。
6.22 validate
这个命令会对 .info
和 .deb
文件进行一些检查。软件包维护人员在提交他们负责的软件包之前,应该运行这个命令来对它的描述和相应的构建好的软件包进行检查。
The following optional options may be used:
-h,--help - Show the options which are available. -p,--prefix - Simulate an alternate Fink basepath prefix (%p) within the files being validated. --pedantic, --no-pedantic - Control the display of nitpicky formatting warnings. --pedantic is the default.
别名: check
6.23 scanpackages
Updates the apt-get
database of debs; defaults to updating all of the trees, but may be restricted to a set of one or more trees given as arguments.
6.24 cleanup
Removes obsolete and temporary files. This can reclaim large amounts of disk space. One or more modes may be specified:
--debs - Delete .deb files (compiled binary package archives) corresponding to versions of packages that are neither described by a package description (.info) file in the currently-active trees nor presently installed. --sources,--srcs - Delete sources (tarballs, etc.) that are not used by any package description (.info) file in the currently- active trees. --buildlocks, --bl - Delete stale buildlock packages. --dpkg-status - Remove entries for packages that are not installed from the dpkg "status" database. --obsolete-packages - Attempt to uninstall all installed packges that are obsolete. (new in fink-0.26.0) --all - All of the above modes. (new in fink-0.26.0)
If no mode is specified, --debs --sources
is the default action.
In addition, the following options may be used:
-k,--keep-src - Move old source files to /opt/sw/src/old/ instead of deleting them. -d,--dry-run - Print the names of the files that would be deleted, but do not actually delete them. -h,--help - Show the modes and options which are available.
6.25 dumpinfo
Only available in fink
newer than version 0.21.0
显示 fink
如何解析软件包的 .info
文件的各个部分。各个字段和百分号展开会按照下面选项的设置来显示:
-h, --help - 显示可用的选项。 -a, --all - 显示软件包描述文件的全部字段。 这时没有指定 --field 或 --percent 标志时的默认方式。 -f 字段名, - 按列出的顺序显示给定的字段名 --field=字段名 -p 关键字, - 按列出顺序显示指定的关键字的百分号扩展 --percent=关键字
6.26 show-deps
Only available in fink-0.23-6 and later.
Displays a human-readable list of the compile-time (build) and run- time (installation) dependencies of the listed package(s).