Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
filesdir-check is intended to help locate unused FILESDIR files in Gentoo portage trees
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


filesdir-check is a tool to help locate unused FILESDIR files. The idea is to
look for references to each file in the relevant ebuilds and report any files
that appear to be unreferenced. Note that this is a heuristic check, and that
both false positives and false negatives can occur. Please do a manual check
before you remove any files or file a bug in Gentoo's bugzilla.

You can use filesdir-check in two ways: from the command line, or from python.

- Command line use -------------------------------------------------------------

The default action of the filesdir-check command is to check all packages in
PORTDIR for potentially unused files and report them to standard output. With
the --overlays options, you can instead check for unused files in each of the
overlays listed in PORTDIR_OVERLAY. With the --directory option you can name the
location of a specific overlay to check.

You can also list specific categories and packages to check on the command line.
For example 'filesdir-check www-client sys-apps/portage gvim' will check
 - every package in the www-client category
 - sys-apps/portage
 - app-editors/gvim

Use 'filesdir-check --help' for full details.

- Python use -------------------------------------------------------------------

Two of the functions in the module 'filesdir_check' may be useful. (Note that
these two functions don't do any argument checking, since that is done elsewhere
in the program.) Here are examples:

import filesdir_check
import portage

# List of possibly unused files in the 'media-libs' category, in the main tree
portdir = portage.settings["PORTDIR"]
suspects = filesdir_check.check_category(portdir, "media-libs")

# List of possibly unused files for 'app-cdr/k3b', in my local overlay
local_overlay = "/usr/local/portage"
suspects = filesdir_check.check_category_package(local_overlay, "app-cdr/k3b")

- See also ---------------------------------------------------------------------

Blog posts that mention cleaning up FILESDIR files, by flameeyes:

Another script with a purpose very similar to this one's, by idl0r:

- License ----------------------------------------------------------------------

This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either (at your option) version 2 or version 3 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see <>.
Something went wrong with that request. Please try again.