diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-04-11 19:55:50 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-04-11 19:55:50 +0000 |
commit | 0fef5ac4a6d62a2bd55e6370c7520c174bdfca34 (patch) | |
tree | c7e4cb3804adddc9a246051c762a89b8528d2188 | |
parent | 8773ae09606fbc8bdb04abaf62b66cec2eb18d4c (diff) | |
download | portage-0fef5ac4a6d62a2bd55e6370c7520c174bdfca34.tar.gz portage-0fef5ac4a6d62a2bd55e6370c7520c174bdfca34.tar.bz2 portage-0fef5ac4a6d62a2bd55e6370c7520c174bdfca34.zip |
Make doebuild() bail out early with a PermissionDenied error if there
is no write access to $PKGDIR. (trunk r9837)
svn path=/main/branches/2.1.2/; revision=9838
-rw-r--r-- | pym/portage.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pym/portage.py b/pym/portage.py index d54bc973c..aae53d20d 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -5005,10 +5005,15 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, if mydo in actionmap: if mydo=="package": - portage_util.ensure_dirs( - os.path.join(mysettings["PKGDIR"], mysettings["CATEGORY"])) - portage_util.ensure_dirs( - os.path.join(mysettings["PKGDIR"], "All")) + # Make sure the package directory exists before executing + # this phase. This can raise PermissionDenied if + # the current user doesn't have write access to $PKGDIR. + for parent_dir in ("All", mysettings["CATEGORY"]): + parent_dir = os.path.join(mysettings["PKGDIR"], parent_dir) + portage_util.ensure_dirs(parent_dir) + if not os.access(parent_dir, os.W_OK): + raise portage_exception.PermissionDenied( + "access('%s', os.W_OK)" % parent_dir) retval = spawnebuild(mydo, actionmap, mysettings, debug, logfile=logfile) elif mydo=="qmerge": |