portage.proxy.lazyimport.lazyimport(globals(),
'portage.checksum:_perform_md5_merge@perform_md5',
'portage.dep:dep_getkey,isjustname,match_from_list,' + \
- 'use_reduce,paren_reduce',
+ 'use_reduce,paren_reduce,_slot_re',
'portage.elog:elog_process',
'portage.elog.filtering:filter_mergephases,filter_unmergephases',
'portage.locks:lockdir,unlockdir',
cache_data[aux_key] = mydata[aux_key]
self._aux_cache["packages"][mycpv] = (mydir_mtime, cache_data)
self._aux_cache["modified"].add(mycpv)
- if not mydata['SLOT']:
- # Empty slot triggers InvalidAtom exceptions when generating slot
- # atoms for packages, so translate it to '0' here.
+
+ if _slot_re.match(mydata['SLOT']) is None:
+ # Empty or invalid slot triggers InvalidAtom exceptions when
+ # generating slot atoms for packages, so translate it to '0' here.
mydata['SLOT'] = _unicode_decode('0')
+
return [mydata[x] for x in wants]
def _aux_get(self, mycpv, wants, st=None):
# 2.1.3 A slot name may contain any of the characters [A-Za-z0-9+_.-].
# It must not begin with a hyphen or a dot.
-_slot = r':([\w+][\w+.-]*)'
+_slot = r'([\w+][\w+.-]*)'
+_slot_re = re.compile('^' + _slot + '$', re.VERBOSE)
_use = r'\[.*\]'
_op = r'([=~]|[><]=?)'
_atom_re = re.compile('^(?P<without_use>(?:' +
'(?P<op>' + _op + _cpv + ')|' +
'(?P<star>=' + _cpv + r'\*)|' +
- '(?P<simple>' + _cp + '))(?:' + _slot + ')?)(' + _use + ')?$', re.VERBOSE)
+ '(?P<simple>' + _cp + '))(:' + _slot + ')?)(' + _use + ')?$', re.VERBOSE)
def isvalidatom(atom, allow_blockers=False):
"""