Ebuild repository

An ebuild repository, colloquially known as an overlay, is Article description::a structure of directories and files used to add and extend software packages for a Gentoo-based system. Ebuild repositories contain ebuilds, eclasses, and other types of descriptive metadata files. These files inform the package manager of software available for installation, news items, and profile targets. An ebuild repository should conform to one or more Ebuild APIs as detailed in Gentoo's Package Manager Specification.

The Gentoo ebuild repository, as Gentoo's primary and "official" repository, is the source for all the information needed to build and install Gentoo packages, contained in ebuilds.

Administrators of Gentoo systems can add additional ebuild repositories by using various utilities and methods described below.

The Gentoo ebuild repository
The primary repository of any Gentoo system is called the Gentoo ebuild repository. It is hosted and maintained on a Gentoo server, and gets synchronized to local machines, to be available to Portage.

The Gentoo ebuild repository contains ebuilds that enable the building of all packages that can make up an "official" Gentoo installation. Through these ebuilds, the Gentoo repository houses metadata about software available for installation, such as a package's name, version, possible USE flags, license, website etc. Dependency information also resides here, to allow Portage to pull in the packages required to build and run anything that could be installed. Importantly, the ebuilds inside the Gentoo repository contain the information required configure, build (compile), install, and test each package, usually from a project's own source code.

The Gentoo ebuild repository will sometimes be called by shorter, or even colloquial, names, such as the Gentoo repository, the Gentoo repo, ::gentoo, gentoo.git, or occasionally just the "repo". It was historically known within the Gentoo community as the Portage tree, rsync tree, or sometimes just "the tree".

Additionally to the ebuilds that allow building packages, the Gentoo repository contains the official profiles, which define default state of USE flags, default values for most variables found in, the set of system packages, and select available package versions that define what packages are available for a given architecture.

The Gentoo repository is also the place where the news items are provided, which is why any new news items will be highlighted after a Gentoo repository synchronization.

The Gentoo repository, and it's ebuilds, are maintained by the Gentoo developers and members of the community.

Repositories in general
Ebuild repositories are nothing more (or less) than a set of files (ebuilds, metadata files, ...). These can be pulled in from public repositories (git, CVS, SVN, ...) or downloaded as tarballs and extracted manually onto the system.

The now default approach for handling repositories is through which, like many other Portage configuration locations, can be a file or a directory of files.

Repository definitions inside also inform Portage if and how the repository can be updated. With it, calling will automatically update the enabled repositories as well.

A deprecated, yet still supported method is to use the PORTDIR_OVERLAY variable inside. This variable can point to one or more additional locations on the file system where additional repositories are available. The use of the directory is highly preferred.

For more information, see /etc/portage/repos.conf and the Portage/Sync article.

Priorities
Each ebuild repository has a unique priority to the package manager. This ensures that in the case of a specific version being found in several ebuild repositories, the resolution is unambiguous. Ebuilds from repositories with higher priority numbers (for example ) will take precedence over ebuilds from repositories with lower priorities (such as  ).

The list of ebuild repositories with their priorities can be obtained through the output of the following commands (look for the "Repositories" string):

The Gentoo ebuild repository will have a priority of  which means that all other repositories generally take precedence if they are assigned a higher priority. This is the default behaviour, because ebuild repositories are designed to "lay over" or "on top" of the Gentoo repository. To set the priority of other repositories, manually edit the relevant repos.conf section and set priority = to the desired value. For example:

Repositories that do not have a priority set default to 0.

Repository management tools
A number of tools support or integrate with ebuild repositories.

Layman
Eselect/Repository supersedes layman for most uses.

The application makes it easier to manage and update multiple additional ebuild repositories. It is a command-line application through which publicly available ebuild repositories can be listed, subscribed to and unsubscribed from, as well as update those repositories.

It supports both the as well as  method.
 * When using the method,  manages a dedicated configuration file which should be sourced in by
 * When using, manages the  file directly

For more information, see Layman and Project:Portage/Sync.

emaint
See the Sync (Portage project) article and.

eix
is a wrapper starting (which in turn starts ) followed by. For further details see the Eix article and.

eselect-repository
Eselect/Repository maintains entries for Portage to access and synchronize.

supersedes layman for listing, configuring, and handling synchronization of alternate repositories, except for version control systems which the package manager does not natively sync (e.g. darcs and g-sorcery in Portage).

See Eselect/Repository article for details.

Emerging a duplicate package
When working with ebuild repositories it is possible to encounter a situation where multiple versions of the same package are available from different ebuild repositories. Instruct Portage to install a specific package from a specific ebuild repository with the  version specifier:

The same notation can be used for different emerge instructions, including uninstalling a package through.

Cache generation
When large ebuild repositories are installed, Portage may take a long time to perform operations like dependency resolution. This is because ebuild repositories do not usually contain a metadata cache.

Generate a local metadata cache by running after syncing the ebuild repositories:

Be careful, because takes a lot of time and it's not recommended for rsync users as rsync updates the cache using server-side caches (most of users of portage are rsync users). Rsync users should simply run (or ) to regenerate the cache. It's probably only users of very large ebuild repositories should try.

Masking installed but unsafe ebuild repositories
When using large ebuild repositories or those with unknown/low quality code, it is best practice to hard mask the whole ebuild repository and only accept specific ebuilds on a case-by-case basis. For example, for an overlay named "repository-foobar":

Then add the specific package(s) from the repository-foobar overlay so that they will be available visible to Portage for installation:

After the above unmask the package named "foo-category/bar" should be available and none of the other packages from the repository-foobar overlay will be available, which is by design.

External resources

 * https://repos.gentoo.org - Gentoo's official ebuild repository hosting location.
 * https://github.com/gentoo/ - GitHub mirror of the Gentoo's ebuild repository.
 * https://gpo.zugaina.org/Overlays - A non-official very useful site for searching overlays.