diff options
author | Michał Górny <mgorny@gentoo.org> | 2013-10-30 19:21:12 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2013-10-30 19:21:12 +0000 |
commit | cfe38a8fc54a4e50235d7ee0233728d85afec3d3 (patch) | |
tree | 9a5d4a0e49e21e871b6246d0837f66c4190d6aa3 /eclass | |
parent | Switch the eclasses to use dev-lang/python-exec. (diff) | |
download | historical-cfe38a8fc54a4e50235d7ee0233728d85afec3d3.tar.gz historical-cfe38a8fc54a4e50235d7ee0233728d85afec3d3.tar.bz2 historical-cfe38a8fc54a4e50235d7ee0233728d85afec3d3.zip |
Fix parallel checkout race conditions, bug #489280.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 5 | ||||
-rw-r--r-- | eclass/git-r3.eclass | 20 |
2 files changed, 22 insertions, 3 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index e0d317976f13..33ebddf7255e 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for eclass directory # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1040 2013/10/30 19:14:02 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1041 2013/10/30 19:21:12 mgorny Exp $ + + 30 Oct 2013; Michał Górny <mgorny@gentoo.org> git-r3.eclass: + Fix parallel checkout race conditions, bug #489280. 30 Oct 2013; Michał Górny <mgorny@gentoo.org> python-r1.eclass, python-single-r1.eclass, python-utils-r1.eclass: diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass index c52fa4b3cd85..5f6f8a37e6a1 100644 --- a/eclass/git-r3.eclass +++ b/eclass/git-r3.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.21 2013/10/27 13:44:35 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.22 2013/10/30 19:21:12 mgorny Exp $ # @ECLASS: git-r3.eclass # @MAINTAINER: @@ -579,9 +579,25 @@ git-r3_checkout() { fi fi + # Note: this is a hack to avoid parallel checkout issues. + # I will try to handle it without locks when I have more time. + local lockfile=${GIT_DIR}/.git-r3_checkout_lock + local lockfile_l=${lockfile}.${BASHPID} + touch "${lockfile_l}" || die + until ln "${lockfile_l}" "${lockfile}" &>/dev/null; do + sleep 1 + done + rm "${lockfile_l}" || die + set -- git checkout -f "${local_id}"/__main__ . echo "${@}" >&2 - "${@}" || die "git checkout ${local_id}/__main__ failed" + "${@}" + local ret=${?} + + # Remove the lock! + rm "${lockfile}" || die + + [[ ${ret} == 0 ]] || die "git checkout ${local_id}/__main__ failed" # diff against previous revision (if any) local new_commit_id=$(git rev-parse --verify "${local_id}"/__main__) |