http://www.gentoo.org/doc/en/portage-utils.xml
Portage-utils
portage-utils is a collection of very fast utilities written in C, which are meant to offer a faster but more limited alternative to their gentoolkit counterparts. Please note that portage-utils is not meant to replace gentoolkit . Its utilities are much more efficient than the equivalent ones from gentoolkit and might be better suited to be used in scripts that need to call Portage repeatedly, but portage-utils does not offer the same functionalities. It does not consider eclasses at all and does not provide tools like revdep-rebuild and glsa-check .
More information about gentoolkit can be found in the Gentoolkit guide.
You can view the complete list of applications in portage-utils by typing man q or q --help . Please read the man page for each utility described, as this guide is only meant to be a short reference for the most useful functions and does not include all the information about each application.
The first step of using portage-utils is to install the package:
| Code Listing 1.1: Installing portage-utils |
# emerge portage-utils |
How to find a package to which a file belongs
qfile finds the package to which a file belongs:
| Code Listing 2.1: Finding the package to which a file belongs |
$ qfile /etc/fonts/fonts.conf |
If you want to check MD5 sums or mtimes of the files installed by some package, you can do it using the qcheck application:
| Code Listing 2.2: Checking package integrity |
$ qcheck portage-utils |
Of course, all the files which were changed after installation will be reported here. If the application reports configuration files which you have manually edited after installation, there's nothing to worry about.
Listing packages which depend on some package
Of course there's also an application which allows you to list all the packages which depend on some package. This is done using qdepends . Use the -a flag to show all the DEPEND, RDEPEND, and PDEPEND information for a package.
| Code Listing 2.3: Listing packages which depend on some package |
$ qdepends -a pygtk |
Listing files that belong to an ebuild
qlist gives you a list of all files that belong to an ebuild.
| Code Listing 2.4: Listing files which belong to an ebuild file |
$ qlist vim |
Looking for packages that use some USE flag
This is done with quse , which must be run as root. It may take some time to first create/update the ebuild cache.
| Code Listing 2.5: Looking for packages with the 'firefox' USE flag |
# quse firefox |
This is done with qsize application and is as simple as:
| Code Listing 2.6: Finding package size |
$ qsize vim |
One of the most powerful tools of portage-utils is qsearch . This tool allows you to search your Portage tree much faster than default emerge -s .
Here are some examples of its usage:
| Code Listing 2.7: Using qsearch to search the tree |
(I forgot the name of the package with my favorite fonts) |
Extracting information from emerge logs
There is also a tool that allows you to extract useful information from your emerge.log file. It's called qlop and it can be useful when you want to estimate package compilation times or compare with your friends whose computer compiles faster. It also allows you to check what's compiling at the moment and how long it will take - which is handy when you're working in the console and don't have any other means to check it.
| Code Listing 2.8: Reading emerge logs with qlop |
(I'm starting to emerge perl and I want an estimate on how long it usually takes) |
本教程介绍 Gentoo 的 Portage-utils 工具集,包括安装步骤、如何查找文件所属包、验证软件包完整性、列出依赖包、查看文件所属构建、查找使用特定 USE 标志的包、获取软件包大小、搜索 Portage 树以及从 emerge 日志中提取信息的方法。

被折叠的 条评论
为什么被折叠?



