summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-12 09:16:17 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-12 09:16:17 +0000
commita1c926e90d60cb8195447f41e5dd06f6bc371fa5 (patch)
tree8b70e0f72690fb9e1ad28893fc7bac65182c2000
parentf4cf7b3da4ffada82b3528f7a93c300a1aaca397 (diff)
downloadportage-a1c926e90d60cb8195447f41e5dd06f6bc371fa5.tar.gz
portage-a1c926e90d60cb8195447f41e5dd06f6bc371fa5.tar.bz2
portage-a1c926e90d60cb8195447f41e5dd06f6bc371fa5.zip
Make binarytree.prevent_collision() adjust permissions on directories
and raise a PermissionDenied error if the required directories is not writable. svn path=/main/trunk/; revision=9850
-rw-r--r--pym/portage/dbapi/bintree.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 785b8c730..fe8b372c2 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -4,7 +4,8 @@
from portage.dep import isvalidatom, isjustname, dep_getkey, match_from_list
from portage.dbapi.virtual import fakedbapi
-from portage.exception import InvalidPackageName, InvalidAtom, PortageException
+from portage.exception import InvalidPackageName, InvalidAtom, \
+ PermissionDenied, PortageException
from portage.output import green
from portage.util import ensure_dirs, normalize_path, writemsg, writemsg_stdout
from portage.versions import best, catpkgsplit, catsplit
@@ -284,6 +285,15 @@ class binarytree(object):
${PKGDIR}/${CATEGORY}/${PF}.tbz2 so that both can coexist."""
if not self._all_directory:
return
+
+ # 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 PermissionDenied("access('%s', W_OK)" % path)
+
full_path = self.getname(cpv)
if "All" == full_path.split(os.path.sep)[-2]:
return