summaryrefslogtreecommitdiffstats
path: root/pym/portage/update.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-05-20 19:59:53 +0000
committerZac Medico <zmedico@gentoo.org>2007-05-20 19:59:53 +0000
commit544d9a24d05465a00b05d52c428041abb4e0739c (patch)
tree4e7f9bdd0c8bae0e12e74e60fc0a64a3ecbe4b86 /pym/portage/update.py
parent354a199f48d247fdabfcf49f2edf4183be770001 (diff)
downloadportage-544d9a24d05465a00b05d52c428041abb4e0739c.tar.gz
portage-544d9a24d05465a00b05d52c428041abb4e0739c.tar.bz2
portage-544d9a24d05465a00b05d52c428041abb4e0739c.zip
For bug #179206, improve efficiency by using a containment test instead of str.count inside update_dbentry. Thanks to Jason Lai <jason.lai@gmail.com>.
svn path=/main/trunk/; revision=6560
Diffstat (limited to 'pym/portage/update.py')
-rw-r--r--pym/portage/update.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pym/portage/update.py b/pym/portage/update.py
index 472eebe96..34c91224b 100644
--- a/pym/portage/update.py
+++ b/pym/portage/update.py
@@ -16,7 +16,7 @@ ignored_dbentries = ("CONTENTS", "environment.bz2")
def update_dbentry(update_cmd, mycontent):
if update_cmd[0] == "move":
old_value, new_value = update_cmd[1], update_cmd[2]
- if mycontent.count(old_value):
+ if old_value in mycontent:
old_value = re.escape(old_value);
mycontent = re.sub(old_value+"(:|$|\\s)", new_value+"\\1", mycontent)
def myreplace(matchobj):
@@ -28,7 +28,7 @@ def update_dbentry(update_cmd, mycontent):
elif update_cmd[0] == "slotmove" and get_operator(update_cmd[1]) is None:
pkg, origslot, newslot = update_cmd[1:]
old_value = "%s:%s" % (pkg, origslot)
- if mycontent.count(old_value):
+ if old_value in mycontent:
old_value = re.escape(old_value)
new_value = "%s:%s" % (pkg, newslot)
mycontent = re.sub(old_value+"($|\\s)", new_value+"\\1", mycontent)