Difference between revisions of "Creating Your Own Overlay"

From Funtoo
Jump to navigation Jump to search
(20 intermediate revisions by 5 users not shown)
Line 1: Line 1:
This page intends to get your local overlay going.
More involved developers may want to consider contributing to Funtoo Linux by maintaining an independent ''overlay''.  
==Using overlay with Funtoo's kits system==
For the overlays we will use a minor change for the main meta-repo described in Funtoo kits: https://github.com/funtoo/meta-repo/blob/master/README.rst


{{console|body=
Traditionally, an overlay is a Portage repository that can be added dynamically to a user's system to augment the available ebuilds and [[Catpkg|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 time savings for developers who are more advanced.
###i## install -d /var/git
 
###i## cd /var/git
==Creating Your Overlay ==
###i## git clone https://github.com/funtoo/meta-repo.git
 
###i## cd meta-repo
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:
###i## git submodule init
 
###i## git submodule update
[[File:create fork.png|480px|center]]
###i## rm /usr/share/portage/config/repos.conf
 
}}
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".
Notice that by default guide entire /etc/portage/repos.conf is a symlink to <code>/var/git/meta-repo/repos.conf</code>. This will not let using custom repositories (overlays). For that we will setup a flat file symlink, called <code>funtoo</code> (just an example name).
 
{{console|body=
[[File:fork_overlay2.png|480px|center]]
###i## rm -rf /etc/portage/repos.conf
 
###i## mkdir /etc/portage/repos.conf
=== Making it Public ===
###i## ln -s /var/git/meta-repo/repos.conf /etc/portage/repos.conf/funtoo
 
###i## chown -R portage:portage /var/git/meta-repo
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 {{c|Repository Settings}}, then {{c|Repository Permissions}} and finally check {{c|Public Access -- Enable}}. Your repository can now be seen (but not modified) by others.
}}
 
In above shown commands we created the "funtoo" symlink to the regular portage tree. This allows to add any configuration files of any names you prefer for any custom repositories you like, such as overlays, and will not interfere with the meta-repo.
=== 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.
 
{{#evt:service=youtube|id=https://youtu.be/V6PfB64oMWo|dimensions=480|alignment=center|autoresize=true}}
 
 
=== Cloning and Finishing Touches ===


==Creating the overlay==
You will now want to add a ssh key to code.funtoo.org (see video above for more information.) Then, clone it locally, and perform the following steps to properly set the overlay name:
We will use <code>/var/git/overlay</code> as primary location directory for the overlay. The location can be anywhere on your system, below is an example location tied with <code>/var/git/</code>, is where regular tree located too.


{{console|body=
{{console|body=
###i## mkdir /var/git/overlay
$ ##i##git clone ssh://git@code.funtoo.org:7999/~drobbins/my-overlay.git
Cloning into 'my-overlay'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 16 (delta 4), reused 0 (delta 0)
Receiving objects: 100% (16/16), 8.64 KiB {{!}} 8.64 MiB/s, done.
Resolving deltas: 100% (4/4), done.
$ ##i##cd my-overlay
$ ##i##echo "my-overlay" > profiles/repo_name
$ ##i##sed -i 's/skeleton/my-overlay/' metadata/layout.conf
$ ##i##git add .
$ ##i##git commit -a -m "Setting initial repo name."
$ ##i##git push
}}
}}
{{important|Do not store your overlay inside of /var/git/meta-repo. If you do it will get erased when you run ego sync.}}


Clone the [https://github.com/funtoo/skeleton-overlay skeleton overlay] from github. Change the repository's name from ''skeleton'' to a name as it will appear when emerging. Here we use <code>myoverlayname</code> as an example, choose your name accordingly.
{{Tip|Now is also a good time to review the {{c|README.rst}} and {{c|LICENSE.txt}} and customize as needed.}}


{{console|body=###i## cd /var/git/overlay
Now, your overlay is ready for new ebuilds to be committed to it. But before we do that, we should configure Portage to "see" your overlay and any packages it contains.
###i## git clone  https://github.com/funtoo/skeleton-overlay.git
###i## mv skeleton-overlay myoverlayname
}}


==Configure the overlay==
=== Create repos.conf Entry ===
We will enable portage settings required for the overlay to be functional.
{{console|body=
###i## echo "myoverlayname" > /var/git/overlay/myoverlayname/profiles/repo_name
###i## echo "masters = core-kit" >> /var/git/overlay/myoverlayname/metadata/layout.conf}}


{{file|name=/etc/portage/repos.conf/myoverlayname.conf|lang=|desc=Add your overlay to portage|body=
Create the following file in order to register your overlay with Portage:
[DEFAULT]
main-repo = core-kit


[myoverlayname]
{{file|name=/etc/portage/repos.conf/my-overlay.conf|lang=|desc=Add your overlay to portage|body=
location = /var/git/overlay/myoverlayname
[my-overlay]
location = /home/myuser/my-overlay
auto-sync = no
auto-sync = no
priority = 10
priority = 10
}}
}}


{{tip|The <code>priority</code> key is needed to ensure, that your overlay has higher priority to the kit's overlays, which are default priority 1}}
{{tip|The {{c|priority}} key is needed to ensure that your overlay has higher priority to the kit's overlays, which are default priority 1.}}
 
Now, 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.


This would be starting point for your own overlay. You're ready to add new ebuilds that are not present in portage tree or fix the ebuilds from portage tree you are no satisfied with, updating of old versions or removing of new ebuild versions.
For example, to create an updated version of the package {{c|net-misc/autossh}} not currently in the repository, create the directory tree {{f|net-misc/autossh}} under {{c|my-overlay}}. In the {{f|autossh}} directory you created, you can add new {{c|autossh-x.y.z.ebuild}} files.


[[Category:Portage]]
[[Category:Portage]]
[[Category:Official Documentation]]

Revision as of 15:54, November 12, 2019

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 time savings for developers who are more advanced.

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.


Cloning and Finishing Touches

You will now want to add a ssh key to code.funtoo.org (see video above for more information.) Then, clone it locally, and perform the following steps to properly set the overlay name:

user $ git clone ssh://git@code.funtoo.org:7999/~drobbins/my-overlay.git
Cloning into 'my-overlay'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 16 (delta 4), reused 0 (delta 0)
Receiving objects: 100% (16/16), 8.64 KiB | 8.64 MiB/s, done.
Resolving deltas: 100% (4/4), done.
user $ cd my-overlay
user $ echo "my-overlay" > profiles/repo_name
user $ sed -i 's/skeleton/my-overlay/' metadata/layout.conf
user $ git add .
user $ git commit -a -m "Setting initial repo name."
user $ git push
   Tip

Now is also a good time to review the README.rst and LICENSE.txt and customize as needed.

Now, your overlay is ready for new ebuilds to be committed to it. But before we do that, we should configure Portage to "see" your overlay and any packages it contains.

Create repos.conf Entry

Create the following file in order to register your overlay with Portage:

   /etc/portage/repos.conf/my-overlay.conf - Add your overlay to portage
[my-overlay]
location = /home/myuser/my-overlay
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.

Now, 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, to create an updated version of the package net-misc/autossh not currently in the repository, create the directory tree net-misc/autossh under my-overlay. In the autossh directory you created, you can add new autossh-x.y.z.ebuild files.