Gentoolkit

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Gentoolkit and the translation is 47% complete.
Outdated translations are marked like this.
不要混淆 Genkernel.


Resources

Gentoolkit是一套简化Gentoo系统管理的工具。本文档介绍了Gentoolkit中的一些工具的基础知识。

Gentoo是一款独特的发行版,它呈现了一些对于其他发行版根本不存在的复杂性。由于Gentoo开发人员和贡献者发现了其中的一些复杂性,他们还编写了一些工具来帮助用户和管理员解决这些问题。许多工具已经贡献给Gentoo项目,并包含在app-portage/gentoolkit包中。

Gentoolkit包含大量有用的工具,可帮助用户管理包并跟踪系统中发生的情况。 大多数用户(特别是经常更新系统的用户)将从安装Gentoolkit中受益。

The Gentoolkit commands have man pages, type "man <command>" for each command for full documentation.

安装

Emerge

root #emerge --ask app-portage/gentoolkit

euse

euse is used to set (disable/enable) USE flags in make.conf, without having to edit the file directly. It is also used to get detailed information about use flags like description, status of flags (enabled/disabled), type of flag (global/local), etc.

euse是一个在各个地方查看,设置和取消设置USE标记的工具。有关USE标志的更多信息,请参阅USE标志。有关完整帮助和所有选项,请参阅euse -h

Invocation

user $euse --help
euse (0.5.1-r1)
 
Syntax: euse <option> [suboptions] [useflaglist]
 
Options: -h, --help           - show this message
         -V, --version        - show version information
         -i, --info           - show descriptions for the given useflags
         -I, --info-installed - show descriptions for the given useflags and
                                their current impact on the installed system
         -g, --global         - show only global use flags (suboption)
         -l, --local          - show only local use flags (suboption)
         -a, --active         - show currently active useflags and their origin
         -E, --enable         - enable the given useflags
         -D, --disable        - disable the given useflags
         -R, --remove         - remove all references to the given flags from
                                make.conf and package.use to revert to default
                                settings
         -P, --prune          - alias for --remove
         -p, --package        - used with -E, -D, and -R to apply to a
                                specific package only
 
Notes: euse currently works for global flags defined
       in make.globals, make.defaults, make.conf, use.force, and use.mask
       and local flags defined in package.use and individual package ebuilds.
       It might have issues with cascaded profiles. If multiple options are
       specified only the last one will be used.
附注
The information provided by euse --help is currently out of date[1]. (2021-10)

查看,设置和取消设置USE标志

euse -a命令读取当前活动的USE标志并显示它们。

附注
euse现在有5个“列”用于显示是否设置了标志,以及是否已设置所有标志。列如下:+/-,在 Environment中设置,在make.Conf中设置,在make.Defaults中设置,在make.Globals中设置。输出看起来像[+ECDG]。


Full positive values would be [+ECDGFm], full negative values would be [-ecdgfM], full missing values would be [-      ].

Example euse -a output (truncated):

