diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-08-11 05:49:35 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-08-11 05:49:35 +0000 |
commit | 0ab2f73acbe60e3b0a8d2f1834eff1630d5f8c75 (patch) | |
tree | 8b5ffbe6505799e339a8a7b654fe0daeb42d6836 | |
parent | 2d47e5ee3f6b451bebdda6a75495820af54e4af3 (diff) | |
download | portage-0ab2f73acbe60e3b0a8d2f1834eff1630d5f8c75.tar.gz portage-0ab2f73acbe60e3b0a8d2f1834eff1630d5f8c75.tar.bz2 portage-0ab2f73acbe60e3b0a8d2f1834eff1630d5f8c75.zip |
Optimize config.setcpv() so that it doesn't call regenerate() unnecessarily when there are no USE wildcards to expand. (trunk r7589)
svn path=/main/branches/2.1.2/; revision=7590
-rw-r--r-- | pym/portage.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pym/portage.py b/pym/portage.py index 2ef8ea92d..e8bcc0ec2 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -986,6 +986,7 @@ class config: self.user_profile_dir = None self.local_config = local_config + self._use_wildcards = False if clone: self.incrementals = copy.deepcopy(clone.incrementals) @@ -1042,6 +1043,7 @@ class config: self.dirVirtuals = copy.deepcopy(clone.dirVirtuals) self.treeVirtuals = copy.deepcopy(clone.treeVirtuals) self.features = copy.deepcopy(clone.features) + self._use_wildcards = copy.deepcopy(clone._use_wildcards) else: # backupenv is for calculated incremental variables. @@ -1380,6 +1382,11 @@ class config: if not self.pusedict.has_key(cp): self.pusedict[cp] = {} self.pusedict[cp][key] = pusedict[key] + if not self._use_wildcards: + for x in pusedict[key]: + if x.endswith("_*"): + self._use_wildcards = True + break #package.keywords pkgdict = grabdict_package( @@ -1806,7 +1813,10 @@ class config: self.configdict["pkg"]["USE"] = self.puse[:] # this gets appended to USE if iuse != self.configdict["pkg"].get("IUSE",""): self.configdict["pkg"]["IUSE"] = iuse - has_changed = True + if self._use_wildcards: + # Without this conditional, regenerate() would be called + # *every* time. + has_changed = True # CATEGORY is essential for doebuild calls self.configdict["pkg"]["CATEGORY"] = mycpv.split("/")[0] if has_changed: @@ -2033,6 +2043,7 @@ class config: has_wildcard = "*" in var_split if has_wildcard: var_split = [ x for x in var_split if x != "*" ] + self._use_wildcards = True has_iuse = False for x in iuse: if x.startswith(prefix): |