Knowledge Base:Remove obsoleted distfiles

Synopsis
The DISTDIR location hosts all the source code archives downloaded by the system. Unless the files are properly removed when no longer needed, the storage occupied by this location will continue to grow. Regular clean-up of this location is not performed automatically by Portage.

Environment
Any Gentoo Linux installation.

Analysis
When Portage needs to download source code archives, it will store these archives in DISTDIR for later use. Portage will never clean up this location by itself; it will wait for a user with root privileges to do so.

Cleaning up the  location means that the user should check which source code archives to keep and which to delete.


 * If the system is tight on space and there no problems in re-downloading the source code archives when necessary, then the entire  can be cleaned
 * If the system is tight on space, and user would rather not re-download source code of packages that are currently installed (in case a rebuild the software is needed the sources will present on the system), then only clean out source code archives that are no longer used any installed software

Of course, other clean-up strategies might exist as well. The above examples are provided as hypothetical situations.

Resolution
The package provides an application called eclean-dist which supports, among other strategies, the following clean-up activities.

Running eclean-dist will remove the source code archives that do not belong to any available ebuild anymore. This is a safe approach since these sources are very unlikely to be needed again (most of these archives are of old ebuilds that have since been removed from the Portage tree).

The  option can be added to make eclean-dist remove the source code archives that do not belong to an installed ebuild. This will remove many more sources, but is still not be that troublesome since the source code archives of installed ebuilds remain available in case a rebuild is needed.

A few useful options
There are several useful options, so be sure to look at them. The  option outputs lots of useful information. For example,  functions as it does with emerge, showing what will happen without actually doing anything. Another nice option that can be used in conjunction with  is. Downloading Java from Oracle is annoying enough the first time; this will keep users from reliving the painful experience of re-downloading source code for their systems...at least until the next release.