Apply INSTALL_MASK prior to collision-protect.
authorZac Medico <zmedico@gentoo.org>
Sat, 14 Jan 2012 15:29:08 +0000 (07:29 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 14 Jan 2012 15:29:08 +0000 (07:29 -0800)
It may be useful to avoid collisions in some scenarios.

pym/_emerge/MiscFunctionsProcess.py
pym/portage/dbapi/vartree.py
pym/portage/package/ebuild/doebuild.py

index ce0ab14325d34e825548f2152efe11d613901aa9..afa44fb2ad0d98aa9e2caef50ff75cfae0ccca15 100644 (file)
@@ -29,5 +29,11 @@ class MiscFunctionsProcess(AbstractEbuildProcess):
                AbstractEbuildProcess._start(self)
 
        def _spawn(self, args, **kwargs):
-               self.settings.pop("EBUILD_PHASE", None)
-               return spawn(" ".join(args), self.settings, **kwargs)
+               # Temporarily unset EBUILD_PHASE so that bashrc code doesn't
+               # think this is a real phase.
+               phase_backup = self.settings.pop("EBUILD_PHASE", None)
+               try:
+                       return spawn(" ".join(args), self.settings, **kwargs)
+               finally:
+                       if phase_backup is not None:
+                               self.settings["EBUILD_PHASE"] = phase_backup
index af70ec3fe0ba37e2f1e4c1d2982ece39401bb31a..5bb4fa4048dd6ab818196d11577ca5bf7ea2654c 100644 (file)
@@ -3506,14 +3506,6 @@ class dblink(object):
                        if installed_files:
                                return 1
 
-               # check for package collisions
-               blockers = self._blockers
-               if blockers is None:
-                       blockers = []
-               collisions, symlink_collisions, plib_collisions = \
-                       self._collision_protect(srcroot, destroot,
-                       others_in_slot + blockers, myfilelist, mylinklist)
-
                # Make sure the ebuild environment is initialized and that ${T}/elog
                # exists for logging of collision-protect eerror messages.
                if myebuild is None:
@@ -3525,6 +3517,23 @@ class dblink(object):
                        for other in others_in_slot])
                prepare_build_dirs(settings=self.settings, cleanup=cleanup)
 
+               if self.settings.get("INSTALL_MASK"):
+                       # Apply INSTALL_MASK before collision-protect, since it may
+                       # be useful to avoid collisions in some scenarios.
+                       phase = MiscFunctionsProcess(background=False,
+                               commands=["preinst_mask"], phase="preinst",
+                               scheduler=self._scheduler, settings=self.settings)
+                       phase.start()
+                       phase.wait()
+
+               # check for package collisions
+               blockers = self._blockers
+               if blockers is None:
+                       blockers = []
+               collisions, symlink_collisions, plib_collisions = \
+                       self._collision_protect(srcroot, destroot,
+                       others_in_slot + blockers, myfilelist, mylinklist)
+
                if collisions:
                        collision_protect = "collision-protect" in self.settings.features
                        protect_owned = "protect-owned" in self.settings.features
index cb7cc1cb3f8672b0334dd227b3ed436dcc5a831c..c52ab3120fd90f0dc70d6806b4a8f4db1ef97720 100644 (file)
@@ -1487,7 +1487,7 @@ _post_phase_cmds = {
                "preinst_sfperms",
                "preinst_selinux_labels",
                "preinst_suid_scan",
-               "preinst_mask"]
+               ]
 }
 
 def _post_phase_userpriv_perms(mysettings):