Use isjustname() where appropriate.
authorZac Medico <zmedico@gentoo.org>
Sat, 12 Sep 2009 18:10:03 +0000 (18:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 12 Sep 2009 18:10:03 +0000 (18:10 -0000)
svn path=/main/trunk/; revision=14236

bin/egencache
pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py
pym/portage/update.py

index db0eb622d8fb3a8131dbb970472dd79ada07cc57..2b3af4e5080150ea321ab05e46705621bd0a5ae9 100755 (executable)
@@ -34,6 +34,7 @@ from _emerge.MetadataRegen import MetadataRegen
 from portage.cache.cache_errors import CacheError, StatCollision
 from portage.util import writemsg_level
 from portage import cpv_getkey
+from portage.dep import isjustname
 
 def parse_args(args):
        usage = "egencache [options] --update [atom] ..."
@@ -112,7 +113,7 @@ def parse_args(args):
                except portage.exception.InvalidAtom:
                        parser.error('Invalid atom: %s' % (atom,))
 
-               if str(atom) != atom.cp:
+               if not isjustname(atom):
                        parser.error('Atom is too specific: %s' % (atom,))
 
        return parser, options, args
index 734eb541839a1231deef212ef74fab4088118ea1..d15953735e17fd11f45982dd6f62589b3cc22f8f 100644 (file)
@@ -6,7 +6,7 @@ __all__ = ["bindbapi", "binarytree"]
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
-       'portage.dep:dep_getkey,match_from_list',
+       'portage.dep:dep_getkey,isjustname,match_from_list',
        'portage.output:EOutput,colorize',
        'portage.update:update_dbentries',
        'portage.util:ensure_dirs,normalize_path,writemsg,writemsg_stdout',
@@ -231,7 +231,7 @@ class binarytree(object):
                newcp = mylist[2]
                # sanity check
                for atom in (origcp, newcp):
-                       if atom.cp != atom:
+                       if not isjustname(atom):
                                raise InvalidPackageName(str(atom))
                origcat = origcp.split("/")[0]
                mynewcat = newcp.split("/")[0]
index 23c76bce4ac6d15426fd1aed18832a163cf51b19..da7426880e728e9d2841f51b1ef306ec6fe6dab0 100644 (file)
@@ -9,7 +9,7 @@ __all__ = ["PreservedLibsRegistry", "LinkageMap",
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
        'portage.checksum:_perform_md5_merge@perform_md5',
-       'portage.dep:dep_getkey,match_from_list,' + \
+       'portage.dep:dep_getkey,isjustname,match_from_list,' + \
                'use_reduce,paren_reduce',
        'portage.elog:elog_process',
        'portage.elog.filtering:filter_mergephases,filter_unmergephases',
@@ -874,7 +874,7 @@ class vardbapi(dbapi):
 
                # sanity check
                for atom in (origcp, newcp):
-                       if atom.cp != atom:
+                       if not isjustname(atom):
                                raise InvalidPackageName(str(atom))
                origmatches = self.match(origcp, use_cache=0)
                moves = 0
index 069f1008744b9752fd997ed192547f2ac8949642..251da88a432ea402158ef6a46be792c7f795f218 100644 (file)
@@ -13,7 +13,8 @@ from portage import _unicode_decode
 from portage import _unicode_encode
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
-       'portage.dep:Atom,dep_getkey,get_operator,isvalidatom,remove_slot',
+       'portage.dep:Atom,dep_getkey,get_operator,isjustname,isvalidatom,' + \
+       'remove_slot',
        'portage.util:ConfigProtect,grabfile,new_protect_filename,' + \
                'normalize_path,write_atomic,writemsg',
        'portage.versions:ververify'