Creating an ebuild repository

Create an ebuild repository to house ebuilds to be made available to Portage for installation. Once an ebuild repository is created, and ebuilds are added to it, it may be shared with others (via a publicly available git repository for example), if it can be of use to others.

Creating ebuild repositories and ebuilds can can be a good way to learn more about the heart of Gentoo. Publishing an ebuild repository can also be a good way to contribute to the community, though helping out with GURU, or becoming a proxy maintainer can be even more helpful. This article will cover all the Article description::basics of creating an ebuild repository and maintaining ebuilds in it.

Creating an empty ebuild repository
Using the module, it is possible to make an ebuild repository skeleton with just one command:

A new ebuild repository can also be created "by hand", as explained in the Handbook section defining a custom ebuild repository.

Track changes (optional)
Using a Version Control System (VCS) is good practice when creating or maintaining any ebuild repository. Not only will it track changes and allow "undoing" mistakes, among other useful features, it can often make it easier to share an ebuild repository, if or when desired.

Portage has support for several VCSs to automatically provide ebuild repository synchronization, easily sending updates from ebuild repositories that have been made available. Portage supports CVS, git, Mercurial, and Subversion in this fashon. Other VCSs may be used, if an ebuild repository is to provide synchronization by other means, or not at all.

git
allows different version branches, which are useful for testing things out, provides easy diff facilities, and other features that can help to create and maintain an ebuild repository.

To start using git to develop an ebuild repository, first initialize the git repository:

Adding an ebuild to an ebuild repository
Now that the basic layout is in order, an ebuild can be added to the ebuild repository.

Of course, a new ebuild repository may be destined to contain newly written ebuilds, but for this example, app-dicts/artha-1.0.2 will be used, and it willl be assumed that that ebuild is in the homedir of the user, in a file named.

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

Simple version bump of an ebuild
Sometimes, when a new version comes out upstream, it can be possible to update an ebuild so that it will install the new version, by doing a "simple version bump". If the following are true, an update may be a good candidate to perform a "bump" on:


 * 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

In the best possible case, it may be feasible to bump just by duplicating the ebuild in an ebuild repository and updating the version number in the filename - but not for an ebuild repository configured to be synced, the changes would be overwritten when syncing.

Version bump of an ebuild in the Gentoo ebuild repository
If a newer version of a package from the Gentoo ebuild repository is available upstream, and the update is small enough to be "bumpable", it is possible to bump it by adding an ebuild to an appropriate ebuild repository configured with Portage. Do not try to bump it directly in the Gentoo ebuild repository files (see next section).

For example, with an ebuild repository named "local", to perform an elementary "bump" to a newer version of from the Gentoo ebuild repository.

Now test the installation:

Finished ebuilds should be added to the version control system, to make the updated ebuild available to others. If using an ebuild repository from GitHub, consider adding a pull request.

Avoid direct version bumps
It may be tempting to just rename an ebuild to a new version inside the local Gentoo ebuild repository files, when it is possible to bump an ebuild in such a way, but this has inconveniences and should not be done. This method is sometimes brought up and suggested, however it will have undesirable consequences:


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

Do not do this:

Crossdev
is a cross-compiler environment generator for Gentoo, it will allow compilation of packages for different targets (architectures, C libraries (libc), etc.).

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


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

If ebuild repositories have the same priority, it will use the ebuild repository determined to be the first, alphabetically.

Most users will want to prevent crossdev from disturbing configured ebuild repositories. The best solution is to create an ebuild repository specifically for crossdev's use:

If the Gentoo ebuild repository 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 ebuild repository:

repoman
Use repoman's functions to act on an ebuild repository, all while enforcing a minimal level of quality in the changes to ebuilds and related metadata, and to perform checks.

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 :