From: Zac Medico Date: Thu, 5 Oct 2006 11:15:05 +0000 (-0000) Subject: Fix package moves/slotmoves to work with slot deps. X-Git-Tag: v2.1.2~708 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8c38f4f5e3538dd948eba1cdc2647d930d63743b;p=portage.git Fix package moves/slotmoves to work with slot deps. svn path=/main/trunk/; revision=4597 --- diff --git a/pym/portage_update.py b/pym/portage_update.py index b6a724560..f96227789 100644 --- a/pym/portage_update.py +++ b/pym/portage_update.py @@ -7,6 +7,7 @@ import errno, os, re, sys 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, isvalidatom, isjustname from portage_const import USER_CONFIG_PATH, WORLD_FILE @@ -17,10 +18,20 @@ def update_dbentry(update_cmd, mycontent): old_value, new_value = update_cmd[1], update_cmd[2] if mycontent.count(old_value): old_value = re.escape(old_value); - mycontent = re.sub(old_value+"$", new_value, mycontent) - mycontent = re.sub(old_value+"(\\s)", new_value+"\\1", mycontent) - mycontent = re.sub(old_value+"(-[^a-zA-Z])", new_value+"\\1", mycontent) - mycontent = re.sub(old_value+"([^a-zA-Z0-9-])", new_value+"\\1", mycontent) + mycontent = re.sub(old_value+"(:|$|\\s)", new_value+"\\1", mycontent) + def myreplace(matchobj): + if ververify(matchobj.group(2)): + return "%s-%s" % (new_value, matchobj.group(2)) + else: + return "".join(matchobj.groups()) + mycontent = re.sub("(%s-)(\\S*)" % old_value, myreplace, mycontent) + elif update_cmd[0] == "slotmove": + pkg, origslot, newslot = update_cmd[1:] + old_value = "%s:%s" % (pkg, origslot) + if mycontent.count(old_value): + old_value = re.escape(old_value) + new_value = "%s:%s" % (pkg, newslot) + mycontent = re.sub(old_value+"($|\\s)", new_value+"\\1", mycontent) return mycontent def update_dbentries(update_iter, mydata):