Use binarytree._ensure_dir() to create the binpkg parent dir.
authorZac Medico <zmedico@gentoo.org>
Tue, 17 Aug 2010 18:55:13 +0000 (11:55 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 17 Aug 2010 18:55:13 +0000 (11:55 -0700)
pym/portage/package/ebuild/doebuild.py

index 75dab87382386cc6bfd6df7d63ad0998b8986e16..f77c9a4566a24c00f16842b305a0c2030ecb7e04 100644 (file)
@@ -722,12 +722,17 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                # 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.
-                               parent_dir = os.path.join(mysettings["PKGDIR"],
-                                       mysettings["CATEGORY"])
-                               portage.util.ensure_dirs(parent_dir)
-                               if not os.access(parent_dir, os.W_OK):
-                                       raise PermissionDenied(
-                                               "access('%s', os.W_OK)" % parent_dir)
+                               if hasattr(portage, 'db'):
+                                       bintree = portage.db[mysettings["ROOT"]]["bintree"]
+                                       bintree._ensure_dir(os.path.join(
+                                               bintree.pkgdir, mysettings["CATEGORY"]))
+                               else:
+                                       parent_dir = os.path.join(mysettings["PKGDIR"],
+                                               mysettings["CATEGORY"])
+                                       portage.util.ensure_dirs(parent_dir)
+                                       if not os.access(parent_dir, os.W_OK):
+                                               raise PermissionDenied(
+                                                       "access('%s', os.W_OK)" % parent_dir)
                        retval = spawnebuild(mydo,
                                actionmap, mysettings, debug, logfile=logfile,
                                fd_pipes=fd_pipes, returnpid=returnpid)