Creating an ebuild repository

Creating custom ebuilds repositories is helpful for community members who want to get their hands dirty with Gentoo ebuild maintenance. This article Article description::defines the basics of ebuild maintenance by way of a custom ebuild repository (overlay).

Original method (Handbook)
See Defining a custom ebuild repository in the Handbook for Handbook instructions for creating a custom ebuild repository.

eselect repository method
Alternatively, beginning with version 10 of the module, the   subcommand will make an ebuild repository skeleton (requires ):

create [ ]   Create a local repository Name of the new repository Path to use (default: ${REPOS_BASE}/ )

Optional: Use version history
In order to keep track of all changes done in the custom repository, and to make it easier to contribute code upstream or to other users, revision control software is almost a necessity. While it is possible to maintain local repositories manually, it is much more effort for repository maintenance when attempting to track down changes.

git
Using git provides the possibility for testing with different version branches, easy diffs, and a number of other features.

Initialize the git repository:

Adding an ebuild to the repository
Now that the basic layout is in order, an ebuild could be added to the repository. In this example, app-dicts/artha-1.0.2 (available at ). Assumed the ebuild is in the homedir of the user, and named.

It should now be possible to install the package from the ebuild repository with the emerge command:

Simple version bump of an ebuild in the local repository
In theory one can update an ebuild to the next version number with a "simple version bump". Indicators that this is promising are:


 * Upstream fixed only minor bugs.
 * Dependencies did not change.
 * Upstream uses semantic version numbers and changed only the minor number
 * The ebuild file is small and does not use many patches.

For the simplest bump place a copy of the ebuild in the local repository and update the version number in the filename.

Presuming the local repository was created in localrepo already and want to bump to a newer version of.

Now test the installation:

Finished ebuilds should be added to the version control system. If using git, consider adding a pull request to GitHub.

Avoid a direct version bump
The direct version bump in the official ebuild repository is often suggested, but should be avoided, because:


 * All changes get lost on the next sync of the repository (unless sync-type git is in use, in that case a topic branch could be used)
 * User contributions should be separated from the official ebuild repository

Do not do this:

Crossdev
will place the ebuilds/categories it generates into one of four places in this order:


 * 1) An overlay specified on the command-line with the    option
 * 2) An overlay named 'cross-${CTARGET}'
 * 3) An overlay named 'crossdev'
 * 4) Finally, it falls back on the overlay having the lowest priority value in.

If the overlays have the same priority, it will use the overlay determined to be the first, alphabetically.

Most users will want to prevent crossdev from disturbing layman's overlays or the user's personal per-machine overlay (commonly created at ). The best solution is to create an overlay specifically for crossdev's use:

If the main Portage tree is synchronized by using Git, or any other method with Manifest files that do not include checksums for ebuilds, prevent "masked by: corruption" errors with:

Then instruct Portage and crossdev to use this overlay:

Historical
Older versions of included. Starting from portage-2.3.0, has been 'unbundled' into separate package. Be sure it is installed before following this guide:

Alternatively, the command can still be used to generate manifest/digest files, however it does not include any of the other quality check benefits (such as debug output) included with :