Move code for handling missing sandbox binary out of the config constructor.
authorZac Medico <zmedico@gentoo.org>
Sun, 6 Dec 2009 11:01:05 +0000 (11:01 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 6 Dec 2009 11:01:05 +0000 (11:01 -0000)
(trunk r14930)

svn path=/main/branches/2.1.7/; revision=14944

pym/portage/__init__.py

index 62c4d3b364878e169331bb823710baa43386c48f..d169ab114095d9b512d4bf199c87aa17a707c5a4 100644 (file)
@@ -2192,21 +2192,6 @@ class config(object):
                        # initialize self.features
                        self.regenerate()
 
-                       if not portage.process.sandbox_capable and \
-                               ("sandbox" in self.features or "usersandbox" in self.features):
-                               if self.profile_path is not None and \
-                                       os.path.realpath(self.profile_path) == \
-                                       os.path.realpath(os.path.join(config_root, PROFILE_PATH)):
-                                       """ Don't show this warning when running repoman and the
-                                       sandbox feature came from a profile that doesn't belong to
-                                       the user."""
-                                       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")
-
                        if bsd_chflags:
                                self.features.add('chflags')
 
@@ -2340,6 +2325,18 @@ class config(object):
                        writemsg("!!! /etc/portage/profile/virtuals. Please move it to\n")
                        writemsg("!!! this new location.\n\n")
 
+               if not process.sandbox_capable and \
+                       ("sandbox" in self.features or "usersandbox" in self.features):
+                       if self.profile_path is not None and \
+                               os.path.realpath(self.profile_path) == \
+                               os.path.realpath(os.path.join(
+                               self["PORTAGE_CONFIGROOT"], PROFILE_PATH)):
+                               # Don't show this warning when running repoman and the
+                               # sandbox feature came from a profile that doesn't belong
+                               # to the user.
+                               writemsg(colorize("BAD", _("!!! Problem with sandbox"
+                                       " binary. Disabling...\n\n")), noiselevel=-1)
+
                if "fakeroot" in self.features and \
                        not portage.process.fakeroot_capable:
                        writemsg(_("!!! FEATURES=fakeroot is enabled, but the "
@@ -4103,6 +4100,9 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
                        (not droppriv and "sandbox" not in features and \
                        "usersandbox" not in features and not fakeroot))
 
+       if not free and not (fakeroot or process.sandbox_capable):
+               free = True
+
        if free or "SANDBOX_ACTIVE" in os.environ:
                keywords["opt_name"] += " bash"
                spawn_func = portage.process.spawn_bash
@@ -7258,6 +7258,9 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                        nosandbox = ("sandbox" not in features and \
                                "usersandbox" not in features)
 
+               if not process.sandbox_capable:
+                       nosandbox = True
+
                sesandbox = mysettings.selinux_enabled() and \
                        "sesandbox" in mysettings.features