Make binarytree.prevent_collision() adjust permissions on directories
authorZac Medico <zmedico@gentoo.org>
Sat, 12 Apr 2008 09:23:06 +0000 (09:23 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 12 Apr 2008 09:23:06 +0000 (09:23 -0000)
and raise a PermissionDenied error if the required directories is
not writable. (trunk r9850)

svn path=/main/branches/2.1.2/; revision=9851

bin/emerge
pym/portage.py

index 8f12145a7e44349cdd984f76a1f877b2a74952af..3420abc55f0db4a21699503ce3ebc6e1e6b52ec7 100755 (executable)
@@ -4960,12 +4960,6 @@ class MergeTask(object):
                                                bintree = self.trees[myroot]["bintree"]
                                                if bintree.populated:
                                                        bintree.inject(pkg_key)
-                                               else:
-                                                       # Copy group permissions for new directories that
-                                                       # may have been created.
-                                                       for path in ("All", portage.catsplit(pkg.cpv)[0]):
-                                                               bintree._ensure_dir(
-                                                                       os.path.join(bintree.pkgdir, path))
                                                if "--buildpkgonly" not in self.myopts:
                                                        msg = " === (%s of %s) Merging (%s::%s)" % \
                                                                (mergecount, len(mymergelist), pkg_key, y)
index 5f829ac0d1246a4570a7c74f18f8af942441de0d..aa5234ca7ef703fa609ed28853867050ee701ff3 100644 (file)
@@ -7901,6 +7901,16 @@ class binarytree(object):
                use for a given cpv.  If a collision will occur with an existing
                package from another category, the existing package will be bumped to
                ${PKGDIR}/${CATEGORY}/${PF}.tbz2 so that both can coexist."""
+
+               # Copy group permissions for new directories that
+               # may have been created.
+               for path in ("All", catsplit(cpv)[0]):
+                       path = os.path.join(self.pkgdir, path)
+                       self._ensure_dir(path)
+                       if not os.access(path, os.W_OK):
+                               raise portage_exception.PermissionDenied(
+                                       "access('%s', W_OK)" % path)
+
                if not self.populated:
                        # Try to avoid the population routine when possible, so that
                        # FEATURES=buildpkg doesn't always force population.