diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-08-11 05:46:41 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-08-11 05:46:41 +0000 |
commit | 64c6e78e290f08cd8c1e14405fbcc5e40f4f3cf5 (patch) | |
tree | 435a97cf60bdec903e6f76700461ee74edca0f03 | |
parent | 0db9ef409724fc8dd78fa42a77b7e217f8e53dc5 (diff) | |
download | portage-64c6e78e290f08cd8c1e14405fbcc5e40f4f3cf5.tar.gz portage-64c6e78e290f08cd8c1e14405fbcc5e40f4f3cf5.tar.bz2 portage-64c6e78e290f08cd8c1e14405fbcc5e40f4f3cf5.zip |
Optimize config.setcpv() so that it doesn't call regenerate() unnecessarily when there are no USE wildcards to expand.
svn path=/main/trunk/; revision=7589
-rw-r--r-- | pym/portage/__init__.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 3a91a9b7a..3bb22ef34 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -880,6 +880,7 @@ class config(object): self.user_profile_dir = None self.local_config = local_config + self._use_wildcards = False if clone: self.incrementals = copy.deepcopy(clone.incrementals) @@ -939,6 +940,7 @@ class config(object): self._accept_license = copy.deepcopy(clone._accept_license) self._plicensedict = copy.deepcopy(clone._plicensedict) + self._use_wildcards = copy.deepcopy(clone._use_wildcards) else: # backupenv is for calculated incremental variables. @@ -1270,6 +1272,11 @@ class config(object): 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( @@ -1794,7 +1801,10 @@ class config(object): 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: @@ -2082,6 +2092,7 @@ class config(object): 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): |