注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Creating Your Own Overlay

From Funtoo
Jump to navigation Jump to search

More involved developers may want to consider contributing to Funtoo Linux by maintaining an independent overlay.

Traditionally, an overlay is a Portage repository that can be added dynamically to a user's system to augment the available ebuilds and catpkgs. However, with Funtoo it is also possible for our automated scripts to merge your overlay, or parts of it, into Funtoo Linux itself. If you are maintaining quite a few ebuilds, this lets us "pull" from your independently-maintained overlay so that you don't need to submit lots of pull requests via https://code.funtoo.org. So it can be a very serious optimization to the way you maintain certain ebuilds by saving you time.

Creating Your Overlay

There are two ways to create an overlay that we'll cover. The first is quite simple and can be done via https://code.funtoo.org. Simply go to https://code.funtoo.org/bitbucket/projects/CO/repos/skeleton-overlay/browse and click the "Create fork" button:

Create fork.png

At this point, you will be presented with the next screen, where you should type in a new name for your overlay, disable fork syncing, and click "Fork Repository".

Fork overlay2.png

Making it Public

You have now created your own initial overlay, but it is not visible to the public. To make it visible to the public, go to Repository Settings, then Repository Permissions and finally check Public Access -- Enable. Your repository can now be seen (but not modified) by others.

Learning More About code.funtoo.org

To learn more about code.funtoo.org, please see the following video. We will still need to perform some finishing steps to get the overlay ready for use, which we will cover below.

We will use /var/src/my-overlay as primary location directory for the overlay. The location can be anywhere on your system.

root # install -d /var/src
   Important

Do not store your overlay inside of /var/git/meta-repo, as it is best for your overlays to be logically separate from the official kits that ego maintains via ego sync.

Clone the skeleton overlay from github. Change the repository's name from skeleton to a name as it will appear when emerging. Here we use myoverlayname as an example, choose your name accordingly.

root # cd /var/git/overlay
root # git clone  https://github.com/funtoo/skeleton-overlay.git myoverlayname

Configure the overlay

We will enable portage settings required for the overlay to be functional.

root # echo "myoverlayname" > /var/git/overlay/myoverlayname/profiles/repo_name


   /etc/portage/repos.conf/myoverlayname.conf - Add your overlay to portage
[myoverlayname]
location = /var/git/overlay/myoverlayname
auto-sync = no
priority = 10
   Tip

The priority key is needed to ensure that your overlay has higher priority to the kit's overlays, which are default priority 1

This would be starting point for your own overlay. You are ready to add new ebuilds that are not present in portage tree or fix the ebuilds from portage tree you are not satisfied with, updating old packages or removing newer package versions.

For example, for an updated version of the package net-misc/autossh not currently in the repository, create the directory net-misc under /var/git/overlay/myoverlayname and place the autossh directory under it. In this directory, your ebuild must have a proper digest created. Use the command ebuild /path/to/ebuild digest.

root # install -d /var/git/overlay/myoverlayname/net-misc/autossh
root # cd /var/git/overlay/myoverlayname/net-misc/autossh
root # ebuild autossh-1.2.3.ebuild digest

Above examples shows the basic setup for an ebuild. Notice, a category net-misc, is where autossh belongs to. By default the category cannot be created with an arbitrary names. The categories are strictly defined in the profiles. If wished, custom category can be added via /etc/portage/categories. Follow man 5 portage for details.

   Note

equery may print this warning on execution:

user $ equery u gcc
Unavailable repository 'gentoo' referenced by masters entry in '/var/git/myoverlayname/metadata/layout.conf'
...

This is a known equery bug, but should not cause any adverse effects.