Repository Configuration

Revision as of 05:52, July 19, 2015 by Drobbins (Talk | contribs) (New repository layout)

Warning

This article is a work-in-progress referring to a future Portage version. It does not apply to the current Funtoo Portage version. Please do not update your configuration yet.

Starting with Portage-2.3.8, a switch to a new repository configuration framework is complete and users may want to update their configuration files. This document aims to describe the goals for the new framework and how to use it.

Repository layout design

One of the most important changes is the switch from the old overlay layout to a new cleaner repository system. The new layout is more flexible and more predictable. For example, repositories can now use resources (eclasses, for example) provided by other repositories. (Editor: How?)

The old layout was based on the concept of one main tree and optionally a number of overlays. The main tree provided base system ebuilds, eclasses, profiles, while overlays mostly were able to provide their own ebuilds. The ebuild provided by overlays overrode the ebuilds in main tree to the extent of making it impossible to install the main tree version. Overlays could also provide eclasses for their own ebuilds and package.* entries that applied to all overlays and to the main tree. The Package Manager is responsible for updating the main tree, while overlays are managed externally.

The new layout is based on the concept of one or more configurable repositories. Each repository can either be stand-alone or depend upon other repositories. Users can install more repositories at they will, the repositories providing their own ebuilds, eclasses and profiles as necessary and/or using them from other repositories. Users can explicitly choose the repository they want to install packages from. The Package Manager can update all repositories.

Portage configuration

New repository layout

The repository configuration should be stored in /etc/portage/repos.conf. It can be either a single file or a directory containing one or more .conf files.

The default configuration is installed as /usr/share/portage/config/repos.conf. This file is internal configuration file installed with portage ebuild and should not be modified. Instead, the configuration in /etc/portage/repos.conf can override the defaults specified there.

The configuration uses format similar to Windows .ini files. Each section heading (repository name in square brackets) signifies a single repository, followed by one or more key-value option pairs. For example, the following file copies default configuration for Funtoo repository:

/etc/portage/repos.conf/gentoo.conf - Example configuration
[gentoo]
location = /usr/portage
sync-type = git
sync-uri = git://github.com/funtoo/ports-2012.git
auto-sync = yes

All repos.conf configuration options are listed below. Note that in the configuration file, hyphens are used instead of underscores for configuration variables -- the options below are listed using underscores, because that is how Portage stores these options internally.

