summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-10-05 11:15:05 +0000
committerZac Medico <zmedico@gentoo.org>2006-10-05 11:15:05 +0000
commit8c38f4f5e3538dd948eba1cdc2647d930d63743b (patch)
treea3b098e5c5c1c33910710414d82eb957c7ff17b6
parentb2b9ffe2b6c8ae8cd4cdce4dbc2f210fd3468241 (diff)
downloadportage-8c38f4f5e3538dd948eba1cdc2647d930d63743b.tar.gz
portage-8c38f4f5e3538dd948eba1cdc2647d930d63743b.tar.bz2
portage-8c38f4f5e3538dd948eba1cdc2647d930d63743b.zip
Fix package moves/slotmoves to work with slot deps.
svn path=/main/trunk/; revision=4597
-rw-r--r--pym/portage_update.py19
1 files changed, 15 insertions, 4 deletions
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):