111ret=[]112lines=grabfile(file_name,recursive=recursive)113eapi=read_corresponding_eapi_file(file_name)114ifeapi_filterisnotNoneandnoteapi_filter(eapi):115iflines:116writemsg(_("--- EAPI '%s' does not support '%s': '%s'\n")%117(eapi,os.path.basename(file_name),file_name),118noiselevel=-1)119return()120useflag_re=_get_useflag_re(eapi)121forprefixed_useflaginlines:122ifprefixed_useflag[:1]=="-":123useflag=prefixed_useflag[1:]124else:125useflag=prefixed_useflag126ifuseflag_re.match(useflag)isNone:127writemsg(_("--- Invalid USE flag in '%s': '%s'\n")%128(file_name,prefixed_useflag),noiselevel=-1)129else:130ret.append(prefixed_useflag)131returntuple(ret)

135ret={}136location_dict={}137eapi=read_corresponding_eapi_file(file_name,default=None)138ifeapiisNoneandnotuser_config:139eapi="0"140ifeapiisNone:141ret=ExtendedAtomDict(dict)142else:143ret={}144file_dict=grabdict_package(file_name,recursive=recursive,145allow_wildcard=(eapiisNone),allow_repo=(eapiisNone),146verify_eapi=(eapiisnotNone))147ifeapiisnotNoneandeapi_filterisnotNoneandnoteapi_filter(eapi):148iffile_dict:149writemsg(_("--- EAPI '%s' does not support '%s': '%s'\n")%150(eapi,os.path.basename(file_name),file_name),151noiselevel=-1)152returnret153useflag_re=_get_useflag_re(eapi)154fork,vinfile_dict.items():155useflags=[]156forprefixed_useflaginv:157ifprefixed_useflag[:1]=="-":158useflag=prefixed_useflag[1:]159else:160useflag=prefixed_useflag161ifuseflag_re.match(useflag)isNone:162writemsg(_("--- Invalid USE flag for '%s' in '%s': '%s'\n")%163(k,file_name,prefixed_useflag),noiselevel=-1)164else:165useflags.append(prefixed_useflag)166location_dict.setdefault(k,[]).extend(useflags)167fork,vinlocation_dict.items():168ifjuststrings:169v=" ".join(v)170else:171v=tuple(v)172ret.setdefault(k.cp,{})[k]=v173returnret

238ret={}239forrepoinrepositories.repos_with_profiles():240file_name=os.path.join(repo.location,"profiles","package.use.aliases")241eapi=read_corresponding_eapi_file(file_name)242useflag_re=_get_useflag_re(eapi)243lines=grabfile(file_name,recursive=True)244file_dict={}245forlineinlines:246elements=line.split()247atom=elements[0]248try:249atom=Atom(atom,eapi=eapi)250exceptInvalidAtom:251writemsg(_("--- Invalid atom in '%s': '%s'\n")%(file_name,atom))252continue253iflen(elements)==1:254writemsg(_("--- Missing real USE flag for '%s' in '%s'\n")%(atom,file_name),noiselevel=-1)255continue256real_flag=elements[1]257ifuseflag_re.match(real_flag)isNone:258writemsg(_("--- Invalid real USE flag for '%s' in '%s': '%s'\n")%(atom,file_name,real_flag),noiselevel=-1)259else:260foraliasinelements[2:]:261ifuseflag_re.match(alias)isNone:262writemsg(_("--- Invalid USE flag alias for '%s' real USE flag for '%s' in '%s': '%s'\n")%263(real_flag,atom,file_name,alias),noiselevel=-1)264else:265# Duplicated USE flag aliases in entries for different atoms266# matching the same package version are detected in getUseAliases().267ifany(aliasinvfork,vinfile_dict.get(atom.cp,{}).get(atom,{}).items()ifk!=real_flag):268writemsg(_("--- Duplicated USE flag alias for '%s' in '%s': '%s'\n")%269(atom,file_name,alias),noiselevel=-1)270else:271file_dict.setdefault(atom.cp,{}).setdefault(atom,{}).setdefault(real_flag,[]).append(alias)272ret[repo.name]=file_dict273returnret

276ifself._user_config:277try:278returnpkg.stable279exceptAttributeError:280# KEYWORDS is unavailable (prior to "depend" phase)281returnFalse282283try:284pkg._metadata285exceptAttributeError:286# KEYWORDS is unavailable (prior to "depend" phase)287returnFalse288289# Since repoman uses different config instances for290# different profiles, we have to be careful to do the291# stable check against the correct profile here.292returnself._is_stable(pkg)