public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
Date: Sat,  7 May 2011 22:00:06 +0000 (UTC)	[thread overview]
Message-ID: <8601ea2b80208491b471f37710b35813fd341c28.zmedico@gentoo> (raw)

commit:     8601ea2b80208491b471f37710b35813fd341c28
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat May  7 21:59:54 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat May  7 21:59:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8601ea2b

doebuild: use EbuildBuildDir for locking

EbuildBuildDir also performs safe removal of the category when it is
empty, so ebuild.sh/dyn_clean doesn't need to do it anymore. This
fixes a race condition if one process is trying to remove the category
directory while another one is trying to create it for
PORTAGE_BUILDDIR.

---
 bin/ebuild.sh                          |    2 +-
 pym/portage/package/ebuild/doebuild.py |   15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index f3349ae..c3cf181 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -812,7 +812,7 @@ dyn_clean() {
 	# Some kernels, such as Solaris, return EINVAL when an attempt
 	# is made to remove the current working directory.
 	cd "$PORTAGE_BUILDDIR"/../..
-	rmdir "$PORTAGE_BUILDDIR" "${PORTAGE_BUILDDIR%/*}" 2>/dev/null
+	rmdir "$PORTAGE_BUILDDIR" 2>/dev/null
 
 	true
 }

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 1c04822..f83a1e3 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -566,8 +566,19 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
 			use_cache, mydbapi)
 
 		if mydo in clean_phases:
-			return _spawn_phase(mydo, mysettings,
-				fd_pipes=fd_pipes, returnpid=returnpid)
+			builddir_lock = None
+			if not returnpid and \
+				'PORTAGE_BUILDIR_LOCKED' not in mysettings:
+				builddir_lock = EbuildBuildDir(
+					scheduler=PollScheduler().sched_iface,
+					settings=mysettings)
+				builddir_lock.lock()
+			try:
+				return _spawn_phase(mydo, mysettings,
+					fd_pipes=fd_pipes, returnpid=returnpid)
+			finally:
+				if builddir_lock is not None:
+					builddir_lock.unlock()
 
 		restrict = set(mysettings.get('PORTAGE_RESTRICT', '').split())
 		# get possible slot information from the deps file



             reply	other threads:[~2011-05-07 22:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-07 22:00 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-28 23:32 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/ Zac Medico
2011-09-22  0:05 Zac Medico
2011-10-15 18:38 Zac Medico
2011-11-05 18:53 Zac Medico
2011-11-09  0:21 Zac Medico
2011-11-10  3:12 Zac Medico
2012-04-22 17:56 Zac Medico
2012-09-13 18:25 Zac Medico
2012-09-14  7:26 Zac Medico
2012-09-18  2:59 Zac Medico
2013-01-15 20:52 Zac Medico
2013-07-16 17:52 Arfrever Frehtes Taifersar Arahesis
2018-02-05 19:25 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8601ea2b80208491b471f37710b35813fd341c28.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox