1 <chapter id='config-set'>
2 <title>Package Set Configuration</title>
3 <sect1 id='config-set-locations'>
4 <title>sets.conf locations</title>
6 There are multiple locations where portage looks for set configuration
7 files, which are usually named <filename>sets.conf</filename>. Not all
8 of these locations have to contain a sets.conf, missing files are simply
12 At first it reads the default configuration from all of the files
13 located in <filename>/usr/share/portage/config/sets</filename>
15 The default config includes sets that are expected on all systems and
16 often critical for normal operation, like <varname>world</varname>,
17 <varname>system</varname> or <varname>security</varname>.
18 <!-- TODO: Add reference to currently non-existing documentation about
19 set usage and default sets -->
20 After that it will read repository specific configurations from
21 <envar>PORTDIR</envar> and <envar>PORTDIR_OVERLAY</envar> that might
22 include definitions of sets included in the repository.
23 Finally a system-specific set configuration may reside in
24 <filename>/etc/portage</filename> to either define additional sets or
25 alter the default and repository sets.
29 <sect1 id='config-set-syntax'>
30 <title>sets.conf Syntax</title>
32 Unlike other Portage configuration files <filename>sets.conf</filename>
33 uses Pythons <classname>ConfigParser</classname> module, which implements
34 the syntax usually found in .ini files. At its core it allows various
35 named sections that each can contain any number of key-value pairs, see
36 the <ulink url="http://doc.python.org/lib/module-ConfigParser.html" type="text/html">Python documentation</ulink>
40 In a <filename>sets.conf</filename> file, a section can define either a
41 single package set, or a complete class of sets. These cases are handled
42 in different ways, and will be explained in detail in the following sections.
44 <sect2 id='config-set-syntax-single'>
45 <title>Single Set Configuration</title>
47 The configuration of a single set can be very simple as in most cases
48 it only requires a single option <varname>class</varname> to be
49 complete <footnote><para>Technically the <varname>class</varname> option
50 isn't strictly required, but it should always be used as the default
51 handler might be changed in future versions.</para></footnote>.
52 That option defines which handler class should be used to
53 create the set. Other universal options available for single sets are:
56 <listitem><para><varname>name</varname> (which is usually not needed as the name
57 of the set is generated from the section name if <varname>name</varname>
58 is missing)</para></listitem>
59 <listitem><para><varname>world-candidate</varname>, which determines if
60 given package should be added to the <varname>world</varname> set</para></listitem>
63 Some handler classes might require additional options for their configuration,
64 these will be covered later in this chapter.
67 Here are a few examples for single sets taken from the default
70 # The classic world set
72 class = portage.sets.base.DummyPackageSet
73 packages = @selected @system
77 class = portage.sets.files.WorldSelectedSet
79 # The classic system set
81 class = portage.sets.profiles.PackagesSystemSet
83 <!-- TODO: reference list of available set handler classes here -->
87 <sect2 id='config-set-syntax-multi'>
88 <title>Multi Set Configuration</title>
90 As configuring each single set manually could be quite annoying if
91 you want many sets with the same options Portage also allows to
92 define whole classes of sets in a single section. Like with single
93 sets each section still requires the <varname>class</varname> option,
94 but to indicate that the section should generate multiple sets it's
95 also necessary to set the <varname>multiset</varname> option to
96 <parameter>true</parameter>. The <varname>world-candidate</varname>
97 option also supported like with
98 single sets (they'll apply to all sets generated by the section).
101 As it doesn't make much sense to specify a single name for multiple sets
102 the <varname>name</varname> option isn't available for multiset sections.
103 Most handler classes will have a reasonable default for generating names,
104 and usually you can (but don't have to) set the
105 <varname>name_pattern</varname> option to change the naming rules. That
106 option generally has to include a (handler-specific) placeholder that
107 will be replaced with a unique identifier (e.g. for category sets the
108 category name). As with single sets handler classes might require and/or
109 support additional options, these will be discussed later.
112 Some examples for multiset configurations:
114 # generate a set for each file in /etc/portage/sets
115 # this section is also in the default configuration
117 class = portage.sets.files.StaticFileSet
119 directory = /etc/portage/sets
121 # Generate a set for each category that includes all installed packages
122 # from that category. The sets will be named <category>/*
123 [installed category packages]
124 class = portage.sets.dbapi.CategorySet
127 name_pattern = $category/*
130 <!-- TODO: reference list of available set handler classes here -->
134 <sect1 id='config-set-classes'>
135 <title>Available Set Handler Classes</title>
137 The following sections contain the available handler classes that can be
138 used for the <varname>class</varname> option in
139 <filename>sets.conf</filename>, together with a description about required
140 and optional configuration options for single and multi set configurations.
141 Note that not all classes support both configuration styles.
144 <sect2 id='config-set-classes-StaticFileSet' xreflabel='StaticFileSet'>
145 <title>portage.sets.files.StaticFileSet</title>
147 This class implements a simple file based package set. All atoms from
148 configured file are used to form the set, and currently only simple and
149 versioned atoms are supported (no use conditionals or any-of constructs).
150 For descriptive purposes the file can be accompanied by a file with the
151 same name plus a <filename>.metadata</filename> suffix which can contain
152 metadata sections for description, author, location and so on. Each section
153 has the form key: value where <varname>value</varname>
154 can contain multiple lines. Therefore sections have to be separated by
155 blank lines. For example:
157 description: This is a somewhat
158 longer description than usual. So it
159 needs more than one line.
161 homepage: http://www.foobar.org
163 author: John Doe <john@doe.com>
168 <title>Single Set Configuration</title>
170 In a single set configuration this class supports the following options:
173 <listitem><para><varname>filename</varname>: Required. Specifies the path to the file
174 that should be used for the package set.</para></listitem>
175 <listitem><para><varname>greedy</varname>: Optional, defaults to <parameter>false</parameter>.
176 Determines if atoms in the package should include all installed slots (when set to
177 <parameter>true</parameter>) or if no slot expansion is wanted (when set to
178 <parameter>false</parameter>). This option only affects packages that have multiple
179 slots available (e.g. <parameter>sys-kernel/gentoo-sources</parameter>).</para></listitem>
184 <title>Multi Set Configuration</title>
186 In a multi set configuration this class supports the following options:
189 <listitem><para><varname>directory</varname>: Optional, defaults to
190 <filename>/etc/portage/sets</filename>. Specifies the path to a directory
191 containing package set files. For each file (excluding metadata files) in
192 that location a separate package set is created.</para>
194 <listitem><para><varname>name_pattern</varname>: Optional, defaults to
195 <parameter>$name</parameter>. This describes the naming pattern
196 to be used for creating the sets. It must contain either
197 <parameter>$name</parameter> or <parameter>${name}</parameter>, which
198 will be replaced by the filename (without any directory components).</para>
204 <sect2 id='config-set-classes-ConfigFileSet'>
205 <title>portage.sets.files.ConfigFileSet</title>
207 Similar to <classname>StaticFileSet</classname>, but uses Portage configuration files.
208 Namely it can work with <filename>package.use</filename>,
209 <filename>package.keywords</filename>, <filename>package.mask</filename>
210 and <filename>package.unmask</filename>. It does not support
211 <filename>.metadata</filename> files, but ignores the extra data (like
212 USE flags or keywords) typically found in those files.
216 <title>Single Set Configuration</title>
218 In a single set configuration this class supports the following options:
221 <listitem><para><varname>filename</varname>: See
222 <xref linkend='config-set-classes-StaticFileSet'/>StaticFileSet</para>
228 <title>Multi Set Configuration</title>
230 In a multi set configuration this class supports the following options:
233 <listitem><para><varname>directory</varname>: Optional, defaults to
234 <filename>/etc/portage</filename>. Specifies the path to a directory
235 containing one or more of the following portage configuration files:
236 <filename>package.use</filename>, <filename>package.keywords</filename>,
237 <filename>package.mask</filename> or <filename>package.unmask</filename>.
238 No other files in that directory will be used.</para>
240 <listitem><para><varname>name_pattern</varname>: Optional, defaults to
241 <parameter>package_$suffix</parameter>. This describes the naming
242 pattern to be used for creating the sets. It must contain either
243 <parameter>$suffix</parameter> or <parameter>${suffix}</parameter>,
244 which will be replaced by the file suffix (e.g.
245 <parameter>use</parameter> or <parameter>mask</parameter>).</para>
251 <sect2 id='config-set-classes-WorldSelectedSet'>
252 <title>portage.sets.files.WorldSelectedSet</title>
254 A minor variation of <classname>StaticFileSet</classname>, mainly for implementation
255 reasons. It should never be used in user configurations as it's already configured
256 by default, doesn't support any options and will eventually be removed in a future version.
260 <title>Single Set Configuraton</title>
262 This class doesn't support any extra options.
267 <sect2 id='config-set-classes-PackagesSystemSet'>
268 <title>portage.sets.profiles.PackagesSystemSet</title>
270 This class implements the classic <parameter>system</parameter> set, based on the
271 <filename>packages</filename> files in the profile.
272 <!-- TODO: Add reference to profile documentation regarding "packages" -->
273 There is no reason to use this in a user configuration as it is already
274 confgured by default and doesn't support any options.
278 <title>Single Set Configuration</title>
280 This class doesn't support any extra options.
285 <sect2 id='config-set-classes-SecuritySet' xreflabel='SecuritySet'>
286 <title>portage.sets.security.SecuritySet</title>
288 The set created by this class contains all atoms that need to be installed
289 to apply all GLSAs in the ebuild repository, no matter if they are already
290 applied or no (it's equivalent to the <parameter>all</parameter> target of
291 glsa-check). Generally it should be avoided in configurations in favor of
292 <classname>NewAffectedSet</classname> described below.
296 <title>Single Set Configuration</title>
298 In single set configurations this class supports the following options:
301 <listitem><para><varname>use_emerge_resolver</varname>: Optional, defaults to
302 <parameter>false</parameter>. This option determines which resolver
303 strategy should be used for the set atoms. When set to
304 <parameter>true</parameter>, it will use the default emerge algorithm
305 and use the highest visible version that matches the GLSA. If set
306 to <parameter>false</parameter> it will use the default glsa-check
307 algorithm and use the lowest version that matches the GLSA and is
308 higher than the currently installed version (least change policy).</para>
314 <sect2 id='config-set-classes-NewGlsaSet'>
315 <title>portage.sets.security.NewGlsaSet</title>
317 Like <xref linkend='config-set-classes-SecuritySet'/>SecuritySet,
318 but ignores all GLSAs that were already applied or injected previously.
322 <title>Single Set Configuration</title>
324 In single set configurations this class supports the following options:
326 <listitem><para><varname>use_emerge_resolver</varname>: See
327 <xref linkend='config-set-classes-SecuritySet'/>SecuritySet</para>
334 <sect2 id='config-set-classes-NewAffectedSet'>
335 <title>portage.sets.security.NewAffectedSet</title>
337 Like <xref linkend='config-set-classes-SecuritySet'/>SecuritySet,
338 but ignores all GLSAs that were already applied or injected previously,
339 and all GLSAs that don't affect the current system. Practically there
340 should be no difference to <classname>NewGlsaSet</classname> though.
344 <title>Single Set Configuration</title>
346 In single set configurations this class supports the following options:
349 <listitem><para><varname>use_emerge_resolver</varname>: See
350 <xref linkend='config-set-classes-SecuritySet'/>SecuritySet</para>
356 <sect2 id='config-set-classes-AffectedSet'>
357 <title>portage.sets.security.AffectedSet</title>
359 Like <xref linkend='config-set-classes-SecuritySet'/>SecuritySet,
360 but ignores all GLSAs that don't affect the current system. Practically
361 there should be no difference to <classname>SecuritySet</classname> though.
365 <title>Single Set Configuration</title>
367 In single set configurations this class supports the following options:
370 <listitem><para><varname>use_emerge_resolver</varname>: See
371 <xref linkend='config-set-classes-SecuritySet'/>SecuritySet</para>
377 <sect2 id='config-set-classes-CommandOutputSet'>
378 <title>portage.sets.shell.CommandOutputSet</title>
380 As the name says, this class creates a package set based on the output of
381 a given command. The command is run once when the set is accessed
382 for the first time during the current session.
386 <title>Single Set Configuration</title>
388 In single set configurations this class supports the following options:
391 <listitem><para><varname>command</varname>: Required. Specifies the command
392 that should be executed to generate the package set. It should
393 output a newline separated list of simple and/or versioned atoms
400 <sect2 id='config-set-classes-AgeSet'>
401 <title>portage.sets.dbapi.AgeSet</title>
403 Package sets created by this class will include installed packages that
404 have been installed before / after a given date.
408 <title>Single Set Configuration</title>
410 In single set configurations this class supports the following options:
413 <listitem><para><varname>age</varname>: Optional, defaults to 7. Specifies
414 the number of days passed since installation to use as cut-off point.</para>
416 <listitem><para><varname>mode</varname>: Optional, defaults to "older". Must
417 be either "older" or "newer" to select packages installed either
418 before resp. after the cut-off-date given by <varname>age</varname>.
419 E.g. the defaults will select all installed packages that have been
420 installed more than one week ago.</para>
426 <sect2 id='config-set-classes-CategorySet'>
427 <title>portage.sets.dbapi.CategorySet</title>
429 This class simply creates a set with all packages in a given category.
433 <title>Single Set Configuration</title>
435 In single set configurations this class supports the following options:
438 <listitem><para><varname>category</varname>: Required. The name of an existing ebuild
439 category which should be used to create the package set.</para>
441 <listitem><para><varname>repository</varname>: Optional, defaults to
442 <parameter>porttree</parameter>. It determines which repository class should
443 be used to create the package set. Valid values for this option are:
444 <parameter>porttree</parameter> (normal ebuild repository),
445 <parameter>vartree</parameter> (installed package repository)
446 and <parameter>bintree</parameter> (local binary package repository).</para>
448 <listitem><para><varname>only_visible</varname>: Optional, defaults to <parameter>true</parameter>.
449 When set to <parameter>true</parameter> the set will only include visible packages,
450 when set to <parameter>false</parameter> it will also include masked packages.
451 It's currently only effective in combination with the <parameter>porttree</parameter>
458 <title>Multi Set Configuration</title>
460 In multi set configurations this class supports the following options:
463 <listitem><para><varname>categories</varname>: Optional, defaults to all categories.
464 If set it must be a space separated list of existing ebuild categories for
465 which package sets should be created.</para>
467 <listitem><para><varname>repository</varname>: See previous section.</para></listitem>
468 <listitem><para><varname>only_visible</varname>: See previous section.</para></listitem>
469 <listitem><para><varname>name_pattern</varname>: Optional, defaults to
470 <parameter>$category/*</parameter>. This describes the naming pattern
471 to be used for creating the sets. It must contain either
472 <parameter>$category</parameter> or <parameter>${category}</parameter>, which
473 will be replaced by the category name.</para>
479 <sect2 id='config-set-classes-EverythingSet'>
480 <title>portage.sets.dbapi.EverythingSet</title>
482 A superset of the classic <parameter>world</parameter> target, a set created
483 by this class contains SLOT atoms to match all installed packages. Note that
484 use of this set makes it impossible for emerge to solve blockers by automatic
485 uninstallation of blocked packages.
489 <title>Single Set Configuration</title>
491 This class doesn't support any extra options.
495 <sect2 id='config-set-classes-OwnerSet'>
496 <title>portage.sets.dbapi.OwnerSet</title>
498 Package set which contains all packages
499 that own one or more files.
500 This class supports the following options:
503 <listitem><para><varname>files</varname>: Required. A list of file paths
504 that should be used to create the package set.</para>
508 <sect2 id='config-set-classes-VariableSet'>
509 <title>portage.sets.dbapi.VariableSet</title>
511 Package set which contains all packages
512 that match specified values of specified variable.
513 This class supports the following options:
516 <listitem><para><varname>variable</varname>: The name of
517 the specified variable whose values are checked.</para>
519 <listitem><para><varname>includes</varname>: A list of
520 values that must be contained within the specified
523 <listitem><para><varname>excludes</varname>: A list of
524 values that must not be contained within the specified
527 <listitem><para><varname>metadata-source</varname>: Optional, defaults to
528 "vartree". Specifies the repository to use for getting the metadata
529 to check.</para></listitem>
532 <sect2 id='config-set-classes-UnavailableSet'>
533 <title>portage.sets.dbapi.UnavailableSet</title>
535 Package set which contains all installed
536 packages for which there are no visible ebuilds
537 corresponding to the same $CATEGORY/$PN:$SLOT.
538 This class supports the following options:
541 <listitem><para><varname>metadata-source</varname>: Optional, defaults to
542 "porttree". Specifies the repository to use for getting the metadata
543 to check.</para></listitem>
546 <sect2 id='config-set-classes-DowngradeSet'>
547 <title>portage.sets.dbapi.DowngradeSet</title>
549 Package set which contains all packages
550 for which the highest visible ebuild version is lower than
551 the currently installed version.
552 This class doesn't support any extra options.
555 <sect2 id='config-set-classes-PreservedLibraryConsumerSet'>
556 <title>portage.sets.libs.PreservedLibraryConsumerSet</title>
558 A special set used to rebuild all packages that need a preserved library that only
559 remains due to <varname>FEATURES="preserve-libs"</varname>.
563 <title>Single Set Configuration</title>
565 This class supports the following option:
568 <listitem><para><varname>debug</varname>: Generate extra output useful to figure out why
569 certain packages are included in the set, as it's not always obvious.</para>
576 <sect1 id='config-set-defaults'>
577 <title>Default Sets</title>
579 By default, Portage already creates a few default sets that can be used
580 without further configuration. See <xref linkend='config-set-locations'/>
581 and <xref linkend='config-set-syntax'/> for details on how to change those
585 The default sets are:
588 <listitem><para><varname>world</varname>: uses <classname>DummySet</classname></para></listitem>
589 <listitem><para><varname>selected</varname>: uses <classname>WorldSelectedSet</classname></para></listitem>
590 <listitem><para><varname>system</varname>: uses <classname>PackagesSystemSet</classname></para></listitem>
591 <listitem><para><varname>security</varname>: uses <classname>NewAffectedSet</classname> with default options</para></listitem>
592 <listitem><para><varname>installed</varname>: uses <classname>EverythingSet</classname></para></listitem>
593 <listitem><para><varname>preserved-rebuild</varname>: uses <classname>PreservedLibraryConsumerSet</classname></para></listitem>
594 <listitem><para><varname>live-rebuild</varname>: uses <classname>VariableSet</classname></para></listitem>
595 <listitem><para><varname>module-rebuild</varname>: uses <classname>OwnerSet</classname></para></listitem>
596 <listitem><para><varname>downgrade</varname>: uses <classname>DowngradeSet</classname></para></listitem>
597 <listitem><para><varname>unavailable</varname>: uses <classname>UnavailableSet</classname></para></listitem>
599 <para>Additionally the default configuration includes a multi set section based on
600 the <classname>StaticFileSet</classname> defaults that creates a set for each
601 file in <filename>/etc/portage/sets</filename> for convenience.</para>