DISTDIR

From Gentoo Wiki
Jump to:navigation Jump to:search

The DISTDIR variable defines the location where Portage will store the downloaded source code archives. Its value defaults to /var/cache/distfiles on new installations. Previously the default was ${PORTDIR}/distfiles which resolved to /usr/portage/distfiles by default.

This location, which is also often referred to as the distfiles location, will host the source code archives of all software installed (or attempted to install) on the system. This location is not automatically cleaned up, so users should consider using tools such as the eclean-dist command (which comes as part of the app-portage/gentoolkit package) to keep the storage used by this location under control. Read the Eclean article for more details.

Users can set the DISTDIR variable in /etc/portage/make.conf:

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


File integrity check and unpacking is a non-atomic operation, allowing for an attack where a file is swapped in between, possibly leading to compromise the system.
FILE /etc/portage/make.confUsing a different DISTDIR location
DISTDIR=/var/gentoo/distfiles

Source of archives

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.

Bypassing Gentoo mirrors

Warning
Over time, upstream projects who host package source files will move their project's source URLs to new locations. In some instances, upstream projects will discontinue development, which eventually leads to the inability to obtain software sources from upstream locations.

Due to the Gentoo mirroring system, ebuild maintainers can still 'support' ebuilds with deprecated upstream sources. This allows software to be gracefully phased out of the ::gentoo ebuild repository, which is part of a good user experience for the Gentoo community. For these reasons and others, users who choose to bypass the Gentoo mirror system should expect unreliable downloads for source files.

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

See also