From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page DISTDIR and the translation is 41% complete.
Outdated translations are marked like this.

DISTDIR变量定义了 Portage 将会把下载的源码存放到哪个路径。新安装完后的默认值是 /var/cache/distfiles。以前的默认值是 ${PORTDIR}/distfiles,它默认解析到 /usr/portage/distfiles

这个路径,通常也被称作 "distfiles" 路径,将会存放系统上所有曾经安装过(或者试图安装的)软件的源代码文件。这个路径不会被自动清理,为了保持这个目录的容量,用户应该考虑使用一些工具例如 eclean-dist 命令 ( app-portage/gentoolkit 的一部分)。阅读 Eclean 文章了解更多细节。


Beware where you place your DISTDIR! Only trusted users should be granted write access to this location.

File integrity check and unpacking is not atomic operation, allowing for an attack where file is swapped in between possibly leading to compromise the system.
文件 /etc/portage/make.conf使用不同的DISTDIR位置


To download source code archives, Portage will download files from servers defined in the GENTOO_MIRRORS variable first (to alleviate load on upstream project resources and for other reasons). The SRC_URI variable in individual ebuilds, points to the package's original source files, which is originally downloaded by the ebuild maintainers during ebuild creation and development.

Part of ebuild development is the creation of Manifest files, which ensure the upstream source files are not modified from the time they are downloaded by the ebuild developer, distributed to Gentoo's mirror system, then to their destination on the endpoint system.

绕过 Gentoo 镜像


To download the source archives bypassing Gentoo mirrors, set the GENTOO_MIRRORS variable to an empty value from the command-line. For example:

root #GENTOO_MIRRORS="" emerge --ask www-client/firefox