root/masterdriverz/use-expand/doc/config.rst @ marienz%2540gentoo.org-20061115010443-289fa95681831945

Revision marienz%2540gentoo.org-20061115010443-289fa95681831945, 8.2 kB (checked in by Marien Zwart <marienz@…>, 2 years ago)

Update documentation.

Line 
1=====================
2 Configuring pkgcore
3=====================
4
5Note for portage users
6======================
7
8If you already know how to configure portage you can probably just
9skip this file. As long as you do not have an /etc/pkgcore.conf or
10~/.pkgcore.conf pkgcore will read portages configuration files.
11
12Basics, querying
13================
14
15There are multiple ways to configure pkgcore. No matter which method
16you pick, the pconfig utility will allow you to check if pkgcore
17interprets the configuration the way you intend. Part of a
18configuration dump could look like::
19
20 $ pconfig dump
21 <lots of output snipped>
22
23 '/usr/local/portage/private' {
24     # typename of this section: repo
25     class pkgcore.ebuild.repository.UnconfiguredTree;
26     # type: refs:cache
27     cache {
28         # typename of this section: cache
29         class pkgcore.cache.flat_hash.database;
30 <some stuff snipped>
31         # type: str
32         label '/usr/local/portage/private';
33         # type: str
34         location '/var/cache/edb/dep';
35     };
36     # type: list
37     default_mirrors 'http://ftp.easynet.nl/mirror/gentoo//distfiles';
38     # type: ref:eclass_cache
39     eclass_cache 'eclass stack';
40     # type: str
41     location '/usr/local/portage/private';
42 }
43 <lots of output snipped>
44
45Starting at the top this means there is a "repo" known to pkgcore as
46"/usr/local/portage/private", of the class
47"pkgcore.ebuild.repository.UnconfiguredTree". The "repo" type means it
48is something containing packages. The "class" means that this
49particular repo contains unbuilt ebuilds. Below that are various
50parameters specific to this class. The "type" comment tells you how
51the argument is interpreted (this depends on the class).
52
53The first is "cache". This is a nested section: it defines a new
54object of the type "cache", class "pkgcore.cache.flat_hash.database".
55Below that are the parameters given to this cache class. It is import
56to understand that the ebuild repository does not care about the exact
57class of the cache. All it needs is one or more things of type
58"cache". There could have been some db-based cache here for example.
59
60The next argument to the repo is "default_mirrors" which is handled as
61a list of strings. "location" is a single string.
62
63"eclass_cache" is a section reference pointing to the named section
64"eclass stack" defined elsewhere in the dump (omitted here).
65
66If your configuration defines a section that does not show up in
67dump you can use uncollapsable to figure out why::
68
69 $ pconfig uncollapsable
70 Collapsing section named 'ebuild-repo-common':
71 type pkgcore.ebuild.repository.UnconfiguredTree needs settings for 'location'
72
73 Collapsing section named 'cache-common':
74 type pkgcore.cache.flat_hash.database needs settings for 'label'
75
76Unfortunately the configuration system cannot distinguish between
77sections that are only meant as a base for other sections and actual
78configuration mistakes. The messages you see here are harmless. If you
79are debugging a missing section you should look for "Collapsing
80section named 'the-broken-section'" in the output.
81
82Portage compatibility mode
83==========================
84
85If you do not have a global (/etc/pkgcore.conf) or local
86(~/.pkgcore.conf) configuration file pkgcore will automatically fall
87back to reading make.conf and the other portage configuration files.
88A noticable difference is pkgcore does not support picking up
89variables like USE from the environment. Apart from that things should
90just work the way you're used to.
91
92Beyond portage compatibility mode
93=================================
94
95Basics
96------
97
98If you want to define extra repositories pkgcore should know about but
99portage should not you will need a minimal configuration file. pkgcore
100reads two configuration files: ~/.pkgcore.conf and /etc/pkgcore.conf.
101Settings in the former override the ones in the latter.
102
103If one of them exists this completely disables portage configuration
104file parsing. The first thing you will probably want to do is
105re-enable that, by putting in one of the configuration files::
106
107 [autoload-portage]
108 class=pkgcore.ebuild.portage_conf.config_from_make_conf
109
110If you then run pconfig dump you should see among other things::
111
112 'autoload-portage' {
113    # typename of this section: configsection
114    class pkgcore.ebuild.portage_conf.config_from_make_conf;
115 }
116
117Section names are usually arbitrary but sections that load extra
118configuration data are an exception: they have to start with
119"autoload" or they will not be processed. If you change the section
120name to just "portage" you will still see it show up in pconfig dump
121but all other things defined in make.conf will disappear.
122
123pconfig can tell you what arguments a class takes::
124
125 $ pconfig describe-class pkgcore.config.basics.parse_config_file
126 typename is configsection
127
128 parser: callable (required)
129 path: str (required)
130
131If you wanted to remove the overlay mentioned at the top of this
132document from make.conf but keep it available to pkgcore you would
133add::
134
135 [/usr/local/portage/private]
136 class=pkgcore.ebuild.repository.UnconfiguredTree
137 cache=private-cache
138 default_mirrors='http://ftp.easynet.nl/mirror/gentoo//distfiles'
139 eclass_cache='eclass stack'
140 location='/usr/local/portage/private'
141
142 [private-cache]
143 class=pkgcore.cache.flat_hash.database
144 ; All the stuff snipped earlier
145 label='/usr/local/portage/private'
146 location='/var/cache/edb/dep'
147
148Because the ini file format does not allow nesting sections we had to
149put the cache in a named section and refer to that. The dump output
150will reflect this but everything else will work just like it did
151before.
152
153Inherits
154--------
155
156If you have a lot of those overlays you can avoid repeating the common
157bits::
158
159 [stuff-common-to-repos]
160 class=pkgcore.ebuild.repository.UnconfiguredTree
161 default_mirrors='http://ftp.easynet.nl/mirror/gentoo//distfiles'
162 eclass_cache='eclass stack'
163
164 [/usr/local/portage/private]
165 inherit=stuff-common-to-repos
166 location='/usr/local/portage/private'
167 cache=private-cache
168
169 [/usr/local/portage/other-overlay]
170 inherit=stuff-common-to-repos
171 location='/usr/local/portage/other-overlay'
172 cache=other-overlay-cache
173
174 ; And do the same thing for the caches.
175
176There is nothing special about sections used as target for "inherit".
177They can be complete sections, although they do not have to be. That
178is why pconfig uncollapsable will mention the "stuff-common-to-repos"
179section: it is uncollapsable (because it misses the "location" and
180"cache" settings) and pconfig cannot know that is intentional (it is
181possible to use a section as both an inherit target and a standalone
182section, in which case you *would* want to know why it is not
183collapsable).
184
185Actually the portage emulation mode uses inherit targets too, so you
186could just have inherited "ebuild-repo-common". Inherit targets do not
187have to live in the same file as they are inherited from.
188
189One last special features: things marked as "incremental" get their
190inherited value appended instead of overriding it.
191
192Different config format
193-----------------------
194
195If you have pyparsing installed pkgcore supports a second
196configuration file format that is very similar to the dump output
197(not entirely identical: the string escaping rules are different). It
198does not try to detect what format your config file is in:
199pkgcore.conf is always in "ini" format. But you can load a second
200configuration file from there::
201
202 [autoload-dhcpformat]
203 class=pkgcore.config.parse_config_file
204 parser=pkgcore.config.dhcpformat.config_from_file
205 path=/home/<you>/.pkgcore.dhcpconf
206
207If you use "pkgcore.config.cparser.config_from_file" as "parser" you
208can use this to load a second ini-style file. The loaded file can also
209contain autoloads of its own, loading more config files or
210portage_conf. For example, if .pkgcore.dhcpconf looks like::
211
212 "autoload-portage" {
213     class pkgcore.ebuild.portage_conf.config_from_make_conf;
214 }
215
216it will load make.conf.
217
218If you want to get rid of make.conf entirely you can start from the
219output of pconfig dump. But be careful: pconfig does not escape
220strings exactly the same way dhcpformat parses them, so make sure you
221check the dump after you disable portage_conf for mistakes.
222
223Aliases
224-------
225
226You may have seen something called "section_alias" in a portage
227compatibility configuration. These are used to make an existing named
228section show up under a second name. You probably do not need them if
229you write your own configuration.
Note: See TracBrowser for help on using the browser.