user $euse -a
X                   [+ CD ]
aalib               [+    ]
acpi                [+ C  ]
alsa                [+ C  ]
apache2             [+ C  ]
apm                 [+  D ]
avi                 [+  D ]
berkdb              [+  D ]
bitmap-fonts        [+  D ]
bonobo              [+    ]
cdr                 [+ C  ]
crypt               [+ CD ]
cscope              [+ C  ]
cups                [+ CD ]
curl                [+    ]
emboss              [+  D ]
encode              [+  D ]
esd                 [+    ]
fam                 [+    ]
fbcon               [+ C  ]
firefox             [+ C  ]
font-server         [+  D ]
foomaticdb          [+  D ]
fortran             [+  D ]
gd                  [+ C  ]
gdbm                [+  D ]
gif                 [+ CD ]
gimpprint           [+ C  ]
gnome               [+ CD ]
gphoto2             [+    ]
gpm                 [+ CD ]
gstreamer           [+ C  ]
gtk                 [+  D ]
gtkhtml             [+ C  ]
guile               [+    ]
imagemagick         [+    ]
imlib               [+ CD ]
innodb              [+    ]
ipv6                [+  D ]
javascript          [+ C  ]
jpeg                [+ CD ]
kde                 [+  D ]
ldap                [+    ]
libg++              [+ CD ]
libwww              [+ CD ]
mad                 [+ CD ]
mbox                [+ C  ]
md5sum              [+ C  ]
mikmod              [+ CD ]
mmx                 [+ C  ]
motif               [+ CD ]
mp3                 [+    ]
mpeg                [+ CD ]
mpeg4               [+ C  ]
mysql               [+ C  ]
ncurses             [+ CD ]
nls                 [+  D ]
nvidia              [+ C  ]
odbc                [+    ]
offensive           [+    ]
ogg                 [+ CD ]
opengl              [+ CD ]
oss                 [+  D ]
pam                 [+ CD ]
pdflib              [+ CD ]
perl                [+ CD ]
png                 [+ CD ]
python              [+ CD ]
qt                  [+  D ]
quicktime           [+ CD ]
readline            [+ CD ]
ruby                [+    ]
sdl                 [+ CD ]
slang               [+  D ]
spell               [+ CD ]
sse                 [+ C  ]
ssl                 [+ CD ]
svga                [+ CD ]
tcltk               [+ C  ]
tcpd                [+  D ]
tiff                [+ C  ]
truetype            [+ CD ]
usb                 [+ C  ]
vanilla             [+ C  ]
x86                 [+ C  ]
xml                 [+    ]
xosd                [+ C  ]
xv                  [+ CD ]
xvid                [+ C  ]
zlib                [+ CD ]

类似地,euse -a -g命令用于查看活动的全局USE标志。euse -a -l命令对活动的本地USE标志执行相同的操作。-g-l是euse的子选项,需要在它们之前使用一个选项(如-a)才能正常运行。

Setting, and unsetting USE flags

euse能够设置或取消设置USE标志,命令为euse -E flagname(启用标志)和euse -D flagname(禁用标志)。

警告
不要单独使用euse -Eeuse -D(而不跟标志),这将在/etc/portage/make.conf设置/取消设置所有USE标志。虽然备份保存在/etc/portage/make.conf.euse_backup,但使用euse -Eeuse -D时请小心!

启用USE标志:

Use the -E option to enable a USE flag.

root #euse -E 3dfx
/etc/portage/make.conf was modified, a backup copy has been placed at /etc/portage/make.conf.euse_backup

运行命令后/etc/portage/make.conf文件如下所示:

文件 make.conf启用3dfx USE标志后
USE="alsa acpi apache2 -arts cups cdr crypt cscope -doc fbcon \
     firefox gd gif gimpprint gnome gpm gstreamer gtkhtml imlib \
     innodb -java javascript jpeg libg++ libwww mad mbox md5sum \
     mikmod mmx motif mpeg mpeg4 mysql ncurses nvidia \
     ogg odbc offensive opengl pam pdflib perl png python \
     quicktime readline sdl spell sse ssl svga tcltk tiff truetype usb \
     vanilla X xosd xv xvid x86 zlib 3dfx"

禁用USE标志:

Use the -D option to remove a USE flag.

root #euse -D 3dfx
/etc/portage/make.conf was modified, a backup copy has been placed at /etc/portage/make.conf.euse_backup

同样,命令后面的/etc/portage/make.conf文件:

文件 make.conf禁用3dfx USE标志后
USE="alsa acpi apache2 -arts cups cdr crypt cscope -doc fbcon \
     firefox gd gif gimpprint gnome gpm gstreamer gtkhtml imlib \
     innodb -java javascript jpeg libg++ libwww mad mbox md5sum \
     mikmod mmx motif mpeg mpeg4 mysql ncurses nvidia \
     ogg odbc offensive opengl pam pdflib perl png python \
     quicktime readline sdl spell sse ssl svga tcltk tiff truetype usb \
     vanilla X xosd xv xvid x86 zlib -3dfx"
