1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mageia-dev] [soft-commits] [6663] para
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mageia-dev%40mageia.org?Subject=Re%3A%20%5BMageia-dev%5D%20%5Bsoft-commits%5D%20%5B6663%5D%20para&In-Reply-To=%3CCA%2BCX%2BbiTEPxCoHXk59NdeUZcTxfAxeUHoN17vdA9o3nWcHfD3A%40mail.gmail.com%3E">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="020707.html">
<LINK REL="Next" HREF="020717.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mageia-dev] [soft-commits] [6663] para</H1>
<B>Pascal Terjan</B>
<A HREF="mailto:mageia-dev%40mageia.org?Subject=Re%3A%20%5BMageia-dev%5D%20%5Bsoft-commits%5D%20%5B6663%5D%20para&In-Reply-To=%3CCA%2BCX%2BbiTEPxCoHXk59NdeUZcTxfAxeUHoN17vdA9o3nWcHfD3A%40mail.gmail.com%3E"
TITLE="[Mageia-dev] [soft-commits] [6663] para">pterjan at gmail.com
</A><BR>
<I>Mon Dec 10 10:40:37 CET 2012</I>
<P><UL>
<LI>Previous message: <A HREF="020707.html">[Mageia-dev] [soft-commits] [6666] foo
</A></li>
<LI>Next message: <A HREF="020717.html">[Mageia-dev] problems with latest update
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#20708">[ date ]</a>
<a href="thread.html#20708">[ thread ]</a>
<a href="subject.html#20708">[ subject ]</a>
<a href="author.html#20708">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>On Mon, Dec 10, 2012 at 9:38 AM, <<A HREF="https://www.mageia.org/mailman/listinfo/mageia-dev">root at mageia.org</A>> wrote:
><i> Revision 6663 Author pterjan Date 2012-12-10 10:38:12 +0100 (Mon, 10 Dec
</I>><i> 2012)
</I>><i>
</I>><i> Log Message
</I>><i>
</I>><i> para
</I>
And this one did not get the one I changed in git, I will edit svn log :(
><i> Modified Paths
</I>><i>
</I>><i> build_system/iurt/trunk/iurt
</I>><i>
</I>><i> Modified: build_system/iurt/trunk/iurt
</I>><i> ===================================================================
</I>><i> --- build_system/iurt/trunk/iurt 2012-12-10 03:38:14 UTC (rev 6662)
</I>><i> +++ build_system/iurt/trunk/iurt 2012-12-10 09:38:12 UTC (rev 6663)
</I>><i> @@ -173,6 +173,9 @@
</I>><i> [ "", "concurrent-run", 0, "",
</I>><i> "Allow several iurt to run on different machines (slower)",
</I>><i> sub { $run{concurrent_run} = 1 }, "Activating concurrent run checks" ],
</I>><i> + [ "", "parallel", 1, "<n>",
</I>><i> + "Build up to <n> packages in parallel",
</I>><i> + sub {($run{parallel}) = @_; 1}, "Enabling parallel build" ],
</I>><i> [ "d", "dir", -1, "",
</I>><i> "Directory where to find packages to rebuild",
</I>><i> sub { $run{extra_dir} = \@_; 1 }, "Adding extra source packages
</I>><i> directories" ],
</I>><i> @@ -813,33 +816,16 @@
</I>><i> #$SIG{INT} = $s;
</I>><i> $run{main} = 1;
</I>><i>
</I>><i> -my $rebuild;
</I>><i> -$run{group} = 0 if @{$run{todo}} == 1;
</I>><i> -if ($run{group}) {
</I>><i> - $rebuild = 1;
</I>><i> - $urpmi->set_local_media($local_spool);
</I>><i> - $urpmi->order_packages(\%provides, $luser)
</I>><i> - or die "FATAL $program_name: could not order packages";
</I>><i> -}
</I>><i> -#
</I>><i> -# The build loop
</I>><i> -#
</I>><i> -my $prev_done = $done;
</I>><i> -do {
</I>><i> - $rebuild = 0;
</I>><i> - $done = $prev_done;
</I>><i> - my $i;
</I>><i> - for ($i; $i < @{$run{todo}}; $i++) {
</I>><i> - my ($dir, $srpm, $status) = @{$run{todo}[$i]};
</I>><i> -
</I>><i> +sub rebuild_one {
</I>><i> + my ($dir, $srpm, $status) = @_;
</I>><i> # CM: Set argv[0] (in the C sense) to something we can easily spot and
</I>><i> # understand in process list
</I>><i> $0 = "Iurt: $run{distro_tag} $run{my_arch} $run{media} $srpm";
</I>><i>
</I>><i> - $status or next;
</I>><i> - $done{$srpm} and next;
</I>><i> + $status or return;
</I>><i> + $done{$srpm} and return;
</I>><i> $done{$srpm} = 1;
</I>><i> - check_version(\%run, $srpm, \%srpm_version) or next;
</I>><i> + check_version(\%run, $srpm, \%srpm_version) or return;
</I>><i> if ($run{debug}) { $run{debug}++ == 2 and exit() }
</I>><i> $done++;
</I>><i> plog('NOTIFY', "Build package $srpm [$done/$to_compile]");
</I>><i> @@ -849,7 +835,7 @@
</I>><i> $run{status}{$srpm} = 'missing';
</I>><i> dump_cache_par(\%run);
</I>><i> dump_status($local_spool, \%run);
</I>><i> - next;
</I>><i> + return;
</I>><i> }
</I>><i> # FIXME unfortunately urpmi stalls quite often
</I>><i> my $retry = 0;
</I>><i> @@ -864,14 +850,14 @@
</I>><i>
</I>><i> if (!$run{use_old_chroot}) {
</I>><i> $chroot_tmp = create_temp_chroot(\%run, $config,
</I>><i> - $chroot_tmp, $chroot_ref) or next;
</I>><i> + $chroot_tmp, $chroot_ref) or return;
</I>><i> }
</I>><i>
</I>><i> if (!$urpmi->urpmi_command($chroot_tmp)) {
</I>><i> plog('DEBUG', "Creating chroot failed.\nCommand was: $chroot_tmp");
</I>><i> - next;
</I>><i> + return;
</I>><i> }
</I>><i> - $srpm =~ /(.*)-[^-]+-[^-]+\.src\.rpm$/ or next;
</I>><i> + $srpm =~ /(.*)-[^-]+-[^-]+\.src\.rpm$/ or return;
</I>><i> my ($maintainer, $cc);
</I>><i> if (!$run{warn}) {
</I>><i> ($maintainer) = get_maint(\%run, $srpm);
</I>><i> @@ -885,7 +871,7 @@
</I>><i> #($maintainer, $cc) = ($config->{admin},'');
</I>><i>
</I>><i> plog('DEBUG', "creating user $luser in chroot");
</I>><i> - add_local_user($chroot_tmp, \%run, $config, $luser, $run{uid}) or next;
</I>><i> + add_local_user($chroot_tmp, \%run, $config, $luser, $run{uid}) or return;
</I>><i>
</I>><i> my $old_srpm = $srpm;
</I>><i> my ($ret, $spec);
</I>><i> @@ -908,7 +894,7 @@
</I>><i> $run{status}{$srpm} = 'recreate_srpm_failure';
</I>><i> dump_cache_par(\%run);
</I>><i> dump_status($local_spool, \%run);
</I>><i> - next;
</I>><i> + return;
</I>><i> }
</I>><i>
</I>><i> (my $log_dirname = $srpm) =~ s/.*:(.*)\.src.rpm/$1/;
</I>><i> @@ -928,7 +914,7 @@
</I>><i> my $ok = $urpmi->install_packages($srpm, $chroot_tmp, $local_spool,
</I>><i> \%pack_provide, 'install_deps', "[REBUILD] install of build dependencies of
</I>><i> $srpm failed on $run{my_arch}", { maintainer => $maintainer },
</I>><i> "$path_srpm/$srpm");
</I>><i> if (!$ok) {
</I>><i> $run{status}{$srpm} ||= 'install_deps_failure';
</I>><i> - next;
</I>><i> + return;
</I>><i> }
</I>><i>
</I>><i> # try to workarround the rpm -qa db4 error(2) from dbcursor->c_get:
</I>><i> @@ -1009,7 +995,7 @@
</I>><i> # 20060615
</I>><i> dump_cache_par(\%run);
</I>><i> dump_status($local_spool, \%run);
</I>><i> - next;
</I>><i> + return;
</I>><i> }
</I>><i>
</I>><i> # do some cleaning if the compilation is successful
</I>><i> @@ -1019,7 +1005,7 @@
</I>><i> opendir my $binfh, "$chroot_tmp/home/$luser/rpmbuild/RPMS/";
</I>><i> my @packages;
</I>><i> foreach my $bindir (readdir $binfh) {
</I>><i> - -d "$chroot_tmp/home/$luser/rpmbuild/RPMS/$bindir" or next;
</I>><i> + -d "$chroot_tmp/home/$luser/rpmbuild/RPMS/$bindir" or return;
</I>><i> opendir my $rpmfh, "$chroot_tmp/home/$luser/rpmbuild/RPMS/$bindir";
</I>><i> push @packages, map {
</I>><i> "$chroot_tmp/home/$luser/rpmbuild/RPMS/$bindir/$_" } grep { !/src\.rpm$/ &&
</I>><i> /\.rpm$/ } readdir $rpmfh;
</I>><i> }
</I>><i> @@ -1028,7 +1014,7 @@
</I>><i> # segfaulting when trying to install packages
</I>><i>
</I>><i> if ($config->{check_binary_file}) {
</I>><i> - $urpmi->install_packages($srpm, $chroot_tmp, $local_spool,
</I>><i> \%pack_provide, 'binary_test', "[REBUILD] binaries packages generated from
</I>><i> $srpm do not install correctly", { maintainer => $maintainer } <A HREF="https://www.mageia.org/mailman/listinfo/mageia-dev">, at packages</A>)
</I>><i> or next;
</I>><i> + $urpmi->install_packages($srpm, $chroot_tmp, $local_spool,
</I>><i> \%pack_provide, 'binary_test', "[REBUILD] binaries packages generated from
</I>><i> $srpm do not install correctly", { maintainer => $maintainer } <A HREF="https://www.mageia.org/mailman/listinfo/mageia-dev">, at packages</A>)
</I>><i> or return;
</I>><i> } else {
</I>><i> my $successfile = "$local_spool/log/$srpm/binary_test_$srpm-1.log";
</I>><i> open my $f, ">$successfile";
</I>><i> @@ -1066,7 +1052,64 @@
</I>><i> dump_status($local_spool, \%run);
</I>><i> # dump_cache each time so that concurrent process can get updated
</I>><i> dump_cache_par(\%run) if $run{concurrent_run};
</I>><i> + return 1;
</I>><i> +}
</I>><i> +
</I>><i> +my $rebuild;
</I>><i> +$run{group} = 0 if @{$run{todo}} == 1;
</I>><i> +if ($run{group}) {
</I>><i> + $rebuild = 1;
</I>><i> + $urpmi->set_local_media($local_spool);
</I>><i> + $urpmi->order_packages(\%provides, $luser)
</I>><i> + or die "FATAL $program_name: could not order packages";
</I>><i> +}
</I>><i> +#
</I>><i> +# The build loop
</I>><i> +#
</I>><i> +my $prev_done = $done;
</I>><i> +do {
</I>><i> + $rebuild = 0;
</I>><i> + $done = $prev_done;
</I>><i> + my $i;
</I>><i> + my %children;
</I>><i> + for ($i; $i < @{$run{todo}}; $i++) {
</I>><i> + my ($dir, $srpm, $status) = @{$run{todo}[$i]};
</I>><i> + if ($run{parallel}) {
</I>><i> + my $pid;
</I>><i> + # First cleanup all the finished ones
</I>><i> + do {
</I>><i> + $pid = waitpid(-1, WNOHANG);
</I>><i> + if ($pid > 0) {
</I>><i> + plog('INFO', "Child $pid has exited");
</I>><i> + delete $children{$pid};
</I>><i> + }
</I>><i> + } while $pid > 0;
</I>><i> + while (scalar keys %children >= $run{parallel}) {
</I>><i> + plog('INFO', "Too many children, waiting to fork more");
</I>><i> + $pid = waitpid(-1, 0);
</I>><i> + delete $children{$pid} if $pid > 0;
</I>><i> + }
</I>><i> + my $pid = fork;
</I>><i> + if ($pid) { #parent
</I>><i> + $children{$pid} = 1;
</I>><i> + } elsif ($pid == 0) { #child
</I>><i> + $chroot_tmp .= "_" . int($i);
</I>><i> + rebuild_one($dir, $srpm, $status);
</I>><i> + exit;
</I>><i> + } else {
</I>><i> + die "could not fork";
</I>><i> + }
</I>><i> + } else {
</I>><i> + rebuild_one($dir, $srpm, $status);
</I>><i> + }
</I>><i> }
</I>><i> + if ($run{parallel}) {
</I>><i> + foreach my $pid (keys %children) {
</I>><i> + plog('INFO', "Waiting for process $pid to exit");
</I>><i> + waitpid($pid, 0);
</I>><i> + delete $children{$pid};
</I>><i> + }
</I>><i> + }
</I>><i> if ($run{group}) {
</I>><i> my $i;
</I>><i> for ($i; $i < @{$run{todo}}; $i++) {
</I>><i>
</I></PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="020707.html">[Mageia-dev] [soft-commits] [6666] foo
</A></li>
<LI>Next message: <A HREF="020717.html">[Mageia-dev] problems with latest update
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#20708">[ date ]</a>
<a href="thread.html#20708">[ thread ]</a>
<a href="subject.html#20708">[ subject ]</a>
<a href="author.html#20708">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-dev">More information about the Mageia-dev
mailing list</a><br>
</body></html>
|