Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r14511 - in main/branches/prefix: cnf pym/_emerge pym/portage pym/portage/dbapi pym/repoman
Date: Wed, 07 Oct 2009 19:09:59
Message-Id: E1Mvbtc-00051s-Om@stork.gentoo.org
1 Author: grobian
2 Date: 2009-10-07 19:09:55 +0000 (Wed, 07 Oct 2009)
3 New Revision: 14511
4
5 Modified:
6 main/branches/prefix/cnf/make.globals
7 main/branches/prefix/pym/_emerge/actions.py
8 main/branches/prefix/pym/portage/__init__.py
9 main/branches/prefix/pym/portage/dbapi/porttree.py
10 main/branches/prefix/pym/portage/dbapi/vartree.py
11 main/branches/prefix/pym/portage/versions.py
12 main/branches/prefix/pym/repoman/checks.py
13 Log:
14 Merged from trunk -r14487:14497
15
16 | 14488 | fix mis-alignment |
17 | grobian | |
18
19 | 14489 | Restrict upstream.workaround to src_compile and src_install |
20 | volkmar | as much as possible. Prevent warnings when using emake -j1 |
21 | | in src_test which is recommanded. |
22
23 | 14490 | Add src_configure and pkg_config to the list of phases in |
24 | arfrever | repoman.checks.PhaseCheck.__init__(). |
25
26 | 14491 | Make pkgsplit() accept a cpv again, since accepting a pv |
27 | zmedico | only will probably break lots of api consumers. Thanks to |
28 | | Romain Perier <mrpouet@g.o> for reporting epkginfo |
29 | | breakage. |
30
31 | 14492 | Use the simpler/stricter _pkgspit in dbapi code. |
32 | zmedico | |
33
34 | 14493 | Use _pkgsplit when input cannot contain a category. |
35 | zmedico | |
36
37 | 14494 | Make pkgsplit() preserve 'null' category if it's present in |
38 | zmedico | the input. |
39
40 | 14495 | Make deprecated_profile_check() suggest to use eselect |
41 | zmedico | profile. Thanks to Samuli Suominen <ssuominen@g.o> for the |
42 | | suggestion. |
43
44 | 14496 | * Add default ACCEPT_LICENSE and ACCEPT_PROPERTIES values |
45 | zmedico | in make.globals. * Set default values if missing from |
46 | | make.globals. * Only warn once if a given license group is |
47 | | missing. * Prune off any parts of an ACCEPT_LICENSE and |
48 | | ACCEPT_PROPERTIES that are made irrelevant by the latest |
49 | | occuring * or -* wildcard. |
50
51 | 14497 | - move news into features so it can be ignored when needed. |
52 | solar | Lots of whitespace cleanups |
53
54
55 Modified: main/branches/prefix/cnf/make.globals
56 ===================================================================
57 --- main/branches/prefix/cnf/make.globals 2009-10-07 15:14:42 UTC (rev 14510)
58 +++ main/branches/prefix/cnf/make.globals 2009-10-07 19:09:55 UTC (rev 14511)
59 @@ -24,6 +24,9 @@
60 # Default distfiles mirrors
61 GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
62
63 +ACCEPT_LICENSE="* -@EULA"
64 +ACCEPT_PROPERTIES="*"
65 +
66 # Repository Paths
67 PORTDIR="@PORTAGE_EPREFIX@/usr/portage"
68 DISTDIR="@PORTAGE_EPREFIX@/usr/portage/distfiles"
69
70 Modified: main/branches/prefix/pym/_emerge/actions.py
71 ===================================================================
72 --- main/branches/prefix/pym/_emerge/actions.py 2009-10-07 15:14:42 UTC (rev 14510)
73 +++ main/branches/prefix/pym/_emerge/actions.py 2009-10-07 19:09:55 UTC (rev 14511)
74 @@ -642,7 +642,7 @@
75 required_sets[s] = InternalPackageSet(
76 initial_atoms=getSetAtoms(s))
77
78 -
79 +
80 # When removing packages, use a temporary version of world
81 # which excludes packages that are intended to be eligible for
82 # removal.
83 @@ -1148,7 +1148,7 @@
84 def cmp_reference_count(node1, node2):
85 return node_refcounts[node1] - node_refcounts[node2]
86 graph.order.sort(key=cmp_sort_key(cmp_reference_count))
87 -
88 +
89 ignore_priority_range = [None]
90 ignore_priority_range.extend(
91 range(UnmergeDepPriority.MIN, UnmergeDepPriority.MAX + 1))
92 @@ -1837,7 +1837,7 @@
93 portage.writemsg(yellow("WARNING:") + " adding required option " + \
94 "%s not included in PORTAGE_RSYNC_OPTS\n" % opt)
95 rsync_opts.append(opt)
96 -
97 +
98 for exclude in ("distfiles", "local", "packages"):
99 opt = "--exclude=/%s" % exclude
100 if opt not in rsync_opts:
101 @@ -1845,7 +1845,7 @@
102 " adding required option %s not included in " % opt + \
103 "PORTAGE_RSYNC_OPTS (can be overridden with --exclude='!')\n")
104 rsync_opts.append(opt)
105 -
106 +
107 if syncuri.rstrip("/").endswith(".gentoo.org/gentoo-portage"):
108 def rsync_opt_startswith(opt_prefix):
109 for x in rsync_opts:
110 @@ -2256,7 +2256,7 @@
111 print()
112 print(red(" * ")+"To update portage, run 'emerge portage' now.")
113 print()
114 -
115 +
116 display_news_notification(root_config, myopts)
117 return os.EX_OK
118
119 @@ -2680,6 +2680,8 @@
120 UNREAD_PATH = os.path.join(target_root, NEWS_LIB_PATH, "news")
121 newsReaderDisplay = False
122 update = "--pretend" not in myopts
123 + if "news" not in settings.features:
124 + return
125
126 if not settings.treeVirtuals:
127 # Populate these using our existing vartree, to avoid
128 @@ -2695,8 +2697,8 @@
129 print()
130 print(colorize("WARN", " * IMPORTANT:"), end=' ')
131 print("%s news items need reading for repository '%s'." % (unreadItems, repo))
132 -
133 -
134 +
135 +
136 if newsReaderDisplay:
137 print(colorize("WARN", " *"), end=' ')
138 print("Use " + colorize("GOOD", "eselect news") + " to read news items.")
139 @@ -2738,7 +2740,7 @@
140 """
141 Examines news items in repodir + '/' + NEWS_PATH and attempts to find unread items
142 Returns the number of unread (yet relevent) items.
143 -
144 +
145 @param portdb: a portage tree database
146 @type portdb: pordbapi
147 @param vardb: an installed package database
148 @@ -2752,7 +2754,7 @@
149 @rtype: Integer
150 @returns:
151 1. The number of unread but relevant news items.
152 -
153 +
154 """
155 from portage.news import NewsManager
156 manager = NewsManager(portdb, vardb, NEWS_PATH, UNREAD_PATH)
157
158 Modified: main/branches/prefix/pym/portage/__init__.py
159 ===================================================================
160 --- main/branches/prefix/pym/portage/__init__.py 2009-10-07 15:14:42 UTC (rev 14510)
161 +++ main/branches/prefix/pym/portage/__init__.py 2009-10-07 19:09:55 UTC (rev 14511)
162 @@ -1486,6 +1486,12 @@
163
164 _environ_filter = frozenset(_environ_filter)
165
166 + _undef_lic_groups = set()
167 + _default_globals = (
168 + ('ACCEPT_LICENSE', '* -@EULA'),
169 + ('ACCEPT_PROPERTIES', '*'),
170 + )
171 +
172 def __init__(self, clone=None, mycpv=None, config_profile_path=None,
173 config_incrementals=None, config_root=None, target_root=None,
174 local_config=True, env=None):
175 @@ -1879,6 +1885,9 @@
176 if self.mygcfg is None:
177 self.mygcfg = {}
178
179 + for k, v in self._default_globals:
180 + self.mygcfg.setdefault(k, v)
181 +
182 self.configlist.append(self.mygcfg)
183 self.configdict["globals"]=self.configlist[-1]
184
185 @@ -2285,8 +2294,11 @@
186 else:
187 rValue.extend(self._expandLicenseToken(l, traversed_groups))
188 else:
189 - writemsg(_("Undefined license group '%s'\n") % group_name,
190 - noiselevel=-1)
191 + if self._license_groups and \
192 + group_name not in self._undef_lic_groups:
193 + self._undef_lic_groups.add(group_name)
194 + writemsg(_("Undefined license group '%s'\n") % group_name,
195 + noiselevel=-1)
196 rValue.append("@"+group_name)
197 if negate:
198 rValue = ["-" + token for token in rValue]
199 @@ -3019,8 +3031,6 @@
200 @rtype: List
201 @return: A list of licenses that have not been accepted.
202 """
203 - if not self._accept_license:
204 - return []
205 accept_license = self._accept_license
206 cpdict = self._plicensedict.get(dep_getkey(cpv), None)
207 if cpdict:
208 @@ -3100,8 +3110,6 @@
209 @rtype: List
210 @return: A list of properties that have not been accepted.
211 """
212 - if not self._accept_properties:
213 - return []
214 accept_properties = self._accept_properties
215 cpdict = self._ppropertiesdict.get(dep_getkey(cpv), None)
216 if cpdict:
217 @@ -3252,6 +3260,25 @@
218 # env_d will be None if profile.env doesn't exist.
219 self.configdict["env.d"].update(env_d)
220
221 + def _prune_incremental(self, split):
222 + """
223 + Prune off any parts of an incremental variable that are
224 + made irrelevant by the latest occuring * or -*. This
225 + could be more aggressive but that might be confusing
226 + and the point is just to reduce noise a bit.
227 + """
228 + for i, x in enumerate(reversed(split)):
229 + if x == '*':
230 + split = split[-i-1:]
231 + break
232 + elif x == '-*':
233 + if i == 0:
234 + split = []
235 + else:
236 + split = split[-i:]
237 + break
238 + return split
239 +
240 def regenerate(self,useonly=0,use_cache=1):
241 """
242 Regenerate settings
243 @@ -3303,28 +3330,28 @@
244 mysplit = []
245 for curdb in mydbs:
246 mysplit.extend(curdb.get('ACCEPT_LICENSE', '').split())
247 + mysplit = self._prune_incremental(mysplit)
248 accept_license_str = ' '.join(mysplit)
249 - if accept_license_str:
250 - self.configlist[-1]['ACCEPT_LICENSE'] = accept_license_str
251 + self.configlist[-1]['ACCEPT_LICENSE'] = accept_license_str
252 if accept_license_str != self._accept_license_str:
253 self._accept_license_str = accept_license_str
254 self._accept_license = tuple(self.expandLicenseTokens(mysplit))
255 else:
256 # repoman will accept any license
257 - self._accept_license = ()
258 + self._accept_license = ('*',)
259
260 # ACCEPT_PROPERTIES works like ACCEPT_LICENSE, without groups
261 if self.local_config:
262 mysplit = []
263 for curdb in mydbs:
264 mysplit.extend(curdb.get('ACCEPT_PROPERTIES', '').split())
265 - if mysplit:
266 - self.configlist[-1]['ACCEPT_PROPERTIES'] = ' '.join(mysplit)
267 + mysplit = self._prune_incremental(mysplit)
268 + self.configlist[-1]['ACCEPT_PROPERTIES'] = ' '.join(mysplit)
269 if tuple(mysplit) != self._accept_properties:
270 self._accept_properties = tuple(mysplit)
271 else:
272 # repoman will accept any property
273 - self._accept_properties = ()
274 + self._accept_properties = ('*',)
275
276 for mykey in myincrementals:
277
278 @@ -6030,7 +6057,7 @@
279 mypv = os.path.basename(ebuild_path)[:-7]
280
281 mycpv = cat+"/"+mypv
282 - mysplit=pkgsplit(mypv,silent=0)
283 + mysplit = versions._pkgsplit(mypv)
284 if mysplit is None:
285 raise portage.exception.IncorrectParameter(
286 _("Invalid ebuild path: '%s'") % myebuild)
287 @@ -8205,7 +8232,7 @@
288 % (mycpv,), DeprecationWarning)
289
290 myslash = mycpv.split("/", 1)
291 - mysplit=pkgsplit(myslash[-1])
292 + mysplit = versions._pkgsplit(myslash[-1])
293 if mysplit is None:
294 return None
295 mylen=len(myslash)
296 @@ -8248,7 +8275,7 @@
297 virtual is a valid choice and defaults to the first element when there
298 are no installed/available candidates."""
299 myslash=mycpv.split("/")
300 - mysplit=pkgsplit(myslash[-1])
301 + mysplit = versions._pkgsplit(myslash[-1])
302 if settings is None:
303 settings = globals()["settings"]
304 virts = settings.getvirtuals("/")
305 @@ -8752,6 +8779,8 @@
306 mode='r', encoding=_encodings['content'], errors='replace').readlines()
307 writemsg(colorize("BAD", _("\n!!! Your current profile is "
308 "deprecated and not supported anymore.")) + "\n", noiselevel=-1)
309 + writemsg(colorize("BAD", _("!!! Use eselect profile to update your "
310 + "profile.")) + "\n", noiselevel=-1)
311 if not dcontent:
312 writemsg(colorize("BAD", _("!!! Please refer to the "
313 "Gentoo Upgrading Guide.")) + "\n", noiselevel=-1)
314
315 Modified: main/branches/prefix/pym/portage/dbapi/porttree.py
316 ===================================================================
317 --- main/branches/prefix/pym/portage/dbapi/porttree.py 2009-10-07 15:14:42 UTC (rev 14510)
318 +++ main/branches/prefix/pym/portage/dbapi/porttree.py 2009-10-07 19:09:55 UTC (rev 14511)
319 @@ -12,7 +12,7 @@
320 'portage.dep:dep_getkey,match_from_list,paren_reduce,use_reduce',
321 'portage.env.loaders:KeyValuePairFileLoader',
322 'portage.util:ensure_dirs,writemsg,writemsg_level',
323 - 'portage.versions:best,catpkgsplit,pkgsplit,ver_regexp',
324 + 'portage.versions:best,catpkgsplit,_pkgsplit@pkgsplit,ver_regexp',
325 )
326
327 from portage.cache.cache_errors import CacheError
328
329 Modified: main/branches/prefix/pym/portage/dbapi/vartree.py
330 ===================================================================
331 --- main/branches/prefix/pym/portage/dbapi/vartree.py 2009-10-07 15:14:42 UTC (rev 14510)
332 +++ main/branches/prefix/pym/portage/dbapi/vartree.py 2009-10-07 19:09:55 UTC (rev 14511)
333 @@ -22,7 +22,7 @@
334 'portage.util:apply_secpass_permissions,ConfigProtect,ensure_dirs,' + \
335 'writemsg,writemsg_level,write_atomic,atomic_ofstream,writedict,' + \
336 'grabfile,grabdict,normalize_path,new_protect_filename,getlibpaths',
337 - 'portage.versions:best,catpkgsplit,catsplit,pkgcmp,pkgsplit',
338 + 'portage.versions:best,catpkgsplit,catsplit,pkgcmp,_pkgsplit@pkgsplit',
339 )
340
341 from portage.const import CACHE_PATH, CONFIG_MEMORY_FILE, \
342 @@ -3790,7 +3790,7 @@
343 raise
344 del e
345 else:
346 - showMessage(_("<<< !needed %s %s\n") % (obj_type, obj),
347 + showMessage(_("<<< !needed %s %s\n") % (obj_type, obj),
348 noiselevel=-1)
349
350 # Remove empty parent directories if possible.
351
352 Modified: main/branches/prefix/pym/portage/versions.py
353 ===================================================================
354 --- main/branches/prefix/pym/portage/versions.py 2009-10-07 15:14:42 UTC (rev 14510)
355 +++ main/branches/prefix/pym/portage/versions.py 2009-10-07 19:09:55 UTC (rev 14511)
356 @@ -251,8 +251,13 @@
357
358 _pv_re = re.compile('^' + _pv + '$', re.VERBOSE)
359
360 -def pkgsplit(mypkg,silent=1):
361 -
362 +def _pkgsplit(mypkg):
363 + """
364 + @param mypkg: pv
365 + @return:
366 + 1. None if input is invalid.
367 + 2. (pn, ver, rev) if input is pv
368 + """
369 m = _pv_re.match(mypkg)
370 if m is None:
371 return None
372 @@ -268,6 +273,7 @@
373
374 return (m.group('pn'), m.group('ver'), rev)
375
376 +_missing_cat = 'null'
377 catcache={}
378 def catpkgsplit(mydata,silent=1):
379 """
380 @@ -291,11 +297,11 @@
381 mysplit = mydata.split('/', 1)
382 p_split=None
383 if len(mysplit)==1:
384 - cat = "null"
385 - p_split=pkgsplit(mydata,silent=silent)
386 + cat = _missing_cat
387 + p_split = _pkgsplit(mydata)
388 elif len(mysplit)==2:
389 cat = mysplit[0]
390 - p_split=pkgsplit(mysplit[1],silent=silent)
391 + p_split = _pkgsplit(mysplit[1])
392 if not p_split:
393 catcache[mydata]=None
394 return None
395 @@ -303,6 +309,23 @@
396 catcache[mydata]=retval
397 return retval
398
399 +def pkgsplit(mypkg, silent=1):
400 + """
401 + @param mypkg: either a pv or cpv
402 + @return:
403 + 1. None if input is invalid.
404 + 2. (pn, ver, rev) if input is pv
405 + 3. (cp, ver, rev) if input is a cpv
406 + """
407 + catpsplit = catpkgsplit(mypkg)
408 + if catpsplit is None:
409 + return None
410 + cat, pn, ver, rev = catpsplit
411 + if cat is _missing_cat and '/' not in mypkg:
412 + return (pn, ver, rev)
413 + else:
414 + return (cat + '/' + pn, ver, rev)
415 +
416 def catsplit(mydep):
417 return mydep.split("/", 1)
418
419
420 Modified: main/branches/prefix/pym/repoman/checks.py
421 ===================================================================
422 --- main/branches/prefix/pym/repoman/checks.py 2009-10-07 15:14:42 UTC (rev 14510)
423 +++ main/branches/prefix/pym/repoman/checks.py 2009-10-07 19:09:55 UTC (rev 14511)
424 @@ -30,6 +30,36 @@
425 def end(self):
426 pass
427
428 +class PhaseCheck(LineCheck):
429 + """ basic class for function detection """
430 +
431 + ignore_line = re.compile(r'(^\s*#)')
432 + func_end_re = re.compile(r'^\}$')
433 + in_phase = ''
434 +
435 + def __init__(self):
436 + self.phases = ('pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare', 'src_configure', 'src_compile',
437 + 'src_test', 'src_install', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'pkg_config')
438 + phase_re = '('
439 + for phase in self.phases:
440 + phase_re += phase + '|'
441 + phase_re = phase_re[:-1] + ')'
442 + self.phases_re = re.compile(phase_re)
443 +
444 + def check(self, num, line):
445 + m = self.phases_re.match(line)
446 + if m is not None:
447 + self.in_phase = m.group(1)
448 + if self.in_phase != '' and \
449 + self.func_end_re.match(line) is not None:
450 + self.in_phase = ''
451 +
452 + return self.phase_check(num, line)
453 +
454 + def phase_check(self, num, line):
455 + """ override this function for your checks """
456 + pass
457 +
458 class EbuildHeader(LineCheck):
459 """Ensure ebuilds have proper headers
460 Copyright header errors
461 @@ -327,12 +357,17 @@
462 if self._iuse_def is None:
463 yield 'IUSE is not defined'
464
465 -class EMakeParallelDisabled(LineCheck):
466 +class EMakeParallelDisabled(PhaseCheck):
467 """Check for emake -j1 calls which disable parallelization."""
468 repoman_check_name = 'upstream.workaround'
469 re = re.compile(r'^\s*emake\s+.*-j\s*1\b')
470 error = errors.EMAKE_PARALLEL_DISABLED
471
472 + def phase_check(self, num, line):
473 + if self.in_phase == 'src_compile' or self.in_phase == 'src_install':
474 + if self.re.match(line):
475 + return self.error
476 +
477 class EMakeParallelDisabledViaMAKEOPTS(LineCheck):
478 """Check for MAKEOPTS=-j1 that disables parallelization."""
479 repoman_check_name = 'upstream.workaround'
480 @@ -356,36 +391,6 @@
481 return 'WANT_AUTO' + m.group(1) + \
482 ' redundantly set to default value "latest" on line: %d'
483
484 -class PhaseCheck(LineCheck):
485 - """ basic class for function detection """
486 -
487 - ignore_line = re.compile(r'(^\s*#)')
488 - func_end_re = re.compile(r'^\}$')
489 - in_phase = ''
490 -
491 - def __init__(self):
492 - self.phases = ('pkg_setup', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'pkg_pretend',
493 - 'src_unpack', 'src_prepare', 'src_compile', 'src_test', 'src_install')
494 - phase_re = '('
495 - for phase in self.phases:
496 - phase_re += phase + '|'
497 - phase_re = phase_re[:-1] + ')'
498 - self.phases_re = re.compile(phase_re)
499 -
500 - def check(self, num, line):
501 - m = self.phases_re.match(line)
502 - if m is not None:
503 - self.in_phase = m.group(1)
504 - if self.in_phase != '' and \
505 - self.func_end_re.match(line) is not None:
506 - self.in_phase = ''
507 -
508 - return self.phase_check(num, line)
509 -
510 - def phase_check(self, num, line):
511 - """ override this function for your checks """
512 - pass
513 -
514 class SrcCompileEconf(PhaseCheck):
515 repoman_check_name = 'ebuild.minorsyn'
516 configure_re = re.compile(r'\s(econf|./configure)')