Make dbapi.move_ent() take advantage of Atom instances when validating
authorZac Medico <zmedico@gentoo.org>
Sat, 12 Sep 2009 16:29:23 +0000 (16:29 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 12 Sep 2009 16:29:23 +0000 (16:29 -0000)
arguments.

svn path=/main/trunk/; revision=14232

pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py

index b96f4d4faf8a5b1dd2ea384941bba69991094cba..734eb541839a1231deef212ef74fab4088118ea1 100644 (file)
@@ -6,7 +6,7 @@ __all__ = ["bindbapi", "binarytree"]
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
-       'portage.dep:dep_getkey,isjustname,isvalidatom,match_from_list',
+       'portage.dep:dep_getkey,match_from_list',
        'portage.output:EOutput,colorize',
        'portage.update:update_dbentries',
        'portage.util:ensure_dirs,normalize_path,writemsg,writemsg_stdout',
@@ -230,9 +230,9 @@ class binarytree(object):
                origcp = mylist[1]
                newcp = mylist[2]
                # sanity check
-               for cp in [origcp, newcp]:
-                       if not (isvalidatom(cp) and isjustname(cp)):
-                               raise InvalidPackageName(cp)
+               for atom in (origcp, newcp):
+                       if atom.cp != atom:
+                               raise InvalidPackageName(str(atom))
                origcat = origcp.split("/")[0]
                mynewcat = newcp.split("/")[0]
                origmatches=self.dbapi.cp_list(origcp)
index 905dc9c3013cf688d16c0ed607f1f681505db30b..23c76bce4ac6d15426fd1aed18832a163cf51b19 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,isjustname,isvalidatom,match_from_list,' + \
+       'portage.dep:dep_getkey,match_from_list,' + \
                'use_reduce,paren_reduce',
        'portage.elog:elog_process',
        'portage.elog.filtering:filter_mergephases,filter_unmergephases',
@@ -873,9 +873,9 @@ class vardbapi(dbapi):
                newcp = mylist[2]
 
                # sanity check
-               for cp in [origcp, newcp]:
-                       if not (isvalidatom(cp) and isjustname(cp)):
-                               raise InvalidPackageName(cp)
+               for atom in (origcp, newcp):
+                       if atom.cp != atom:
+                               raise InvalidPackageName(str(atom))
                origmatches = self.match(origcp, use_cache=0)
                moves = 0
                if not origmatches:
@@ -1767,7 +1767,6 @@ class vartree(object):
                                returnme.append(appendme)
                return returnme
 
-
        def getslot(self, mycatpkg):
                "Get a slot for a catpkg; assume it exists."
                try: