diff options
author | David James <davidjames@google.com> | 2010-07-13 17:03:21 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-31 18:14:25 -0700 |
commit | a2bc929364a83bd4c7fb6f3f6c136394e974b6a3 (patch) | |
tree | cf78e9030ddf3d925d8e0df739193d7d65246e3a | |
parent | cb27c41a2d03209f07bc12f85c991537270dbb0e (diff) | |
download | portage-a2bc929364a83bd4c7fb6f3f6c136394e974b6a3.tar.gz portage-a2bc929364a83bd4c7fb6f3f6c136394e974b6a3.tar.bz2 portage-a2bc929364a83bd4c7fb6f3f6c136394e974b6a3.zip |
Fix portage to create directories atomically in fast build.
If multiple ebuild processes create the same directory, portage should not
exit with an error message. Instead we should just be okay with the fact
that another process created the directory.
This is only necessary for fast build because we eliminate the giant lock that
surrounds package merges.
TEST=Create fresh chroot and do full build from source start to finish
BUG=none
Review URL: http://codereview.chromium.org/2998002
-rw-r--r-- | pym/portage/dbapi/vartree.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 923e96297..4a95567b9 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -3613,21 +3613,32 @@ class dblink(object): showMessage(_("bak %s %s.backup\n") % (mydest, mydest), level=logging.ERROR, noiselevel=-1) #now create our directory - if self.settings.selinux_enabled(): - _selinux_merge.mkdir(mydest, mysrc) - else: - os.mkdir(mydest) + try: + if self.settings.selinux_enabled(): + _selinux_merge.mkdir(mydest, mysrc) + else: + os.mkdir(mydest) + except OSError as e: + if e.errno != errno.EEXIST: + raise + del e + if bsd_chflags: bsd_chflags.lchflags(mydest, dflags) os.chmod(mydest, mystat[0]) os.chown(mydest, mystat[4], mystat[5]) showMessage(">>> %s/\n" % mydest) else: - #destination doesn't exist - if self.settings.selinux_enabled(): - _selinux_merge.mkdir(mydest, mysrc) - else: - os.mkdir(mydest) + try: + #destination doesn't exist + if self.settings.selinux_enabled(): + _selinux_merge.mkdir(mydest, mysrc) + else: + os.mkdir(mydest) + except OSError as e: + if e.errno != errno.EEXIST: + raise + del e os.chmod(mydest, mystat[0]) os.chown(mydest, mystat[4], mystat[5]) showMessage(">>> %s/\n" % mydest) |