summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-07-20 08:12:02 +0000
committerZac Medico <zmedico@gentoo.org>2006-07-20 08:12:02 +0000
commit6106e21f0c449cd6cbec37b575c8a6fe3f582820 (patch)
tree8f82776ad5bf5e4234d3ae2f8050a1ac178b9eeb
parent9f3c3b2440ee8170419ddb7f7c862cd611715d33 (diff)
downloadportage-6106e21f0c449cd6cbec37b575c8a6fe3f582820.tar.gz
portage-6106e21f0c449cd6cbec37b575c8a6fe3f582820.tar.bz2
portage-6106e21f0c449cd6cbec37b575c8a6fe3f582820.zip
Remove redundant initialization of self.features (and self.regenerate() call) for cloned config instances.
svn path=/main/trunk/; revision=3967
-rw-r--r--pym/portage.py63
1 files changed, 27 insertions, 36 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 6f57c1795..f289acc6b 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -891,6 +891,7 @@ class config:
self.pprovideddict = copy.deepcopy(clone.pprovideddict)
self.dirVirtuals = copy.deepcopy(clone.dirVirtuals)
self.treeVirtuals = copy.deepcopy(clone.treeVirtuals)
+ self.features = copy.deepcopy(clone.features)
else:
# backupenv is for calculated incremental variables.
@@ -1236,43 +1237,33 @@ class config:
if clone is None:
self.regenerate()
self.features = portage_util.unique_array(self["FEATURES"].split())
- else:
- # XXX
- # The below self.regenerate() causes previous changes to FEATURES
- # (and other incrementals) to be reverted. If this instance is a
- # clone, we need to take the cloned FEATURES from backupenv and
- # save them where the regenerate() call will not destroy them.
- # Later, we use backup_changes() to restore the cloned FEATURES
- # into the backupenv once again.
- self.features = portage_util.unique_array(
- self.backupenv["FEATURES"].split())
- self.regenerate()
- #XXX: Should this be temporary? Is it possible at all to have a default?
- if "gpg" in self.features:
- if not os.path.exists(self["PORTAGE_GPG_DIR"]) or not os.path.isdir(self["PORTAGE_GPG_DIR"]):
- writemsg("PORTAGE_GPG_DIR is invalid. Removing gpg from FEATURES.\n",
- noiselevel=-1)
- self.features.remove("gpg")
-
- if not portage_exec.sandbox_capable and \
- ("sandbox" in self.features or "usersandbox" in self.features):
- if os.environ.get("PORTAGE_CALLER","") == "repoman" and \
- self.profile_path is not None and \
- os.path.realpath(self.profile_path) != \
- os.path.realpath(PROFILE_PATH):
- pass # This profile does not belong to the user running repoman.
- else:
- writemsg(red("!!! Problem with sandbox binary. Disabling...\n\n"),
- noiselevel=-1)
- if "sandbox" in self.features:
- self.features.remove("sandbox")
- if "usersandbox" in self.features:
- self.features.remove("usersandbox")
-
- self.features.sort()
- self["FEATURES"] = " ".join(self.features)
- self.backup_changes("FEATURES")
+ if "gpg" in self.features:
+ if not os.path.exists(self["PORTAGE_GPG_DIR"]) or \
+ not os.path.isdir(self["PORTAGE_GPG_DIR"]):
+ writemsg(colorize("BAD", "PORTAGE_GPG_DIR is invalid." + \
+ " Removing gpg from FEATURES.\n"), noiselevel=-1)
+ self.features.remove("gpg")
+
+ if not portage_exec.sandbox_capable and \
+ ("sandbox" in self.features or "usersandbox" in self.features):
+ if os.environ.get("PORTAGE_CALLER","") == "repoman" and \
+ self.profile_path is not None and \
+ os.path.realpath(self.profile_path) != \
+ os.path.realpath(PROFILE_PATH):
+ # This profile does not belong to the user running repoman.
+ pass
+ else:
+ writemsg(colorize("BAD", "!!! Problem with sandbox" + \
+ " binary. Disabling...\n\n"), noiselevel=-1)
+ if "sandbox" in self.features:
+ self.features.remove("sandbox")
+ if "usersandbox" in self.features:
+ self.features.remove("usersandbox")
+
+ self.features.sort()
+ self["FEATURES"] = " ".join(self.features)
+ self.backup_changes("FEATURES")
if mycpv:
self.setcpv(mycpv)