附注
euse不会从/etc/portage/make.conf中物理删除该标志,它在标志之前添加-(减号)以取消它,可能需要手动清理/etc/portage/make.conf以消除不需要的变量,否则使用-P(purge)选项删除标志。例如,使用euse -P 3dfx 将删除3dfx标志。
提示
A disabled USE flag is not the same as the absence of the flag in make.conf. A disabled use flag will actively disable features, whereas not listing a flag at all will use the default - enabled or disabled - as set by the package maintainer.

Remove (prune) a USE flag

Use the -P (purge) option to remove a USE flag.

root #euse -P 3dfx

The example /etc/portage/make.conf file, after the command:

文件 make.confAfter disabling the 3dfx USE flag
USE="alsa acpi apache2 -arts cups cdr crypt cscope -doc fbcon \
     firefox gd gif gimpprint gnome gpm gstreamer gtkhtml imlib \
     innodb -java javascript jpeg libg++ libwww mad mbox md5sum \
     mikmod mmx motif mpeg mpeg4 mysql ncurses nvidia \
     ogg odbc offensive opengl pam pdflib perl png python \
     quicktime readline sdl spell sse ssl svga tcltk tiff truetype usb \
     vanilla X xosd xv xvid x86 zlib"

其他工具

revdep-rebuild

重要
It is not necessary to run this tool for general use. The portage FEATURE preserve-libs makes the original purpose obsolete. The primary purpose of this tool is now ABI changes for specific libraries when instructions are provided by developers.

这个工具是Gentoo的反向依赖重建器,它将扫描已安装的ebuild,以查找因其所依赖的软件包升级而损坏的软件包。它可以自动为用户安装这些包,但也可能发生给定包不能与当前安装的依赖项一起使用,在这种情况下,您应该将损坏的包升级到更新的版本。revdep-rebuild会将标志传递给emerge,它允许你使用--pretend标志来查看将要再次出现的内容。

revdep-rebuild will pass flags to emerge which lets the --pretend flag pass through, to see what is going to be emerged again before going any further.

user $revdep-rebuild -p
 * Configuring search environment for revdep-rebuild
  
 * Checking reverse dependencies
 * Packages containing binaries and libraries broken by a package update
 * will be emerged.
  
 * Collecting system binaries and libraries
 * Generated new 1_files.rr
 * Collecting complete LD_LIBRARY_PATH
 * Generated new 2_ldpath.rr
 * Checking dynamic linking consistency
[ 48% ]  *   broken /usr/lib/gstreamer-0.10/libgsttaglib.la (requires /usr/lib/libtag.la)
[ 64% ]  *   broken /usr/lib/libgdkglext-x11-1.0.la (requires /usr/lib/libGLU.la)
[ 67% ]  *   broken /usr/lib/libgtkglext-x11-1.0.la (requires /usr/lib/libGLU.la)
[ 85% ]  *   broken /usr/lib/python2.6/site-packages/gtk-2.0/gtk/gdkgl/_gdkgl.la (requires /usr/lib/libGLU.la)
 *   broken /usr/lib/python2.6/site-packages/gtk-2.0/gtk/gtkgl/_gtkgl.la (requires /usr/lib/libGLU.la)
