Handbook:Parts/Portage/CustomTree/zh-cn

Excluding packages and categories
It is possible to selectively update certain categories/packages and ignore the other categories/packages. This can be achieved by having rsync exclude categories/packages during the step.

Define the name of the file that contains the exclude patterns in the PORTAGE_RSYNC_EXTRA_OPTS variable in :

Note however that this may lead to dependency issues since new, allowed packages might depend on new but excluded packages.

In order for this method to work, manifest verification must be disabled which will reduce the security of the repo. To disable the verification, either disable the rsync-verify USE flag on or set sync-rsync-verify-metamanifest=no in the repos.conf entry of the Gentoo repository.

Defining a custom ebuild repository
It is possible to instruct Portage to use ebuilds that are not officially available through the Gentoo ebuild repository. In order to do so, create a new directory (for instance ) in which to store the 3rd party ebuilds. This new repository will require the same directory structure as the official Gentoo repository.

Next, pick a sensible name for the repository. The next example uses "localrepo" as the name:

Tell Portage that the repository master is the main Gentoo ebuild repo, and that the local repository should not be automatically synchronized (as it is not backed by an external source such as an rsync server, git mirror, or other repository type):

Finally, enable the repository on the local system by creating a repository configuration file inside. This will inform Portage of where the custom local repository can be found:

Working with several overlays
For the power users who develop on several overlays, test packages before they hit the Gentoo repository or just want to use unofficial ebuilds from various sources, the package brings, a tool to help users keep the overlay repositories up to date.

Alternatively, install to utilize the native synchronization in Portage. See also Eselect/Repository

eselect-repository
Adding repositories is simple with the eselect module (available via ):

For instance, to enable the hardened-development overlay:

Updating of overlays added with this methods happens naturally with:

Layman
First install and configure as shown in the Overlays User Guide, and add the desired repositories with.

For instance, to enable the hardened-development overlay:

Regardless of how many repositories are used through, all the repositories can be updated with the following command:

For more information on working with overlays, please read and the previously linked layman/overlay users' guide.

Using Portage with self-maintained software
Sometimes users want to configure, install and maintain software individually without having Portage automate the process, even though Portage can provide the software titles. Known cases are kernel sources and Nvidia drivers. It is possible to configure Portage so it knows that a certain package is manually installed on the system (and thus take this information into account when calculating dependencies). This process is called injecting and is supported by Portage through the file.

For instance, to inform Portage about gentoo-sources- which has been installed manually, add the following line to :