{{2Col|eclass_overrides|Primarily intended for use by eclass developers, this allows one to specify another repository to look for eclasses to satisfy eclass references for ebuilds in this repository. Portage will look in the specified override repository and use the eclass if it exists; if not found, it will use the eclass in this repository. This setting can also be placed in the [DEFAULT]} section to override eclasses for all repositories.

OptionDescription
aliasesOther names that can be used to refer to this repository.
auto_syncSpecifies whether emerge --sync should update the repository. Defaults to yes if sync-type is specified, no otherwise.
forceCan contain 'eclass-overrides', 'alias', 'masters'
formatCurrently unused.
locationObligatory. Specifies the directory where repository is/will be stored. If Portage knows how to sync the repository and the location does not exist, it will be created on next emerge --sync. Otherwise, the directory must exist.
masters
prioritySpecifies the priority used for ordering ebuilds from different repositories. If two repositories provide an ebuild with matching versions, the repository with higher priority will be used.
sync_cvs_repo
sync_depthSpecifies --depth for git clone. Used only on initial sync. Defaults to 1. Can be set to 0 to force full clone (not pass --depth at all).
sync_typeSpecifies syncing/update method. Can be one of: cvs, git, rsync, svn.
sync_umaskSpecifies the umask used when updating/syncing the repository.
sync_uriSpecifies remote URI from which the repository will be cloned/synced. Can use any syntax valid for a particular syncing method.
sync_userSpecifies the user:group used to update/sync the repository. If FEATURES="usersync" is used, then defaults to the credentials of the directory owner.

Additionally a [DEFAULT] section may be specified. Options in this section are used as defaults for all repositories.

Internals

Additionally, the following options are available, or exist internally as part of the new repository configuration. Note that internally in Portage, repository configuration variables use intermediate underscores, but in configuration files, hyphens are used instead. Many of these need to be documented:

_eapis_banned
_eapis_deprecated
_masters_orig
allow_missing_manifestOption that allows the repository to be happy even if Manifest files are missing.
allow_provide_virtualAppears to have no function at the moment.
cache_formats
create_manifestEnables 'allow_create" in Manifest object which presumably allows Manifests to be created.
disable_manifestInternal feature that disables parsing of Manifest file at all, by enabling "from_scratch" in Manifest object.
eapi
eclass_dbInitialized to a portage.eclass_cache.cache object that allows Portage to resolve eclasses for this repository.
eclass_locations
find_invalid_path_charA python function used to find invalid paths?
local_configIndicates whether there is local repos.conf configuration that applies to this repository.
manifest_hashes
main_repo
missing_repo_name
nameThe name of the repository from the configuration file; i.e. "gentoo".
profile_formatsDefaults to '(portage-2)' (a tuple)
portage1_profiles
portage1_profiles_compat
sign_commit
sign_manifest
thin_manifestWhether or not the repository supports "thin" manifests, i.e. "mini-manifests" -- Manifests without entries for local files.
update_changelog
user_locationAppears to be the same as location, with symlinks resolved.

Migrating existing configurations

The new configuration format provides replacement for existing configuration done through /etc/portage/make.conf and environment variables. While the variables are still supported for backwards compatibility, users are recommended to move to the new configuration scheme. Funtoo portage ebuild is planned to make the migration unattended (repos.conf installed automatically to ease the config steps) with the following file:

/etc/portage/repos.conf/gentoo.conf
[gentoo]
location = /usr/portage
sync-type = git
sync-uri = git://github.com/funtoo/ports-2012.git
auto-sync = yes

The following replacements are provided for existing variables:

PORTDIRUsed to specify main tree location. Replaced by location key in the section corresponding to the default repository ([gentoo] by default).
PORTDIR_OVERLAYUsed to specify locations of overlays. Each of the paths needs to be replaced with a separate repository section, with the path placed in location key. Additionally, priority may be used to force specific ordering of ebuild overrides.
SYNCUsed to specify URI for syncing the main repository, also implied a protocol for doing that. Replaced by the sync-uri and sync-type keys in the default repository section.
SYNC_UMASKUsed to specify umask for syncing repositories. Replaced by sync-umask key in repository configuration. Can be specified in [DEFAULT] section to apply to all repositories.
SYNC_USERUsed to specify user credentials for syncing repositories. Replaced by sync-user key in repository configuration. Can be specified in [DEFAULT] section to apply to all repositories.
/etc/portage/make.conf - Example old make.conf file
# user changed PORTDIR location
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/root/git/foo /root/git/bar"

SYNC="git://github.com/funtoo/ports-2012.git"
SYNC_USER="oleg"
SYNC_UMASK="022"
/etc/portage/repos.conf - Replacement repos.conf file
[DEFAULT]
sync-user = oleg
sync-umask = 022

[gentoo]
location = /usr/portage
sync-type = git
sync-uri = git://github.com/funtoo/ports-2012.git

[foo]
location = /root/git/foo
priority = 1

[bar]
location = /root/git/bar
priority = 2

Notice a [foo] and [bar]. This is a repository name. Let's take a look in /root/git/foo/profiles/repo_name.

# cat /root/git/foo/profiles/repo_name
foo
# cat /root/git/bar/profiles/repo_name
bar

The repos.conf configuration can be further extended with sync-type and sync-uri for overlays to get emerge --sync updating them automatically.

Let's see a real example of tree and overlays added.

/etc/portage/repos.conf - Replacement repos.conf file
[gentoo]
location = /usr/portage
sync-type = git
sync-uri = git://github.com/funtoo/ports-2012.git
 
[funtoo-overlay]
location = /root/git/funtoo-overlay
 
[funtoo-gnome]
location = /root/git/funtoo-gnome-overlay

funtoo-overlay and funtoo-gnome-overlay are an overlays added on top of regular portage tree. How to migrate? Portage ebuild is made to perform unattended migration. /etc/portage/repos.conf/gentoo.conf automatically created. Also, it trying to detect existing overlays and change repos.conf accordingly and ask users to run dispatch-conf or etc-update for configuration file update.