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 configurations located in repositories
21 configured in <filename>repos.conf</filename>.
22 Finally a system-specific set configuration may reside in
23 <filename>/etc/portage</filename> to either define additional sets or
24 alter the default and repository sets.
28 <sect1 id='config-set-syntax'>
29 <title>sets.conf Syntax</title>
31 Unlike other Portage configuration files <filename>sets.conf</filename>
32 uses Pythons <classname>ConfigParser</classname> module, which implements
33 the syntax usually found in .ini files. At its core it allows various
34 named sections that each can contain any number of key-value pairs, see
35 the <ulink url="http://doc.python.org/lib/module-ConfigParser.html" type="text/html">Python documentation</ulink>
39 In a <filename>sets.conf</filename> file, a section can define either a
40 single package set, or a complete class of sets. These cases are handled
41 in different ways, and will be explained in detail in the following sections.
43 <sect2 id='config-set-syntax-single'>
44 <title>Single Set Configuration</title>
46 The configuration of a single set can be very simple as in most cases
47 it only requires a single option <varname>class</varname> to be
48 complete <footnote><para>Technically the <varname>class</varname> option
49 isn't strictly required, but it should always be used as the default
50 handler might be changed in future versions.</para></footnote>.
51 That option defines which handler class should be used to
52 create the set. Other universal options available for single sets are:
55 <listitem><para><varname>name</varname> (which is usually not needed as the name
56 of the set is generated from the section name if <varname>name</varname>
57 is missing)</para></listitem>
58 <listitem><para><varname>world-candidate</varname>, which determines if
59 given package should be added to the <varname>world</varname> set</para></listitem>
62 Some handler classes might require additional options for their configuration,
63 these will be covered later in this chapter.
66 Here are a few examples for single sets taken from the default
69 # The classic world set
71 class = portage.sets.base.DummyPackageSet
72 packages = @selected @system
76 class = portage.sets.files.WorldSelectedSet
78 # The classic system set
80 class = portage.sets.profiles.PackagesSystemSet
82 <!-- TODO: reference list of available set handler classes here -->
86 <sect2 id='config-set-syntax-multi'>
87 <title>Multi Set Configuration</title>
89 As configuring each single set manually could be quite annoying if
90 you want many sets with the same options Portage also allows to
91 define whole classes of sets in a single section. Like with single
92 sets each section still requires the <varname>class</varname> option,
93 but to indicate that the section should generate multiple sets it's
94 also necessary to set the <varname>multiset</varname> option to
95 <parameter>true</parameter>. The <varname>world-candidate</varname>
96 option also supported like with
97 single sets (they'll apply to all sets generated by the section).
100 As it doesn't make much sense to specify a single name for multiple sets
101 the <varname>name</varname> option isn't available for multiset sections.
102 Most handler classes will have a reasonable default for generating names,
103 and usually you can (but don't have to) set the
104 <varname>name_pattern</varname> option to change the naming rules. That
105 option generally has to include a (handler-specific) placeholder that
106 will be replaced with a unique identifier (e.g. for category sets the
107 category name). As with single sets handler classes might require and/or
108 support additional options, these will be discussed later.
111 Some examples for multiset configurations:
113 # generate a set for each file in /etc/portage/sets
114 # this section is also in the default configuration
116 class = portage.sets.files.StaticFileSet
118 directory = /etc/portage/sets
120 # Generate a set for each category that includes all installed packages
121 # from that category. The sets will be named <category>/*
122 [installed category packages]
123 class = portage.sets.dbapi.CategorySet
126 name_pattern = $category/*
129 <!-- TODO: reference list of available set handler classes here -->
133 <sect1 id='config-set-classes'>
134 <title>Available Set Handler Classes</title>
136 The following sections contain the available handler classes that can be
137 used for the <varname>class</varname> option in
138 <filename>sets.conf</filename>, together with a description about required
139 and optional configuration options for single and multi set configurations.
140 Note that not all classes support both configuration styles.
143 <sect2 id='config-set-classes-StaticFileSet' xreflabel='StaticFileSet'>
144 <title>portage.sets.files.StaticFileSet</title>
146 This class implements a simple file based package set. All atoms from
147 configured file are used to form the set, and currently only simple and
148 versioned atoms are supported (no use conditionals or any-of constructs).
149 For descriptive purposes the file can be accompanied by a file with the
150 same name plus a <filename>.metadata</filename> suffix which can contain
151 metadata sections for description, author, location and so on. Each section
152 has the form key: value where <varname>value</varname>
153 can contain multiple lines. Therefore sections have to be separated by
154 blank lines. For example:
156 description: This is a somewhat
157 longer description than usual. So it
158 needs more than one line.
160 homepage: http://www.foobar.org
162 author: John Doe <john@doe.com>
167 <title>Single Set Configuration</title>
169 In a single set configuration this class supports the following options:
172 <listitem><para><varname>filename</varname>: Required. Specifies the path to the file
173 that should be used for the package set.</para></listitem>
174 <listitem><para><varname>greedy</varname>: Optional, defaults to <parameter>false</parameter>.
175 Determines if atoms in the package should include all installed slots (when set to
176 <parameter>true</parameter>) or if no slot expansion is wanted (when set to
177 <parameter>false</parameter>). This option only affects packages that have multiple
178 slots available (e.g. <parameter>sys-kernel/gentoo-sources</parameter>).</para></listitem>
183 <title>Multi Set Configuration</title>
185 In a multi set configuration this class supports the following options:
188 <listitem><para><varname>directory</varname>: Optional, defaults to
189 <filename>/etc/portage/sets</filename>. Specifies the path to a directory
190 containing package set files. For each file (excluding metadata files) in
191 that location a separate package set is created.</para>
193 <listitem><para><varname>name_pattern</varname>: Optional, defaults to
194 <parameter>$name</parameter>. This describes the naming pattern
195 to be used for creating the sets. It must contain either
196 <parameter>$name</parameter> or <parameter>${name}</parameter>, which
197 will be replaced by the filename (without any directory components).</para>
203 <sect2 id='config-set-classes-ConfigFileSet'>
204 <title>portage.sets.files.ConfigFileSet</title>
206 Similar to <classname>StaticFileSet</classname>, but uses Portage configuration files.
207 Namely it can work with <filename>package.use</filename>,
208 <filename>package.keywords</filename>, <filename>package.mask</filename>
209 and <filename>package.unmask</filename>. It does not support
210 <filename>.metadata</filename> files, but ignores the extra data (like
211 USE flags or keywords) typically found in those files.
215 <title>Single Set Configuration</title>
217 In a single set configuration this class supports the following options:
220 <listitem><para><varname>filename</varname>: See
221 <xref linkend='config-set-classes-StaticFileSet'/>StaticFileSet</para>
227 <title>Multi Set Configuration</title>
229 In a multi set configuration this class supports the following options:
232 <listitem><para><varname>directory</varname>: Optional, defaults to
233 <filename>/etc/portage</filename>. Specifies the path to a directory
234 containing one or more of the following portage configuration files:
235 <filename>package.use</filename>, <filename>package.keywords</filename>,
236 <filename>package.mask</filename> or <filename>package.unmask</filename>.
237 No other files in that directory will be used.</para>
239 <listitem><para><varname>name_pattern</varname>: Optional, defaults to
240 <parameter>package_$suffix</parameter>. This describes the naming
241 pattern to be used for creating the sets. It must contain either
242 <parameter>$suffix</parameter> or <parameter>${suffix}</parameter>,
243 which will be replaced by the file suffix (e.g.
244 <parameter>use</parameter> or <parameter>mask</parameter>).</para>
250 <sect2 id='config-set-classes-WorldSelectedSet'>
251 <title>portage.sets.files.WorldSelectedSet</title>
253 A minor variation of <classname>StaticFileSet</classname>, mainly for implementation
254 reasons. It should never be used in user configurations as it's already configured
255 by default, doesn't support any options and will eventually be removed in a future version.
259 <title>Single Set Configuraton</title>
261 This class doesn't support any extra options.
266 <sect2 id='config-set-classes-PackagesSystemSet'>
267 <title>portage.sets.profiles.PackagesSystemSet</title>
269 This class implements the classic <parameter>system</parameter> set, based on the
270 <filename>packages</filename> files in the profile.
271 <!-- TODO: Add reference to profile documentation regarding "packages" -->
272 There is no reason to use this in a user configuration as it is already
273 confgured by default and doesn't support any options.
277 <title>Single Set Configuration</title>
279 This class doesn't support any extra options.
284 <sect2 id='config-set-classes-SecuritySet' xreflabel='SecuritySet'>
285 <title>portage.sets.security.SecuritySet</title>
287 The set created by this class contains all atoms that need to be installed
288 to apply all GLSAs in the ebuild repository, no matter if they are already
289 applied or no (it's equivalent to the <parameter>all</parameter> target of
290 glsa-check). Generally it should be avoided in configurations in favor of
291 <classname>NewAffectedSet</classname> described below.
295 <title>Single Set Configuration</title>
297 In single set configurations this class supports the following options:
300 <listitem><para><varname>use_emerge_resolver</varname>: Optional, defaults to
301 <parameter>false</parameter>. This option determines which resolver
302 strategy should be used for the set atoms. When set to
303 <parameter>true</parameter>, it will use the default emerge algorithm
304 and use the highest visible version that matches the GLSA. If set
305 to <parameter>false</parameter> it will use the default glsa-check
306 algorithm and use the lowest version that matches the GLSA and is
307 higher than the currently installed version (least change policy).</para>
313 <sect2 id='config-set-classes-NewGlsaSet'>
314 <title>portage.sets.security.NewGlsaSet</title>
316 Like <xref linkend='config-set-classes-SecuritySet'/>SecuritySet,
317 but ignores all GLSAs that were already applied or injected previously.
321 <title>Single Set Configuration</title>
323 In single set configurations this class supports the following options:
325 <listitem><para><varname>use_emerge_resolver</varname>: See
326 <xref linkend='config-set-classes-SecuritySet'/>SecuritySet</para>
333 <sect2 id='config-set-classes-NewAffectedSet'>
334 <title>portage.sets.security.NewAffectedSet</title>
336 Like <xref linkend='config-set-classes-SecuritySet'/>SecuritySet,
337 but ignores all GLSAs that were already applied or injected previously,
338 and all GLSAs that don't affect the current system. Practically there
339 should be no difference to <classname>NewGlsaSet</classname> though.
343 <title>Single Set Configuration</title>
345 In single set configurations this class supports the following options:
348 <listitem><para><varname>use_emerge_resolver</varname>: See
349 <xref linkend='config-set-classes-SecuritySet'/>SecuritySet</para>
355 <sect2 id='config-set-classes-AffectedSet'>
356 <title>portage.sets.security.AffectedSet</title>
358 Like <xref linkend='config-set-classes-SecuritySet'/>SecuritySet,
359 but ignores all GLSAs that don't affect the current system. Practically
360 there should be no difference to <classname>SecuritySet</classname> though.
364 <title>Single Set Configuration</title>
366 In single set configurations this class supports the following options:
369 <listitem><para><varname>use_emerge_resolver</varname>: See
370 <xref linkend='config-set-classes-SecuritySet'/>SecuritySet</para>
376 <sect2 id='config-set-classes-CommandOutputSet'>
377 <title>portage.sets.shell.CommandOutputSet</title>
379 As the name says, this class creates a package set based on the output of
380 a given command. The command is run once when the set is accessed
381 for the first time during the current session.
385 <title>Single Set Configuration</title>
387 In single set configurations this class supports the following options:
390 <listitem><para><varname>command</varname>: Required. Specifies the command
391 that should be executed to generate the package set. It should
392 output a newline separated list of simple and/or versioned atoms
399 <sect2 id='config-set-classes-AgeSet'>
400 <title>portage.sets.dbapi.AgeSet</title>
402 Package sets created by this class will include installed packages that
403 have been installed before / after a given date.
407 <title>Single Set Configuration</title>
409 In single set configurations this class supports the following options:
412 <listitem><para><varname>age</varname>: Optional, defaults to 7. Specifies
413 the number of days passed since installation to use as cut-off point.</para>
415 <listitem><para><varname>mode</varname>: Optional, defaults to "older". Must
416 be either "older" or "newer" to select packages installed either
417 before resp. after the cut-off-date given by <varname>age</varname>.
418 E.g. the defaults will select all installed packages that have been
419 installed more than one week ago.</para>
425 <sect2 id='config-set-classes-CategorySet'>
426 <title>portage.sets.dbapi.CategorySet</title>
428 This class simply creates a set with all packages in a given category.
432 <title>Single Set Configuration</title>
434 In single set configurations this class supports the following options:
437 <listitem><para><varname>category</varname>: Required. The name of an existing ebuild
438 category which should be used to create the package set.</para>
440 <listitem><para><varname>repository</varname>: Optional, defaults to
441 <parameter>porttree</parameter>. It determines which repository class should
442 be used to create the package set. Valid values for this option are:
443 <parameter>porttree</parameter> (normal ebuild repository),
444 <parameter>vartree</parameter> (installed package repository)
445 and <parameter>bintree</parameter> (local binary package repository).</para>
447 <listitem><para><varname>only_visible</varname>: Optional, defaults to <parameter>true</parameter>.
448 When set to <parameter>true</parameter> the set will only include visible packages,
449 when set to <parameter>false</parameter> it will also include masked packages.
450 It's currently only effective in combination with the <parameter>porttree</parameter>
457 <title>Multi Set Configuration</title>
459 In multi set configurations this class supports the following options:
462 <listitem><para><varname>categories</varname>: Optional, defaults to all categories.
463 If set it must be a space separated list of existing ebuild categories for
464 which package sets should be created.</para>
466 <listitem><para><varname>repository</varname>: See previous section.</para></listitem>
467 <listitem><para><varname>only_visible</varname>: See previous section.</para></listitem>
468 <listitem><para><varname>name_pattern</varname>: Optional, defaults to
469 <parameter>$category/*</parameter>. This describes the naming pattern
470 to be used for creating the sets. It must contain either
471 <parameter>$category</parameter> or <parameter>${category}</parameter>, which
472 will be replaced by the category name.</para>
478 <sect2 id='config-set-classes-EverythingSet'>
479 <title>portage.sets.dbapi.EverythingSet</title>
481 A superset of the classic <parameter>world</parameter> target, a set created
482 by this class contains SLOT atoms to match all installed packages. Note that
483 use of this set makes it impossible for emerge to solve blockers by automatic
484 uninstallation of blocked packages.
488 <title>Single Set Configuration</title>
490 This class doesn't support any extra options.
494 <sect2 id='config-set-classes-OwnerSet'>
495 <title>portage.sets.dbapi.OwnerSet</title>
497 Package set which contains all packages
498 that own one or more files.
499 This class supports the following options:
502 <listitem><para><varname>files</varname>: Required. A list of file paths
503 that should be used to create the package set.</para>
507 <sect2 id='config-set-classes-VariableSet'>
508 <title>portage.sets.dbapi.VariableSet</title>
510 Package set which contains all packages
511 that match specified values of specified variable.
512 This class supports the following options:
515 <listitem><para><varname>variable</varname>: The name of
516 the specified variable whose values are checked.</para>
518 <listitem><para><varname>includes</varname>: A list of
519 values that must be contained within the specified
522 <listitem><para><varname>excludes</varname>: A list of
523 values that must not be contained within the specified
526 <listitem><para><varname>metadata-source</varname>: Optional, defaults to
527 "vartree". Specifies the repository to use for getting the metadata
528 to check.</para></listitem>
531 <sect2 id='config-set-classes-UnavailableSet'>
532 <title>portage.sets.dbapi.UnavailableSet</title>
534 Package set which contains all installed
535 packages for which there are no visible ebuilds
536 corresponding to the same $CATEGORY/$PN:$SLOT.
537 This class supports the following options:
540 <listitem><para><varname>metadata-source</varname>: Optional, defaults to
541 "porttree". Specifies the repository to use for getting the metadata
542 to check.</para></listitem>
545 <sect2 id='config-set-classes-DowngradeSet'>
546 <title>portage.sets.dbapi.DowngradeSet</title>
548 Package set which contains all packages
549 for which the highest visible ebuild version is lower than
550 the currently installed version.
551 This class doesn't support any extra options.
554 <sect2 id='config-set-classes-PreservedLibraryConsumerSet'>
555 <title>portage.sets.libs.PreservedLibraryConsumerSet</title>
557 A special set used to rebuild all packages that need a preserved library that only
558 remains due to <varname>FEATURES="preserve-libs"</varname>.
562 <title>Single Set Configuration</title>
564 This class supports the following option:
567 <listitem><para><varname>debug</varname>: Generate extra output useful to figure out why
568 certain packages are included in the set, as it's not always obvious.</para>
575 <sect1 id='config-set-defaults'>
576 <title>Default Sets</title>
578 By default, Portage already creates a few default sets that can be used
579 without further configuration. See <xref linkend='config-set-locations'/>
580 and <xref linkend='config-set-syntax'/> for details on how to change those
584 The default sets are:
587 <listitem><para><varname>world</varname>: uses <classname>DummySet</classname></para></listitem>
588 <listitem><para><varname>selected</varname>: uses <classname>WorldSelectedSet</classname></para></listitem>
589 <listitem><para><varname>system</varname>: uses <classname>PackagesSystemSet</classname></para></listitem>
590 <listitem><para><varname>security</varname>: uses <classname>NewAffectedSet</classname> with default options</para></listitem>
591 <listitem><para><varname>installed</varname>: uses <classname>EverythingSet</classname></para></listitem>
592 <listitem><para><varname>preserved-rebuild</varname>: uses <classname>PreservedLibraryConsumerSet</classname></para></listitem>
593 <listitem><para><varname>live-rebuild</varname>: uses <classname>VariableSet</classname></para></listitem>
594 <listitem><para><varname>module-rebuild</varname>: uses <classname>OwnerSet</classname></para></listitem>
595 <listitem><para><varname>downgrade</varname>: uses <classname>DowngradeSet</classname></para></listitem>
596 <listitem><para><varname>unavailable</varname>: uses <classname>UnavailableSet</classname></para></listitem>
598 <para>Additionally the default configuration includes a multi set section based on
599 the <classname>StaticFileSet</classname> defaults that creates a set for each
600 file in <filename>/etc/portage/sets</filename> for convenience.</para>