[ 97% ]  *   broken /usr/qt/3/lib/libqt-mt.la (requires -lpng)
[ 100% ]
 * Generated new 3_broken.rr
 * Assigning files to packages
 *   /usr/lib/gstreamer-0.10/libgsttaglib.la -> media-plugins/gst-plugins-taglib
 *   /usr/lib/libgdkglext-x11-1.0.la -> x11-libs/gtkglext
 *   /usr/lib/libgtkglext-x11-1.0.la -> x11-libs/gtkglext
 *   /usr/lib/python2.6/site-packages/gtk-2.0/gtk/gdkgl/_gdkgl.la -> dev-python/pygtkglext
 *   /usr/lib/python2.6/site-packages/gtk-2.0/gtk/gtkgl/_gtkgl.la -> dev-python/pygtkglext
 *   /usr/qt/3/lib/libqt-mt.la -> x11-libs/qt
 * Generated new 4_raw.rr and 4_owners.rr
 * Cleaning list of packages to rebuild
 * Generated new 4_pkgs.rr
 * Assigning packages to ebuilds
 * Generated new 4_ebuilds.rr
 * Evaluating package order
 * Generated new 5_order.rr
 * All prepared. Starting rebuild
emerge --oneshot --pretend  dev-python/pygtkglext:0
media-plugins/gst-plugins-taglib:0.10
x11-libs/gtkglext:0
x11-libs/qt:3
  
These are the packages that would be merged, in order:
  
Calculating dependencies... done!
[ebuild   R   ] media-plugins/gst-plugins-taglib-0.10.17
[ebuild   R   ] x11-libs/gtkglext-1.2.0
[ebuild   R   ] x11-libs/qt-3.3.8b-r2
[ebuild   R   ] dev-python/pygtkglext-1.1.0
 * Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.

要重建某些软件包,请运行revdep-rebuild而不使用-p标志,列表中的包将会被安装。

eread

eread是一个简单的工具,用于显示自2.1版以来Portage生成的elog文件,可以通过在/etc/portage/make.conf中设置几个变量来启用elog文件的保存:

文件 make.conf启用elog
PORTAGE_ELOG_CLASSES="log"
PORTAGE_ELOG_SYSTEM="save"
附注
这只是保存elog消息的一种方法。 有关Portage elog系统如何工作的更多信息,请参阅Portage手册中的相应页面。

一旦elog设置满意,运行eread查看日志文件。

user $eread
This is a list of portage log items. Choose a number to view that file or type
q to quit.
  
1) app-portage:gentoolkit-0.2.4_pre2:20070320-000256.log
2)  app-portage:gentoolkit-0.2.4_pre2:20070320-000258.log
3)  app-portage:gentoolkit-0.2.4_pre2:20070320-000319.log
4)  app-portage:gentoolkit-0.2.3:20070320-000408.log
Choice?

选择一个数字,将使用PAGER环境变量中指定的分页程序显示该文件。如果没有设置PAGER,将使用less。可以使用eselectpager模块)设置PAGER环境变量。

显示elog项目后,系统将提示您是否要删除该文件。

eclean

eclean是一个从系统中删除旧源文件和旧二进制包的工具。

构建和安装包时,源文件将下载并保存在 DISTDIR 中,通常是 /var/cache/distfiles。如果不定期清洁,这可能会累积数千兆字节的材料。用户应该运行 eclean-dist 来清理 DISTDIR 中的源文件。

可以使用 quickpkgFEATURES="buildpkg" 创建已安装软件包的存档。这些存档的包保存在 PKGDIR 中,通常是 /var/cache/binpkgs。当它们不再需要时,或者它们太旧时,可以运行 eclean-pkg 将它们从 PKGDIR 中移除,这是确保系统上的任何二进制包只是最新版本的好方法。

有关eclean的更多信息以及维护无残留系统的提示,请阅读man eclean或查看eclean文章。

另请参阅

  • Equery — 一个用于简化常用 Portage 操作的工具
  • Eclean — 一个清理仓库源文件和二进制包的工具
  • Epkginfo — a tool used to display package metadata information.
  • Q applets — a collection of small, fast Portage query utilities written in C.
  • Useful_Portage_tools — 提供了一个ebuild 仓库内可用的 Gentoo 特有的系统管理工具列表,尤其是针对 Portage

This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Matt Butcher, John P. Davis, Erwin, Shyam Mani, Xavier Neys, Karl Trygve, José Luis Rivero, Joshua Saddler, Douglas Anderson
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.