From a1c926e90d60cb8195447f41e5dd06f6bc371fa5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 12 Apr 2008 09:16:17 +0000 Subject: 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 --- pym/portage/dbapi/bintree.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'pym') 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 -- cgit v1.2.3-1-g7c22