From: David James Date: Wed, 14 Jul 2010 00:03:21 +0000 (-0700) Subject: Fix portage to create directories atomically in fast build. X-Git-Tag: v2.2_rc73~11 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a2bc929364a83bd4c7fb6f3f6c136394e974b6a3;p=portage.git 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 --- 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)