Fix update_dbentry() to process version components properly before passing them into...
authorZac Medico <zmedico@gentoo.org>
Wed, 22 Aug 2007 21:39:45 +0000 (21:39 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 22 Aug 2007 21:39:45 +0000 (21:39 -0000)
svn path=/main/branches/2.1.2/; revision=7669

pym/portage_update.py

index f1cf7c6e566c2e18de22ca3c799819941be93c1a..bfbc90c6a5abe7c0ac07376368e66c53f2dc173c 100644 (file)
@@ -8,7 +8,8 @@ from portage_util import ConfigProtect, grabfile, new_protect_filename, \
        normalize_path, write_atomic, writemsg
 from portage_exception import DirectoryNotFound, PortageException
 from portage_versions import ververify
-from portage_dep import dep_getkey, get_operator, isvalidatom, isjustname
+from portage_dep import dep_getkey, get_operator, isvalidatom, isjustname, \
+       remove_slot
 from portage_const import USER_CONFIG_PATH, WORLD_FILE
 
 ignored_dbentries = ("CONTENTS", "environment.bz2")
@@ -20,7 +21,11 @@ def update_dbentry(update_cmd, mycontent):
                        old_value = re.escape(old_value);
                        mycontent = re.sub(old_value+"(:|$|\\s)", new_value+"\\1", mycontent)
                        def myreplace(matchobj):
-                               if ververify(matchobj.group(2)):
+                               # Strip slot and * operator if necessary
+                               # so that ververify works.
+                               ver = remove_slot(matchobj.group(2))
+                               ver = ver.rstrip("*")
+                               if ververify(ver):
                                        return "%s-%s" % (new_value, matchobj.group(2))
                                else:
                                        return "".join(matchobj.groups())