summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-07-08 22:55:27 +0000
committerZac Medico <zmedico@gentoo.org>2006-07-08 22:55:27 +0000
commit8428ded43bea8f91ba6879998b9501550c780b36 (patch)
tree738c07e96b074117624a5cf8fced0c586c08f02b
parent00185e8024c1c3b130c7f31d3ca9ae4168a61ce1 (diff)
downloadportage-8428ded43bea8f91ba6879998b9501550c780b36.tar.gz
portage-8428ded43bea8f91ba6879998b9501550c780b36.tar.bz2
portage-8428ded43bea8f91ba6879998b9501550c780b36.zip
Use set.intersection() to simplify --newuse comparison.
svn path=/main/trunk/; revision=3814
-rwxr-xr-xbin/emerge21
1 files changed, 11 insertions, 10 deletions
diff --git a/bin/emerge b/bin/emerge
index b5f203cb0..792168fcc 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -41,6 +41,8 @@ import portage_locks
import portage_exception
from portage_data import secpass
+if not hasattr(__builtins__, "set"):
+ from sets import Set as set
class stdout_spinner(object):
scroll_msgs = [
@@ -710,13 +712,13 @@ class depgraph:
vardbapi.cpv_exists(mykey):
old_use = vardbapi.aux_get(mykey, ["USE"])[0].split()
if mytype == "binary":
- iuses = bindb.aux_get(mykey, ["IUSE"])[0].split()
+ iuses = set(bindb.aux_get(mykey, ["IUSE"])[0].split())
else:
- iuses = portdb.aux_get(mykey, ["IUSE"])[0].split()
- for x in iuses:
- if (old_use.count(x) and not myuse.count(x)) or (not old_use.count(x) and myuse.count(x)):
+ iuses = set(portdb.aux_get(mykey, ["IUSE"])[0].split())
+ if iuses.intersection(old_use) != \
+ iuses.intersection(myuse):
merging=1
- break
+
else: # Not addme
merging=2 # Quick hack to make --onlydeps continue with dep parsing but not merging
if merging==1:
@@ -1044,14 +1046,13 @@ class depgraph:
if not myeb_pkg:
myeb_pkg = None
elif "--newuse" in self.myopts:
- iuses = bindb.aux_get(myeb_pkg, ["IUSE"])[0].split()
+ iuses = set(bindb.aux_get(myeb_pkg, ["IUSE"])[0].split())
old_use = bindb.aux_get(myeb_pkg, ["USE"])[0].split()
pkgsettings.setcpv(myeb_pkg)
now_use = pkgsettings["USE"].split()
- for x in iuses:
- if (old_use.count(x) and not now_use.count(x)) or (not old_use.count(x) and now_use.count(x)):
- myeb_pkg = None
- break
+ if iuses.intersection(old_use) != \
+ iuses.intersection(now_use):
+ myeb_pkg = None
if (not myeb) and (not myeb_pkg):
if raise_on_missing: