summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-04-06 20:54:11 -0700
committerZac Medico <zmedico@gentoo.org>2010-04-06 20:54:11 -0700
commitee0b00baf07f18c23a180da5efd78fe01335364b (patch)
tree37fe4631d00ee1d7b09db70eef214dac976acd2d
parentce921f3ccba0cf1f1568b4a8ecc39a8b90f75349 (diff)
downloadportage-ee0b00baf07f18c23a180da5efd78fe01335364b.tar.gz
portage-ee0b00baf07f18c23a180da5efd78fe01335364b.tar.bz2
portage-ee0b00baf07f18c23a180da5efd78fe01335364b.zip
Make ensure_dirs() behave correctly for DragonFly when EPERM is raised for
makedir('/'). Thanks to Naohiro Aota <naota@elisp.net> for the initial patch.
-rw-r--r--pym/portage/util/__init__.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 541204334..ac191fb2a 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1046,14 +1046,19 @@ def ensure_dirs(dir_path, *args, **kwargs):
func_call = "makedirs('%s')" % dir_path
if oe.errno in (errno.EEXIST, errno.EISDIR):
pass
- elif oe.errno == errno.EPERM:
- raise OperationNotPermitted(func_call)
- elif oe.errno == errno.EACCES:
- raise PermissionDenied(func_call)
- elif oe.errno == errno.EROFS:
- raise ReadOnlyFileSystem(func_call)
else:
- raise
+ if os.path.isdir(dir_path):
+ # NOTE: DragonFly raises EPERM for makedir('/')
+ # and that is supposed to be ignored here.
+ pass
+ elif oe.errno == errno.EPERM:
+ raise OperationNotPermitted(func_call)
+ elif oe.errno == errno.EACCES:
+ raise PermissionDenied(func_call)
+ elif oe.errno == errno.EROFS:
+ raise ReadOnlyFileSystem(func_call)
+ else:
+ raise
perms_modified = apply_permissions(dir_path, *args, **kwargs)
return created_dir or perms_modified