From 6106e21f0c449cd6cbec37b575c8a6fe3f582820 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 20 Jul 2006 08:12:02 +0000 Subject: [PATCH] Remove redundant initialization of self.features (and self.regenerate() call) for cloned config instances. svn path=/main/trunk/; revision=3967 --- pym/portage.py | 63 ++++++++++++++++++++++---------------------------- 1 file 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) -- 2.26.2