Layman

From Gentoo Wiki
Jump to: navigation, search

Layman is Gentoo's primary overlay management tool, offering centralized repository management for end users.

Features

With app-portage/layman users can manage their overlays in a simple, centralized manner. The layman application provides an overview of available remote overlay repositories and allows the user to select one or more for the system. Once selected, the user can update the repositories (similar to emerge --sync), add local overlays, and more.

Using layman

Installing layman

Installing layman is a breeze. First check the USE flags that the layman package supports; most of the USE flags trigger which kinds of remote repository types layman supports (such as git repositories, cvs repositories ...).

USE flag (what is that?) Default Recommended Description
bazaar No Support for dev-vcs/bzr based overlays.
cvs No Enable CVS (Concurrent Versions System) integration
darcs No Support dev-cvs/darcs based overlays
g-sorcery No Support app-portage/g-sorcery based overlays
git No Enable git (version control system) support
mercurial No Support dev-cvs/mercurial based overlays
squashfs No Support mounting squashfs image overlays locally read-only
subversion No Enable subversion (version control system) support

Next install the layman package:

root #emerge --ask app-portage/layman

Insert a reference to layman in /etc/portage/make.conf:

root #echo "source /var/lib/layman/make.conf" >> /etc/portage/make.conf

This will ensure that Portage, when asked, will check the content of the various overlays managed by layman. In effect, it will set the PORTDIR_OVERLAY variable, so if you already define that one in /etc/portage/make.conf, make sure that you do not overwrite the value that layman already provides.

FILE /etc/portage/make.conf Ensuring that layman's PORTDIR_OVERLAY is not overwritten
PORTDIR_OVERLAY="${PORTDIR_OVERLAY} ..."

Using layman

The layman man page (see External resources) provides a full overview of the available functions within layman. However, for most users, the following commands suffice for overlay management activities.

To fetch and display a list of all the overlays:

root #layman -L

To add an overlay in the list:

root #layman -a <name>

To remove an overlay from the local list:

root #layman -d <name>

To update a specific overlay:

root #layman -s <name>

To update all overlays:

root #layman -S

Mountable overlays

With the addition of layman-2.2.0 comes the support for squashfs overlay types. layman will interact with squashfs overlays by mounting them as read-only on the filesystem. On the initial install of the squashfs overlay, it will be mounted as read-only. However, after a reboot the overlay will no longer be mounted and the ebuilds in that overlay will not be accessible by the system.

In order to assist users in handling these mountable overlays, a utility was added that goes by the name of layman-mounter.

To find all overlays that are currently mounted, type:

root #layman-mounter -l

To find all overlays that are installed by layman that can be mounted, type:

root #layman-mounter -L

To mount the mountable overlays, type:

root #layman-mounter -m <name>

To unmount the overlays, type:

root #layman-mounter -u <name>

Setting overlay priorities with layman

As each overlay is assigned a unique priority, layman provides a simple way of defining priorities for overlays it manages. For more information about overlay priorities see the overlay article.

The file /var/lib/layman/installed.xml contains some information about the overlays, among which is the priority attribute in the repo tag. The number there determines only the priority relative to the other overlay entries, 50 is the default value. layman then analyses this file and sets the order of the overlay entries in the PORTDIR_OVERLAY variable defined in /var/lib/layman/make.conf.

As the file /var/lib/layman/make.conf is automatically generated by layman based on the settings in /var/lib/layman/installed.xml, it is strongly recommended that only /var/lib/layman/installed.xml is used to set the priorities.

To add your personal overlay, and to ensure that your overlay has a higher priority, add your overlay before /var/lib/layman/make.conf is sourced.

FILE /var/lib/layman/make.conf Example layman overlays setting
PORTDIR_OVERLAY="
/home/jdoe/gamerlay
/var/lib/layman/lisp
/var/lib/layman/Spring
${PORTDIR_OVERLAY}" #the variable defined in /etc/portage/make.conf is now expanded
                    #when /var/lib/layman/make.conf is sourced in /etc/portage/make.conf

However, this can be also "fooled" by defining the PORTDIR_OVERLAY in /etc/portage/make.conf after /var/lib/layman/make.conf has been sourced.

FILE /etc/portage/make.conf Custom overlay setting
source /var/lib/layman/make.conf #this sources the PORTDIR_OVERLAY variable defined by layman.
                                 #however, the variable expanded by layman was empty
PORTDIR_OVERLAY="/home/user/overlay ${PORTDIR} ${PORTDIR_OVERLAY}" #now the layman defined overlays take precedence,
                                                                   #but the user defined overlay still has the lowest priority

This "trick" is merely an opportunity offered by shell variable expansion.

Adding custom overlays

To add overlays which are not listed when layman -L is ran add XML files into /etc/layman/overlays. For example:

FILE /etc/layman/overlays/sarnold.xml Custom overlay
<?xml version="1.0" ?>
 
<repositories version="1.0">
	<repo priority="50" quality="experimental" status="unofficial">
		<name>sarnold</name>
		<description>Custom stuff for PPC from sarnold.</description>
		<homepage>http://github.com/sarnold/</homepage>
		<owner>
			<email>sarnold@gentoo.org</email>
		</owner>
		<source type="git">git://github.com/sarnold/portage-overlay.git</source>
	</repo>
</repositories>

NEW: With the addition of layman-2.2.0 a new utility was added to assist users in this process that goes by the name of layman-overlay-maker. As long as you know the information of the overlay that you're trying to add this utility will create the overlay XML for you and save into /etc/layman/overlays or whatever path value you have specified in the layman configuration file for overlay_defs.

layman-overlay-maker can become a useful tool in assisting users who would like to submit a patch to have their overlays added to the official repositories.xml file.

To use the utility simply invoke it by name:

root #layman-overlay-maker

and go through its prompts until completion.

When finished run:

root #layman -a <name>

See also

External resources