Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13490 - in main/branches/2.1.6: man pym/portage pym/portage/dbapi
Date: Thu, 30 Apr 2009 07:06:49
Message-Id: E1LzQM3-0007MB-3B@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-04-30 07:06:46 +0000 (Thu, 30 Apr 2009)
3 New Revision: 13490
4
5 Modified:
6 main/branches/2.1.6/man/portage.5
7 main/branches/2.1.6/pym/portage/__init__.py
8 main/branches/2.1.6/pym/portage/dbapi/porttree.py
9 Log:
10 Bug #265747 - Add a new /etc/portage/repos.conf config file which can be used
11 to configure site-specific eclass override behavior. Note that configuration
12 settings which are specified here do not apply to tools such as repoman(1)
13 and egencache(1) since their operations are inherently not site-specific.
14 Beware that use of eclass-overrides is generally not recommended and that it
15 may trigger performance issues under some circumstances (see bug #124041).
16
17 Example:
18
19 # make all repositories inherit eclasses from the java-overlay and
20 # java-experimental repositories, with eclasses from java-experimental
21 # taking precedence over those from java-overlay
22 [DEFAULT]
23 eclass-overrides = java-overlay java-experimental
24
25 # disable all eclass overrides for the gentoo repository
26 [gentoo]
27 eclass-overrides = (trunk r13325)
28
29 Modified: main/branches/2.1.6/man/portage.5
30 ===================================================================
31 --- main/branches/2.1.6/man/portage.5 2009-04-30 07:06:14 UTC (rev 13489)
32 +++ main/branches/2.1.6/man/portage.5 2009-04-30 07:06:46 UTC (rev 13490)
33 @@ -54,6 +54,7 @@
34 package.mask
35 package.unmask
36 package.use
37 +repos.conf
38 .fi
39 .TP
40 .BR /etc/portage/profile/
41 @@ -545,6 +546,27 @@
42 # disable mysql support for QT
43 x11\-libs/qt \-mysql
44 .fi
45 +.TP
46 +.BR repos.conf
47 +Specifies \fIsite\-specific\fR repository configuration information. Note that
48 +configuration settings which are specified here do not apply to tools
49 +such as \fBrepoman\fR(1) and \fBegencache\fR(1) since their operations
50 +are inherently \fBnot\fR \fIsite\-specific\fR. Beware that use of
51 +\fBeclass\-overrides\fR is generally not recommended and that it may trigger
52 +performance issues under some circumstances (see \fBbug #124041\fR).
53 +
54 +.I Example:
55 +.nf
56 +# make all repositories inherit eclasses from the java\-overlay and
57 +# java\-experimental repositories, with eclasses from java\-experimental
58 +# taking precedence over those from java\-overlay
59 +[DEFAULT]
60 +eclass\-overrides = java\-overlay java\-experimental
61 +
62 +# disable all eclass overrides for ebuilds from the gentoo repository
63 +[gentoo]
64 +eclass\-overrides =
65 +.fi
66 .RE
67 .TP
68 .BR /usr/portage/metadata/
69
70 Modified: main/branches/2.1.6/pym/portage/__init__.py
71 ===================================================================
72 --- main/branches/2.1.6/pym/portage/__init__.py 2009-04-30 07:06:14 UTC (rev 13489)
73 +++ main/branches/2.1.6/pym/portage/__init__.py 2009-04-30 07:06:46 UTC (rev 13490)
74 @@ -987,6 +987,13 @@
75 regex = regex.replace("\\.\\*", ".*")
76 return regex
77
78 +class _local_repo_config(object):
79 + __slots__ = ('eclass_overrides', 'name',)
80 + def __init__(self, name, repo_opts):
81 + self.name = name
82 + self.eclass_overrides = \
83 + tuple(repo_opts.get('eclass-overrides', '').split())
84 +
85 class config(object):
86 """
87 This class encompasses the main portage configuration. Data is pulled from
88 @@ -1180,12 +1187,18 @@
89
90 self.user_profile_dir = None
91 self.local_config = local_config
92 + self._local_repo_configs = None
93 + self._local_repo_conf_path = None
94
95 if clone:
96 self.incrementals = copy.deepcopy(clone.incrementals)
97 self.profile_path = copy.deepcopy(clone.profile_path)
98 self.user_profile_dir = copy.deepcopy(clone.user_profile_dir)
99 self.local_config = copy.deepcopy(clone.local_config)
100 + self._local_repo_configs = \
101 + copy.deepcopy(clone._local_repo_configs)
102 + self._local_repo_conf_path = \
103 + copy.deepcopy(clone._local_repo_conf_path)
104
105 self.module_priority = copy.deepcopy(clone.module_priority)
106 self.modules = copy.deepcopy(clone.modules)
107 @@ -1628,6 +1641,38 @@
108 self._plicensedict[cp] = cp_dict
109 cp_dict[k] = self.expandLicenseTokens(v)
110
111 + self._local_repo_configs = {}
112 + self._local_repo_conf_path = \
113 + os.path.join(abs_user_config, 'repos.conf')
114 + from ConfigParser import SafeConfigParser, ParsingError
115 + repo_conf_parser = SafeConfigParser()
116 + try:
117 + repo_conf_parser.readfp(
118 + codecs.open(self._local_repo_conf_path,
119 + mode='r', errors='replace'))
120 + except EnvironmentError, e:
121 + if e.errno != errno.ENOENT:
122 + raise
123 + del e
124 + except ParsingError, e:
125 + portage.util.writemsg_level(
126 + "!!! Error parsing '%s': %s\n" % \
127 + (self._local_repo_conf_path, e),
128 + level=logging.ERROR, noiselevel=-1)
129 + del e
130 + else:
131 + repo_defaults = repo_conf_parser.defaults()
132 + if repo_defaults:
133 + self._local_repo_configs['DEFAULT'] = \
134 + _local_repo_config('DEFAULT', repo_defaults)
135 + for repo_name in repo_conf_parser.sections():
136 + repo_opts = repo_defaults.copy()
137 + for opt_name in repo_conf_parser.options(repo_name):
138 + repo_opts[opt_name] = \
139 + repo_conf_parser.get(repo_name, opt_name)
140 + self._local_repo_configs[repo_name] = \
141 + _local_repo_config(repo_name, repo_opts)
142 +
143 #getting categories from an external file now
144 categories = [grabfile(os.path.join(x, "categories")) for x in locations]
145 self.categories = tuple(sorted(
146
147 Modified: main/branches/2.1.6/pym/portage/dbapi/porttree.py
148 ===================================================================
149 --- main/branches/2.1.6/pym/portage/dbapi/porttree.py 2009-04-30 07:06:14 UTC (rev 13489)
150 +++ main/branches/2.1.6/pym/portage/dbapi/porttree.py 2009-04-30 07:06:46 UTC (rev 13490)
151 @@ -173,10 +173,15 @@
152
153 self._repo_info = {}
154 eclass_dbs = {porttree_root : self.eclassdb}
155 + local_repo_configs = self.mysettings._local_repo_configs
156 + default_loc_repo_config = None
157 + if local_repo_configs is not None:
158 + default_loc_repo_config = local_repo_configs.get('DEFAULT')
159 for path in self.porttrees:
160 if path in self._repo_info:
161 continue
162
163 + repo_name = self._repository_map.get(path)
164 layout_filename = os.path.join(path, "metadata/layout.conf")
165 layout_file = KeyValuePairFileLoader(layout_filename, None, None)
166 layout_data, layout_errors = layout_file.load()
167 @@ -200,6 +205,24 @@
168
169 porttrees.append(path)
170
171 + if local_repo_configs is not None:
172 + loc_repo_conf = None
173 + if repo_name is not None:
174 + loc_repo_conf = local_repo_configs.get(repo_name)
175 + if loc_repo_conf is None:
176 + loc_repo_conf = default_loc_repo_config
177 + if loc_repo_conf is not None:
178 + for other_name in loc_repo_conf.eclass_overrides:
179 + other_path = self.treemap.get(other_name)
180 + if other_path is None:
181 + writemsg_level(("Unavailable repository '%s' " + \
182 + "referenced by eclass-overrides entry in " + \
183 + "'%s'\n") % (other_name,
184 + self.mysettings._local_repo_conf_path),
185 + level=logging.ERROR, noiselevel=-1)
186 + continue
187 + porttrees.append(other_path)
188 +
189 eclass_db = None
190 for porttree in porttrees:
191 tree_db = eclass_dbs.get(porttree)
192 @@ -211,8 +234,7 @@
193 else:
194 eclass_db.append(tree_db)
195
196 - self._repo_info[path] = _repo_info(self._repository_map.get(path),
197 - path, eclass_db)
198 + self._repo_info[path] = _repo_info(repo_name, path, eclass_db)
199
200 self.auxdbmodule = self.mysettings.load_best_module("portdbapi.auxdbmodule")
201 self.auxdb = {}