1 |
Author: zmedico |
2 |
Date: 2009-03-24 02:48:27 +0000 (Tue, 24 Mar 2009) |
3 |
New Revision: 13175 |
4 |
|
5 |
Modified: |
6 |
main/trunk/bin/ebuild |
7 |
main/trunk/man/make.conf.5 |
8 |
main/trunk/pym/_emerge/__init__.py |
9 |
main/trunk/pym/portage/__init__.py |
10 |
main/trunk/pym/portage/dbapi/porttree.py |
11 |
main/trunk/pym/portage/manifest.py |
12 |
Log: |
13 |
Add support for FEATURES=parse-eapi-glep-55. This feature is only intended for |
14 |
experimental purposes and should not be enabled under normal circumstances. |
15 |
|
16 |
|
17 |
Modified: main/trunk/bin/ebuild |
18 |
=================================================================== |
19 |
--- main/trunk/bin/ebuild 2009-03-23 21:36:31 UTC (rev 13174) |
20 |
+++ main/trunk/bin/ebuild 2009-03-24 02:48:27 UTC (rev 13175) |
21 |
@@ -83,7 +83,14 @@ |
22 |
|
23 |
ebuild = pargs.pop(0) |
24 |
|
25 |
-if not ebuild.endswith(".ebuild"): |
26 |
+pf = None |
27 |
+if 'parse-eapi-glep-55' in portage.settings.features: |
28 |
+ pf, eapi = portage._split_ebuild_name_glep55( |
29 |
+ os.path.basename(ebuild)) |
30 |
+elif ebuild.endswith(".ebuild"): |
31 |
+ pf = os.path.basename(ebuild)[:-7] |
32 |
+ |
33 |
+if pf is None: |
34 |
portage.writemsg("'%s' does not end with '.ebuild'.\n" % \ |
35 |
(ebuild,), noiselevel=-1) |
36 |
sys.exit(1) |
37 |
@@ -120,8 +127,7 @@ |
38 |
sys.exit(1) |
39 |
|
40 |
ebuild_split = ebuild.split("/") |
41 |
-del ebuild_split[-2] |
42 |
-cpv = "/".join(ebuild_split[-2:])[:-7] |
43 |
+cpv = "%s/%s" % (ebuild_split[-3], pf) |
44 |
|
45 |
if not portage.catpkgsplit(cpv): |
46 |
print "!!! %s does not follow correct package syntax." % (cpv) |
47 |
@@ -158,8 +164,6 @@ |
48 |
portage._doebuild_manifest_exempt_depend += 1 |
49 |
pkgdir = os.path.dirname(myebuild) |
50 |
fetchlist_dict = portage.FetchlistDict(pkgdir, mysettings, mydbapi) |
51 |
- cat, pkg = pkgdir.split(os.sep)[-2:] |
52 |
- cpv = cat + "/" + os.path.basename(myebuild)[:-7] |
53 |
from portage.manifest import Manifest |
54 |
mf = Manifest(pkgdir, mysettings["DISTDIR"], |
55 |
fetchlist_dict=fetchlist_dict, manifest1_compat=False) |
56 |
|
57 |
Modified: main/trunk/man/make.conf.5 |
58 |
=================================================================== |
59 |
--- main/trunk/man/make.conf.5 2009-03-23 21:36:31 UTC (rev 13174) |
60 |
+++ main/trunk/man/make.conf.5 2009-03-24 02:48:27 UTC (rev 13175) |
61 |
@@ -274,6 +274,11 @@ |
62 |
is only intended for experimental purposes and should not be enabled under |
63 |
normal circumstances. |
64 |
.TP |
65 |
+.B parse\-eapi\-glep\-55 |
66 |
+Parse \fBEAPI\fR from the file extension of the ebuild. This feature |
67 |
+is only intended for experimental purposes and should not be enabled under |
68 |
+normal circumstances. |
69 |
+.TP |
70 |
.B preserve\-libs |
71 |
Preserve libraries when the sonames change during upgrade or downgrade. |
72 |
Libraries are preserved only if consumers of those libraries are detected. |
73 |
|
74 |
Modified: main/trunk/pym/_emerge/__init__.py |
75 |
=================================================================== |
76 |
--- main/trunk/pym/_emerge/__init__.py 2009-03-23 21:36:31 UTC (rev 13174) |
77 |
+++ main/trunk/pym/_emerge/__init__.py 2009-03-24 02:48:27 UTC (rev 13175) |
78 |
@@ -3037,9 +3037,16 @@ |
79 |
settings.setcpv(self.cpv) |
80 |
ebuild_path = self.ebuild_path |
81 |
|
82 |
- if 'parse-eapi-ebuild-head' in settings.features: |
83 |
+ eapi = None |
84 |
+ if 'parse-eapi-glep-55' in settings.features: |
85 |
+ pf, eapi = portage._split_ebuild_name_glep55( |
86 |
+ os.path.basename(ebuild_path)) |
87 |
+ if eapi is None and \ |
88 |
+ 'parse-eapi-ebuild-head' in settings.features: |
89 |
eapi = portage._parse_eapi_ebuild_head(codecs.open(ebuild_path, |
90 |
mode='r', encoding='utf_8', errors='replace')) |
91 |
+ |
92 |
+ if eapi is not None: |
93 |
if not portage.eapi_is_supported(eapi): |
94 |
self.metadata_callback(self.cpv, self.ebuild_path, |
95 |
self.repo_path, {'EAPI' : eapi}, self.ebuild_mtime) |
96 |
|
97 |
Modified: main/trunk/pym/portage/__init__.py |
98 |
=================================================================== |
99 |
--- main/trunk/pym/portage/__init__.py 2009-03-23 21:36:31 UTC (rev 13174) |
100 |
+++ main/trunk/pym/portage/__init__.py 2009-03-24 02:48:27 UTC (rev 13175) |
101 |
@@ -1790,9 +1790,12 @@ |
102 |
|
103 |
self["FEATURES"] = " ".join(sorted(self.features)) |
104 |
self.backup_changes("FEATURES") |
105 |
- global _validate_cache_for_unsupported_eapis |
106 |
+ global _glep_55_enabled, _validate_cache_for_unsupported_eapis |
107 |
if 'parse-eapi-ebuild-head' in self.features: |
108 |
_validate_cache_for_unsupported_eapis = False |
109 |
+ if 'parse-eapi-glep-55' in self.features: |
110 |
+ _validate_cache_for_unsupported_eapis = False |
111 |
+ _glep_55_enabled = True |
112 |
|
113 |
self._init_dirs() |
114 |
|
115 |
@@ -4656,8 +4659,14 @@ |
116 |
writemsg("!!! Expected: %s\n" % e.value[3], noiselevel=-1) |
117 |
return 0 |
118 |
# Make sure that all of the ebuilds are actually listed in the Manifest. |
119 |
+ glep55 = 'parse-eapi-glep-55' in mysettings.features |
120 |
for f in os.listdir(pkgdir): |
121 |
- if f.endswith(".ebuild") and not mf.hasFile("EBUILD", f): |
122 |
+ pf = None |
123 |
+ if glep55: |
124 |
+ pf, eapi = _split_ebuild_name_glep55(f) |
125 |
+ elif f[-7:] == '.ebuild': |
126 |
+ pf = f[:-7] |
127 |
+ if pf is not None and not mf.hasFile("EBUILD", f): |
128 |
writemsg("!!! A file is not listed in the Manifest: '%s'\n" % \ |
129 |
os.path.join(pkgdir, f), noiselevel=-1) |
130 |
if strict: |
131 |
@@ -5051,6 +5060,20 @@ |
132 |
break |
133 |
return '0' |
134 |
|
135 |
+# True when FEATURES=parse-eapi-glep-55 is enabled. |
136 |
+_glep_55_enabled = False |
137 |
+ |
138 |
+_split_ebuild_name_glep55_re = re.compile(r'^(.*)\.ebuild(-([^.]+))?$') |
139 |
+ |
140 |
+def _split_ebuild_name_glep55(name): |
141 |
+ """ |
142 |
+ @returns: (pkg-ver-rev, eapi) |
143 |
+ """ |
144 |
+ m = _split_ebuild_name_glep55_re.match(name) |
145 |
+ if m is None: |
146 |
+ return (None, None) |
147 |
+ return (m.group(1), m.group(3)) |
148 |
+ |
149 |
def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, mydbapi): |
150 |
|
151 |
ebuild_path = os.path.abspath(myebuild) |
152 |
@@ -5060,7 +5083,14 @@ |
153 |
cat = mysettings.configdict["pkg"]["CATEGORY"] |
154 |
else: |
155 |
cat = os.path.basename(normalize_path(os.path.join(pkg_dir, ".."))) |
156 |
- mypv = os.path.basename(ebuild_path)[:-7] |
157 |
+ |
158 |
+ eapi = None |
159 |
+ if 'parse-eapi-glep-55' in mysettings.features: |
160 |
+ mypv, eapi = portage._split_ebuild_name_glep55( |
161 |
+ os.path.basename(myebuild)) |
162 |
+ else: |
163 |
+ mypv = os.path.basename(ebuild_path)[:-7] |
164 |
+ |
165 |
mycpv = cat+"/"+mypv |
166 |
mysplit=pkgsplit(mypv,silent=0) |
167 |
if mysplit is None: |
168 |
@@ -5124,14 +5154,20 @@ |
169 |
mysettings["PORTAGE_QUIET"] = "1" |
170 |
|
171 |
if mydo == 'depend' and \ |
172 |
- 'EAPI' not in mysettings.configdict['pkg'] and \ |
173 |
- 'parse-eapi-ebuild-head' in mysettings.features: |
174 |
- eapi = _parse_eapi_ebuild_head(codecs.open(ebuild_path, |
175 |
- mode='r', encoding='utf_8', errors='replace')) |
176 |
- if not eapi_is_supported(eapi): |
177 |
- raise portage.exception.UnsupportedAPIException(mycpv, eapi) |
178 |
- mysettings.configdict['pkg']['EAPI'] = eapi |
179 |
+ 'EAPI' not in mysettings.configdict['pkg']: |
180 |
|
181 |
+ if eapi is not None: |
182 |
+ # From parse-eapi-glep-55 above. |
183 |
+ mysettings.configdict['pkg']['EAPI'] = eapi |
184 |
+ elif 'parse-eapi-ebuild-head' in mysettings.features: |
185 |
+ eapi = _parse_eapi_ebuild_head(codecs.open(ebuild_path, |
186 |
+ mode='r', encoding='utf_8', errors='replace')) |
187 |
+ |
188 |
+ if eapi is not None: |
189 |
+ if not eapi_is_supported(eapi): |
190 |
+ raise portage.exception.UnsupportedAPIException(mycpv, eapi) |
191 |
+ mysettings.configdict['pkg']['EAPI'] = eapi |
192 |
+ |
193 |
if mydo != "depend": |
194 |
# Metadata vars such as EAPI and RESTRICT are |
195 |
# set by the above config.setcpv() call. |
196 |
@@ -5701,8 +5737,14 @@ |
197 |
|
198 |
# Make sure that all of the ebuilds are |
199 |
# actually listed in the Manifest. |
200 |
+ glep55 = 'parse-eapi-glep-55' in mysettings.features |
201 |
for f in os.listdir(pkgdir): |
202 |
- if f.endswith(".ebuild") and not mf.hasFile("EBUILD", f): |
203 |
+ pf = None |
204 |
+ if glep55: |
205 |
+ pf, eapi = _split_ebuild_name_glep55(f) |
206 |
+ elif f[-7:] == '.ebuild': |
207 |
+ pf = f[:-7] |
208 |
+ if pf is not None and not mf.hasFile("EBUILD", f): |
209 |
f = os.path.join(pkgdir, f) |
210 |
if f not in _doebuild_broken_ebuilds: |
211 |
out = portage.output.EOutput() |
212 |
|
213 |
Modified: main/trunk/pym/portage/dbapi/porttree.py |
214 |
=================================================================== |
215 |
--- main/trunk/pym/portage/dbapi/porttree.py 2009-03-23 21:36:31 UTC (rev 13174) |
216 |
+++ main/trunk/pym/portage/dbapi/porttree.py 2009-03-24 02:48:27 UTC (rev 13175) |
217 |
@@ -279,8 +279,24 @@ |
218 |
else: |
219 |
mytrees = self.porttrees[:] |
220 |
mytrees.reverse() |
221 |
- if psplit: |
222 |
+ if 'parse-eapi-glep-55' in self.doebuild_settings.features: |
223 |
+ glep55_startswith = '%s.ebuild-' % mysplit[1] |
224 |
for x in mytrees: |
225 |
+ filename = os.path.join(x, mysplit[0], psplit[0], |
226 |
+ mysplit[1] + ".ebuild") |
227 |
+ if os.access(filename, os.R_OK): |
228 |
+ return (filename, x) |
229 |
+ |
230 |
+ pkgdir = os.path.join(x, mysplit[0], psplit[0]) |
231 |
+ try: |
232 |
+ files = os.listdir(pkgdir) |
233 |
+ except OSError: |
234 |
+ continue |
235 |
+ for y in files: |
236 |
+ if y.startswith(glep55_startswith): |
237 |
+ return (os.path.join(pkgdir, y), x) |
238 |
+ else: |
239 |
+ for x in mytrees: |
240 |
file=x+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild" |
241 |
if os.access(file, os.R_OK): |
242 |
return[file, x] |
243 |
@@ -421,9 +437,15 @@ |
244 |
mydata = {} |
245 |
eapi = None |
246 |
|
247 |
- if 'parse-eapi-ebuild-head' in self.doebuild_settings.features: |
248 |
+ if 'parse-eapi-glep-55' in self.doebuild_settings.features: |
249 |
+ pf, eapi = portage._split_ebuild_name_glep55( |
250 |
+ os.path.basename(myebuild)) |
251 |
+ if eapi is None and \ |
252 |
+ 'parse-eapi-ebuild-head' in self.doebuild_settings.features: |
253 |
eapi = portage._parse_eapi_ebuild_head(codecs.open(myebuild, |
254 |
mode='r', encoding='utf_8', errors='replace')) |
255 |
+ |
256 |
+ if eapi is not None: |
257 |
self.doebuild_settings.configdict['pkg']['EAPI'] = eapi |
258 |
|
259 |
if eapi is not None and not portage.eapi_is_supported(eapi): |
260 |
@@ -666,6 +688,7 @@ |
261 |
return cachelist[:] |
262 |
mysplit = mycp.split("/") |
263 |
invalid_category = mysplit[0] not in self._categories |
264 |
+ glep55 = 'parse-eapi-glep-55' in self.doebuild_settings.features |
265 |
d={} |
266 |
if mytree: |
267 |
mytrees = [mytree] |
268 |
@@ -677,8 +700,14 @@ |
269 |
except OSError: |
270 |
continue |
271 |
for x in file_list: |
272 |
- if x.endswith(".ebuild"): |
273 |
+ |
274 |
+ pf = None |
275 |
+ if glep55: |
276 |
+ pf, eapi = portage._split_ebuild_name_glep55(x) |
277 |
+ elif x[-7:] == '.ebuild': |
278 |
pf = x[:-7] |
279 |
+ |
280 |
+ if pf is not None: |
281 |
ps = pkgsplit(pf) |
282 |
if not ps: |
283 |
writemsg("\nInvalid ebuild name: %s\n" % \ |
284 |
|
285 |
Modified: main/trunk/pym/portage/manifest.py |
286 |
=================================================================== |
287 |
--- main/trunk/pym/portage/manifest.py 2009-03-23 21:36:31 UTC (rev 13174) |
288 |
+++ main/trunk/pym/portage/manifest.py 2009-03-24 02:48:27 UTC (rev 13175) |
289 |
@@ -27,6 +27,10 @@ |
290 |
|
291 |
def manifest2MiscfileFilter(filename): |
292 |
filename = filename.strip(os.sep) |
293 |
+ if portage._glep_55_enabled: |
294 |
+ pf, eapi = portage._split_ebuild_name_glep55(filename) |
295 |
+ if pf is not None: |
296 |
+ return False |
297 |
return not (filename in ["CVS", ".svn", "files", "Manifest"] or filename.endswith(".ebuild")) |
298 |
|
299 |
def guessManifestFileType(filename): |
300 |
@@ -307,9 +311,13 @@ |
301 |
for f in pkgdir_files: |
302 |
if f[:1] == ".": |
303 |
continue |
304 |
- elif f[-7:] == ".ebuild": |
305 |
+ pf = None |
306 |
+ if portage._glep_55_enabled: |
307 |
+ pf, eapi = portage._split_ebuild_name_glep55(f) |
308 |
+ elif f[-7:] == '.ebuild': |
309 |
+ pf = f[:-7] |
310 |
+ if pf is not None: |
311 |
mytype = "EBUILD" |
312 |
- pf = f[:-7] |
313 |
ps = portage.versions.pkgsplit(pf) |
314 |
cpv = "%s/%s" % (cat, pf) |
315 |
if not ps: |