1 |
Author: zmedico |
2 |
Date: 2009-09-30 05:52:03 +0000 (Wed, 30 Sep 2009) |
3 |
New Revision: 14467 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/dbapi/vartree.py |
7 |
main/trunk/pym/portage/dep.py |
8 |
Log: |
9 |
Use a regular expression for SLOT validation inside vardbapi.aux_get(). |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/portage/dbapi/vartree.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/portage/dbapi/vartree.py 2009-09-30 05:19:06 UTC (rev 14466) |
15 |
+++ main/trunk/pym/portage/dbapi/vartree.py 2009-09-30 05:52:03 UTC (rev 14467) |
16 |
@@ -12,7 +12,7 @@ |
17 |
portage.proxy.lazyimport.lazyimport(globals(), |
18 |
'portage.checksum:_perform_md5_merge@perform_md5', |
19 |
'portage.dep:dep_getkey,isjustname,match_from_list,' + \ |
20 |
- 'use_reduce,paren_reduce', |
21 |
+ 'use_reduce,paren_reduce,_slot_re', |
22 |
'portage.elog:elog_process', |
23 |
'portage.elog.filtering:filter_mergephases,filter_unmergephases', |
24 |
'portage.locks:lockdir,unlockdir', |
25 |
@@ -1251,10 +1251,12 @@ |
26 |
cache_data[aux_key] = mydata[aux_key] |
27 |
self._aux_cache["packages"][mycpv] = (mydir_mtime, cache_data) |
28 |
self._aux_cache["modified"].add(mycpv) |
29 |
- if not mydata['SLOT']: |
30 |
- # Empty slot triggers InvalidAtom exceptions when generating slot |
31 |
- # atoms for packages, so translate it to '0' here. |
32 |
+ |
33 |
+ if _slot_re.match(mydata['SLOT']) is None: |
34 |
+ # Empty or invalid slot triggers InvalidAtom exceptions when |
35 |
+ # generating slot atoms for packages, so translate it to '0' here. |
36 |
mydata['SLOT'] = _unicode_decode('0') |
37 |
+ |
38 |
return [mydata[x] for x in wants] |
39 |
|
40 |
def _aux_get(self, mycpv, wants, st=None): |
41 |
|
42 |
Modified: main/trunk/pym/portage/dep.py |
43 |
=================================================================== |
44 |
--- main/trunk/pym/portage/dep.py 2009-09-30 05:19:06 UTC (rev 14466) |
45 |
+++ main/trunk/pym/portage/dep.py 2009-09-30 05:52:03 UTC (rev 14467) |
46 |
@@ -808,7 +808,8 @@ |
47 |
|
48 |
# 2.1.3 A slot name may contain any of the characters [A-Za-z0-9+_.-]. |
49 |
# It must not begin with a hyphen or a dot. |
50 |
-_slot = r':([\w+][\w+.-]*)' |
51 |
+_slot = r'([\w+][\w+.-]*)' |
52 |
+_slot_re = re.compile('^' + _slot + '$', re.VERBOSE) |
53 |
|
54 |
_use = r'\[.*\]' |
55 |
_op = r'([=~]|[><]=?)' |
56 |
@@ -816,7 +817,7 @@ |
57 |
_atom_re = re.compile('^(?P<without_use>(?:' + |
58 |
'(?P<op>' + _op + _cpv + ')|' + |
59 |
'(?P<star>=' + _cpv + r'\*)|' + |
60 |
- '(?P<simple>' + _cp + '))(?:' + _slot + ')?)(' + _use + ')?$', re.VERBOSE) |
61 |
+ '(?P<simple>' + _cp + '))(:' + _slot + ')?)(' + _use + ')?$', re.VERBOSE) |
62 |
|
63 |
def isvalidatom(atom, allow_blockers=False): |
64 |
""" |