1 |
mgorny 13/05/23 20:19:29 |
2 |
|
3 |
Modified: ChangeLog multibuild.eclass |
4 |
Log: |
5 |
Use portable locking code from Fabian Groffen. Bug #466554. |
6 |
|
7 |
Revision Changes Path |
8 |
1.836 eclass/ChangeLog |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.836&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.836&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.835&r2=1.836 |
13 |
|
14 |
Index: ChangeLog |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v |
17 |
retrieving revision 1.835 |
18 |
retrieving revision 1.836 |
19 |
diff -u -r1.835 -r1.836 |
20 |
--- ChangeLog 22 May 2013 05:10:29 -0000 1.835 |
21 |
+++ ChangeLog 23 May 2013 20:19:28 -0000 1.836 |
22 |
@@ -1,6 +1,9 @@ |
23 |
# ChangeLog for eclass directory |
24 |
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.835 2013/05/22 05:10:29 mgorny Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.836 2013/05/23 20:19:28 mgorny Exp $ |
27 |
+ |
28 |
+ 23 May 2013; Michał Górny <mgorny@g.o> multibuild.eclass: |
29 |
+ Use portable locking code from Fabian Groffen. Bug #466554. |
30 |
|
31 |
22 May 2013; Michał Górny <mgorny@g.o> eutils.eclass: |
32 |
Fix the libtool check, bug #470938. |
33 |
|
34 |
|
35 |
|
36 |
1.10 eclass/multibuild.eclass |
37 |
|
38 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multibuild.eclass?rev=1.10&view=markup |
39 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multibuild.eclass?rev=1.10&content-type=text/plain |
40 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multibuild.eclass?r1=1.9&r2=1.10 |
41 |
|
42 |
Index: multibuild.eclass |
43 |
=================================================================== |
44 |
RCS file: /var/cvsroot/gentoo-x86/eclass/multibuild.eclass,v |
45 |
retrieving revision 1.9 |
46 |
retrieving revision 1.10 |
47 |
diff -u -r1.9 -r1.10 |
48 |
--- multibuild.eclass 1 Apr 2013 09:17:53 -0000 1.9 |
49 |
+++ multibuild.eclass 23 May 2013 20:19:28 -0000 1.10 |
50 |
@@ -1,6 +1,6 @@ |
51 |
# Copyright 1999-2013 Gentoo Foundation |
52 |
# Distributed under the terms of the GNU General Public License v2 |
53 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/multibuild.eclass,v 1.9 2013/04/01 09:17:53 mgorny Exp $ |
54 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/multibuild.eclass,v 1.10 2013/05/23 20:19:28 mgorny Exp $ |
55 |
|
56 |
# @ECLASS: multibuild |
57 |
# @MAINTAINER: |
58 |
@@ -251,38 +251,39 @@ |
59 |
local src=${1} |
60 |
local dest=${2} |
61 |
|
62 |
- local lockfile=${T}/multibuild_merge_lock |
63 |
+ local lockfile=${T}/.multibuild_merge_lock |
64 |
+ local lockfile_l=${lockfile}.${$} |
65 |
local ret |
66 |
|
67 |
+ # Lock the install tree for merge. The touch+ln method ensures race |
68 |
+ # condition-free locking with maximum portability. |
69 |
+ touch "${lockfile_l}" || die |
70 |
+ until ln "${lockfile_l}" "${lockfile}" &>/dev/null; do |
71 |
+ sleep 1 |
72 |
+ done |
73 |
+ rm "${lockfile_l}" || die |
74 |
+ |
75 |
if use userland_BSD; then |
76 |
- # Locking is done by 'lockf' which can wrap a command. |
77 |
# 'cp -a -n' is broken: |
78 |
# http://www.freebsd.org/cgi/query-pr.cgi?pr=174489 |
79 |
# using tar instead which is universal but terribly slow. |
80 |
|
81 |
tar -C "${src}" -f - -c . \ |
82 |
- | lockf "${lockfile}" tar -x -f - -C "${dest}" |
83 |
+ | tar -x -f - -C "${dest}" |
84 |
[[ ${PIPESTATUS[*]} == '0 0' ]] |
85 |
ret=${?} |
86 |
elif use userland_GNU; then |
87 |
- # GNU has 'flock' which can't wrap commands but can lock |
88 |
- # a fd which is good enough for us. |
89 |
- # and cp works with '-a -n'. |
90 |
- |
91 |
- local lock_fd |
92 |
- redirect_alloc_fd lock_fd "${lockfile}" '>>' |
93 |
- flock ${lock_fd} |
94 |
+ # cp works with '-a -n'. |
95 |
|
96 |
cp -a -l -n "${src}"/. "${dest}"/ |
97 |
ret=${?} |
98 |
- |
99 |
- # Close the lock file when we are done with it. |
100 |
- # Prevents deadlock if we aren't in a subshell. |
101 |
- eval "exec ${lock_fd}>&-" |
102 |
else |
103 |
die "Unsupported userland (${USERLAND}), please report." |
104 |
fi |
105 |
|
106 |
+ # Remove the lock. |
107 |
+ rm "${lockfile}" || die |
108 |
+ |
109 |
if [[ ${ret} -ne 0 ]]; then |
110 |
die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed." |
111 |
fi |