Using and creating Gentoo Linux repositories using Layman

Gentoo Linux uses ebuild scripts to compile and install software packages. Ebuilds for many packages are available in the default portage repository. However, you may want to add your own ebuilds, for example to add additional packages to your system or to apply a patch to the source of a package. Using overlays with Layman is an efficient way to handle this on either one machine or a number of machines.

Use existing overlays with Layman

Emerge Layman

Typically, you should use Layman to handle overlays in Gentoo:

$ emerge -va app-portage/layman

Directory for Layman on the client:
/var/lib/layman/ # layman >= 1.3.0

Use Layman

Add to /etc/make.conf:

source /var/lib/layman/make.conf

Create an initial configuration file:

$ echo PORTDIR_OVERLAY=\"\" > /var/lib/layman/make.conf

To handle overlays with Layman:
layman -L # list all available overlays
layman -a <overlay> # add overlay <overlay>
layman -d <overlay> # delete overlay <overlay>
layman -S # sync all installed overlays
layman -l # list all installed overlays

Create your own overlays

Create a local overlay (server = client)

If you want to use the repository on the same machine only, use a local overlay:

$ mkdir /usr/local/portage

Edit /etc/make.conf and add your own LOCAL overlay:

PORTDIR_OVERLAY="/usr/local/portage"

On the server

(e.g. your.server.org):

Create the directory for the repository on the server:

$ mkdir /usr/local/portage/<reponame>/
  • create your overlay there by adding ebuild files in the proper subdirectories

Create a local rsync mirror:

See: http://www.gentoo.org/doc/en/rsync.xml

  • in /etc/rsyncd.conf, add:
    
    [gentoo-<reponame>]
            path = /usr/local/portage/<reponame>
            comment = <reponame> Gentoo tree
            exclude = distfiles/ packages/

    access is also set in this file. Note: *.domain.org works, 192.168.1.* doesn’t – use 192.168.1.0/24!

On the client

In /var/lib/layman/<reponame>-overlays.xml add:

<!-- <?xml version="1.0" encoding="UTF-8"?> Remove comments! -->  
<overlay contact="me@server.org" name="<reponame>" src="rsync://your.server.org/gentoo-<reponame>" status="unofficial" type="rsync">
  <link>http://your.server.org</link>
  <description><reponame>-Overlay for Gentoo Linux</description>
</overlay>

/etc/layman/layman.cfg:
overlays : http://www.gentoo.org/proj/en/overlays/layman-global.txt
file:///var/lib/layman/<reponame>-overlays.xml

layman -S # creates a new overlays.xml in /var/lib/layman/
layman -L # now lists the new overlay
layman -a <reponame> # adds the overlay and downloads its contents, creating /var/lib/layman/<reponame>/ and adding the entry to /var/lib/layman/make.conf
eix-update # to update eix’s index if you use it

Make sure that

rsync://your.server.org/gentoo-<reponame>

in client:/var/lib/layman/<reponame>-overlays.xml and

[gentoo-<reponame>]

in server:/etc/rsyncd.conf use the same name for the module (here, gentoo-<reponame>)

Obtain discarded Gentoo ebuilds

  • Go to the Gentoo CVS Attic
  • Click your way through the tree to the package you’re looking for
  • At the top of the page, after Files shown: <nn>, click on (Show <nn> dead files)
  • You might also need patches et cetera from the files subdirectory
Advertisements
This entry was posted in All, Software and tagged , , , . Bookmark the permalink.

2 Responses to Using and creating Gentoo Linux repositories using Layman

  1. kfir says:

    Hi and much thanks for this post.
    I’m currently creating a local repository on my server, and the xml on the client should change.
    Please use man layman and go to section ‘OVERLAY LIST FORMAT’ and you should see the new format of the xml file. Once you do it like this, you will be able to see it when running ‘layman -L’

    Regards,
    Kfir

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s