1 |
mgorny 13/04/01 09:17:53 |
2 |
|
3 |
Modified: ChangeLog distutils-r1.eclass multibuild.eclass |
4 |
Log: |
5 |
Introduce multibuild_merge_root, as an universal interim-install merging function. |
6 |
|
7 |
Revision Changes Path |
8 |
1.762 eclass/ChangeLog |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.762&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.762&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.761&r2=1.762 |
13 |
|
14 |
Index: ChangeLog |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v |
17 |
retrieving revision 1.761 |
18 |
retrieving revision 1.762 |
19 |
diff -u -r1.761 -r1.762 |
20 |
--- ChangeLog 1 Apr 2013 09:16:07 -0000 1.761 |
21 |
+++ ChangeLog 1 Apr 2013 09:17:53 -0000 1.762 |
22 |
@@ -1,6 +1,11 @@ |
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.761 2013/04/01 09:16:07 mgorny Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.762 2013/04/01 09:17:53 mgorny Exp $ |
27 |
+ |
28 |
+ 01 Apr 2013; Michał Górny <mgorny@g.o> distutils-r1.eclass, |
29 |
+ multibuild.eclass: |
30 |
+ Introduce multibuild_merge_root, as an universal interim-install merging |
31 |
+ function. |
32 |
|
33 |
01 Apr 2013; Michał Górny <mgorny@g.o> autotools-utils.eclass: |
34 |
Support setting mode of prune_libtool_files through |
35 |
|
36 |
|
37 |
|
38 |
1.66 eclass/distutils-r1.eclass |
39 |
|
40 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.66&view=markup |
41 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.66&content-type=text/plain |
42 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?r1=1.65&r2=1.66 |
43 |
|
44 |
Index: distutils-r1.eclass |
45 |
=================================================================== |
46 |
RCS file: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v |
47 |
retrieving revision 1.65 |
48 |
retrieving revision 1.66 |
49 |
diff -u -r1.65 -r1.66 |
50 |
--- distutils-r1.eclass 19 Mar 2013 06:13:41 -0000 1.65 |
51 |
+++ distutils-r1.eclass 1 Apr 2013 09:17:53 -0000 1.66 |
52 |
@@ -1,6 +1,6 @@ |
53 |
# Copyright 1999-2013 Gentoo Foundation |
54 |
# Distributed under the terms of the GNU General Public License v2 |
55 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.65 2013/03/19 06:13:41 mgorny Exp $ |
56 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.66 2013/04/01 09:17:53 mgorny Exp $ |
57 |
|
58 |
# @ECLASS: distutils-r1 |
59 |
# @MAINTAINER: |
60 |
@@ -449,49 +449,10 @@ |
61 |
|
62 |
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then |
63 |
_distutils-r1_rename_scripts "${root}" |
64 |
- _distutils-r1_merge_root "${root}" "${D}" |
65 |
+ multibuild_merge_root "${root}" "${D}" |
66 |
fi |
67 |
} |
68 |
|
69 |
-# @FUNCTION: distutils-r1_merge_root |
70 |
-# @USAGE: <src-root> <dest-root> |
71 |
-# @INTERNAL |
72 |
-# @DESCRIPTION: |
73 |
-# Merge the directory tree from <src-root> to <dest-root>, removing |
74 |
-# the <src-root> in the process. |
75 |
-_distutils-r1_merge_root() { |
76 |
- local src=${1} |
77 |
- local dest=${2} |
78 |
- |
79 |
- local lockfile=${T}/distutils-r1-merge-lock |
80 |
- |
81 |
- if type -P lockf &>/dev/null; then |
82 |
- # On BSD, we have 'lockf' wrapper. |
83 |
- tar -C "${src}" -f - -c . \ |
84 |
- | lockf "${lockfile}" tar -x -f - -C "${dest}" |
85 |
- else |
86 |
- local lock_fd |
87 |
- if type -P flock &>/dev/null; then |
88 |
- # On Linux, we have 'flock' which can lock fd. |
89 |
- redirect_alloc_fd lock_fd "${lockfile}" '>>' |
90 |
- flock ${lock_fd} |
91 |
- else |
92 |
- ewarn "distutils-r1: no locking service found, please report." |
93 |
- fi |
94 |
- |
95 |
- cp -a -l -n "${src}"/. "${dest}"/ |
96 |
- |
97 |
- if [[ ${lock_fd} ]]; then |
98 |
- # Close the lock file when we are done with it. |
99 |
- # Prevents deadlock if we aren't in a subshell. |
100 |
- eval "exec ${lock_fd}>&-" |
101 |
- fi |
102 |
- fi |
103 |
- [[ ${?} == 0 ]] || die "Merging ${EPYTHON} image failed." |
104 |
- |
105 |
- rm -rf "${src}" |
106 |
-} |
107 |
- |
108 |
# @FUNCTION: distutils-r1_python_install_all |
109 |
# @DESCRIPTION: |
110 |
# The default python_install_all(). It installs the documentation. |
111 |
|
112 |
|
113 |
|
114 |
1.9 eclass/multibuild.eclass |
115 |
|
116 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multibuild.eclass?rev=1.9&view=markup |
117 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multibuild.eclass?rev=1.9&content-type=text/plain |
118 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multibuild.eclass?r1=1.8&r2=1.9 |
119 |
|
120 |
Index: multibuild.eclass |
121 |
=================================================================== |
122 |
RCS file: /var/cvsroot/gentoo-x86/eclass/multibuild.eclass,v |
123 |
retrieving revision 1.8 |
124 |
retrieving revision 1.9 |
125 |
diff -u -r1.8 -r1.9 |
126 |
--- multibuild.eclass 10 Mar 2013 21:44:01 -0000 1.8 |
127 |
+++ multibuild.eclass 1 Apr 2013 09:17:53 -0000 1.9 |
128 |
@@ -1,6 +1,6 @@ |
129 |
# Copyright 1999-2013 Gentoo Foundation |
130 |
# Distributed under the terms of the GNU General Public License v2 |
131 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/multibuild.eclass,v 1.8 2013/03/10 21:44:01 mgorny Exp $ |
132 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/multibuild.eclass,v 1.9 2013/04/01 09:17:53 mgorny Exp $ |
133 |
|
134 |
# @ECLASS: multibuild |
135 |
# @MAINTAINER: |
136 |
@@ -238,5 +238,57 @@ |
137 |
return ${ret} |
138 |
} |
139 |
|
140 |
+# @FUNCTION: multibuild_merge_root |
141 |
+# @USAGE: <src-root> <dest-root> |
142 |
+# @DESCRIPTION: |
143 |
+# Merge the directory tree (fake root) from <src-root> to <dest-root> |
144 |
+# (the real root). Both directories have to be real, absolute paths |
145 |
+# (i.e. including ${D}). Source root will be removed. |
146 |
+# |
147 |
+# This functions uses locking to support merging during parallel |
148 |
+# installs. |
149 |
+multibuild_merge_root() { |
150 |
+ local src=${1} |
151 |
+ local dest=${2} |
152 |
+ |
153 |
+ local lockfile=${T}/multibuild_merge_lock |
154 |
+ local ret |
155 |
+ |
156 |
+ if use userland_BSD; then |
157 |
+ # Locking is done by 'lockf' which can wrap a command. |
158 |
+ # 'cp -a -n' is broken: |
159 |
+ # http://www.freebsd.org/cgi/query-pr.cgi?pr=174489 |
160 |
+ # using tar instead which is universal but terribly slow. |
161 |
+ |
162 |
+ tar -C "${src}" -f - -c . \ |
163 |
+ | lockf "${lockfile}" tar -x -f - -C "${dest}" |
164 |
+ [[ ${PIPESTATUS[*]} == '0 0' ]] |
165 |
+ ret=${?} |
166 |
+ elif use userland_GNU; then |
167 |
+ # GNU has 'flock' which can't wrap commands but can lock |
168 |
+ # a fd which is good enough for us. |
169 |
+ # and cp works with '-a -n'. |
170 |
+ |
171 |
+ local lock_fd |
172 |
+ redirect_alloc_fd lock_fd "${lockfile}" '>>' |
173 |
+ flock ${lock_fd} |
174 |
+ |
175 |
+ cp -a -l -n "${src}"/. "${dest}"/ |
176 |
+ ret=${?} |
177 |
+ |
178 |
+ # Close the lock file when we are done with it. |
179 |
+ # Prevents deadlock if we aren't in a subshell. |
180 |
+ eval "exec ${lock_fd}>&-" |
181 |
+ else |
182 |
+ die "Unsupported userland (${USERLAND}), please report." |
183 |
+ fi |
184 |
+ |
185 |
+ if [[ ${ret} -ne 0 ]]; then |
186 |
+ die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed." |
187 |
+ fi |
188 |
+ |
189 |
+ rm -rf "${src}" |
190 |
+} |
191 |
+ |
192 |
_MULTIBUILD=1 |
193 |
fi |