Simplify and fix bugs in is_valid_package_atom(). (trunk r8445)
authorZac Medico <zmedico@gentoo.org>
Tue, 6 Nov 2007 10:05:07 +0000 (10:05 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 6 Nov 2007 10:05:07 +0000 (10:05 -0000)
svn path=/main/branches/2.1.2/; revision=8446

bin/emerge

index 947096388cc00da0fc033b059a4711680e20fbef..7eb9fbeabe24169524e3720b3700133aeeb54c9d 100755 (executable)
@@ -4571,17 +4571,11 @@ def chk_updated_cfg_files(target_root, config_protect):
                        print " "+yellow("*")+" man page to learn how to update config files."
 
 def is_valid_package_atom(x):
-       try:
-               testkey = portage.dep_getkey(x)
-       except portage_exception.InvalidData:
-               return False
-       if testkey.startswith("null/"):
-               testatom = x.replace(testkey[5:], "cat/"+testkey[5:])
-       elif "/" not in x:
-               testatom = "cat/"+x
-       else:
-               testatom = x
-       return portage.isvalidatom(testatom)
+       if "/" not in x:
+               alphanum = re.search(r'\w', x)
+               if alphanum:
+                       x = x[:alphanum.start()] + "cat/" + x[alphanum.start():]
+       return portage.isvalidatom(x)
 
 def show_blocker_docs_link():
        print