This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

eclean/zh-cn

From Gentoo Wiki (test)
Jump to:navigation Jump to:search
This page is a translated version of the page Eclean and the translation is 76% complete.
Outdated translations are marked like this.

Warning: Display title "eclean/zh-cn" overrides earlier display title "Eclean".

eclean is a tool for cleaning repository source files and binary packages. It is part of the app-portage/gentoolkit package and managed by the Portage-Tools project.

安装

Emerge

安装 eclean

root #emerge --ask app-portage/gentoolkit
附注
关于 app-portage/gentoolkit 包中其他工具的信息请参看 Gentoolkit article

使用

默认情况下,源文件存储在 /usr/portage/distfiles 目录下, 二进制包存储在 /usr/portage/packages 目录下;可以通过修改 /etc/portage/make.conf 中的 DISTDIRPKGDIR 变量更改对应的存储位置。如果不定期清理,这两个目录可能会悄然无声地变得非常巨大;这就是创建eclean的原因。

Invocation

使用 eclean --help 来查看全部的命令简介、参数列表和使用介绍:

user $eclean --help
Usage:
 eclean [global-option] ... <action> [action-option] ...
 eclean-dist [global-option, distfiles-option] ...
 eclean-pkg [global-option, packages-option] ...
 eclean(-dist,-pkg) [--help, --version]
 
Available global options:
 -C, --nocolor             - turn off colors on output
 -d, --deep                - only keep the minimum for a reinstallation
 -e, --exclude-file=<path> - path to the exclusion file
 -i, --interactive         - ask confirmation before deletions
 -n, --package-names       - protect all versions (when --deep
 -p, --pretend             - only display what would be cleaned
 -q, --quiet               - be as quiet as possible
 -t, --time-limit=<time>   - don't delete files modified since <time>
   <time> is a duration: "1y" is "one year", "2w" is "two weeks", etc.
   Units are: y (years), m (months), w (weeks), d (days) and h (hours).
 -h, --help                - display the help screen
 -V, --version             - display version info
 
Available actions:
 packages     - clean outdated binary packages from PKGDIR
 distfiles    - clean outdated packages sources files from DISTDIR
 
Available options for the packages action:
 NONE  :)
 
Available options for the distfiles action:
 -f, --fetch-restricted   - protect fetch-restricted files (when --deep)
 -s, --size-limit=<size>  - don't delete distfiles bigger than <size>
   <size> is a size specification: "10M" is "ten megabytes", "200K" is
   "two hundreds kilobytes", etc.  Units are: G, M, K and B.
 
More detailed instruction can be found in `man eclean`

清理 源文件

通过 distfiles 参数清理源文件存放目录:

root #eclean distfiles

或者使用更简短的命令:

root #eclean-dist

清理二进制文件

使用下面的命令清理二进制包:

root #eclean packages

或者使用更简短的命令:

root #eclean-pkg

Options

By default, source files and binary packages corresponding to any ebuild in the current repository will not be deleted. This way, system administrators can easily downgrade a package or install a previously removed package, provided the package is still in the current repository tree.

As an example, suppose packages foo-1.0 and foo-1.1 are both in the repository. After updating from foo-1.0 to foo-1.1, run eclean distfiles: source files for both versions will be kept, so if a problem occurs with foo-1.1 then the user can easily re-install foo-1.0 without re-downloading anything.

另一个可能的情况是安装之前删除的包。假设系统安装了 foo 包(任一版本)。在(不经意地)删除了这个包并运行了 eclean disfiles 之后,foo 的源文件依然被保留,可以重新安装而无需再次下载。

对二进制包同样的例子也一样适用。

To save more disk space, add the --deep option: every source file or binary package that does not correspond to some currently installed package (version does matter) will be deleted. Please notice that this way users will not be protected in case they need to downgrade a package or re-install a previously removed package.

As an alternative, use both the --deep and the --package-names options: every source file or binary package that does not correspond to some currently installed package (version does not matter) will be deleted. This still will not protect in case a re-install of a previously removed package is needed, but it will protect the sources if the package needs to be downgraded later.

更多细节请参阅 eclean(1) man page:

user $man 1 eclean

另请参阅