-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrepomgr
executable file
·397 lines (345 loc) · 9.17 KB
/
repomgr
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
#! /usr/bin/perl -W
use strict;
my %modules =
(
bid => { paths => [ qw(repomgr
l4/Makefile
l4/mk
l4/COPYING
l4/pkg/COPYING
l4/pkg/Makefile
l4/tool/Makefile
l4/tool/gendep
l4/tool/config
tools/gosh
) ],
},
doc => { paths => [ qw(l4/doc/Makefile
l4/doc/README
l4/doc/bid-spec
l4/doc/bid-tut
l4/doc/building-howto
l4/doc/dev-overview
l4/doc/l4env-concept
) ], },
l4env_pkg => {
paths => [ qw(l4/pkg/arm_drivers
l4/pkg/bootstrap
l4/pkg/cxx
l4/pkg/demangle
l4/pkg/dm_mem
l4/pkg/dm_phys
l4/pkg/drivers
l4/pkg/generic_blk
l4/pkg/generic_fprov
l4/pkg/generic_ts
l4/pkg/input
l4/pkg/ipcmon
l4/pkg/l4con
l4/pkg/l4env
l4/pkg/l4io
l4/pkg/l4sys
l4/pkg/l4util
l4/pkg/ldso
l4/pkg/libc_backends
l4/pkg/libc_backends_l4env
l4/pkg/linux-24-headers
l4/pkg/log
l4/pkg/lxfuxlibc
l4/pkg/names
l4/pkg/semaphore
l4/pkg/serial
l4/pkg/simple_ts
l4/pkg/slab
l4/pkg/task
l4/pkg/x86emu
l4/pkg/crtx
l4/pkg/dm_generic
l4/pkg/events
l4/pkg/generic_io
l4/pkg/l4rm
l4/pkg/libc_support
l4/pkg/libsigma0
l4/pkg/loader
l4/pkg/lock
l4/pkg/omega0
l4/pkg/roottask
l4/pkg/sigma0
l4/pkg/thread
l4/pkg/uclibc++
) ], },
l4env_tools => {
paths => [ qw(l4/tool/bin/abs2rel.sh
l4/tool/bin/genoffsets.pl
l4/tool/bin/isocreator
) ]
},
preprocess => {
paths => [ qw(tools/preprocess) ]
},
# l4env with dietlibc
l4env_diet => {
modules => [ qw(bid doc l4env_tools) ],
paths => [ qw(l4/pkg/dietlibc l4/pkg/dietlibc_r) ],
},
# l4env with uclibc
l4env_uclibc => {
modules => [ qw(bid doc l4env_tools) ],
paths => [ qw(l4/pkg/uclibc l4/pkg/uclibc_r) ],
},
l4env => {
pub_module => 1,
modules => [ qw(l4env_uclibc l4env_pkg dice) ],
},
sigma0 => {
modules => [ qw(bid) ],
paths => [ qw(l4/pkg/crtx
l4/pkg/cxx
l4/pkg/l4sys
l4/pkg/libsigma0
l4/pkg/sigma0
l4/pkg/uclibc) ],
},
hello_pkg => {
paths => [ qw(l4/pkg/bootstrap
l4/pkg/crtx
l4/pkg/cxx
l4/pkg/demangle
l4/pkg/drivers
l4/pkg/hello
l4/pkg/l4util
l4/pkg/l4sys
l4/pkg/libc_backends
l4/pkg/libc_support
l4/pkg/libsigma0
l4/pkg/roottask
l4/pkg/sigma0
l4/pkg/uclibc
) ],
},
hello => {
pub_module => 1,
modules => [ qw(fiasco bid dice hello_pkg l4env_tools) ],
},
misc => {
paths => [ qw(l4/tool/runux l4/pkg/rtc l4/pkg/zlib) ],
},
dope => {
paths => [ qw(l4/pkg/dope l4/pkg/proxygon l4/tool/gen_dopecode) ],
},
'l4linux-2.6-env' => {
pub_module => 1,
modules => [ qw(l4env dope misc) ],
},
fiasco => {
pub_module => 1,
paths => [ qw(kernel/fiasco/COPYING
kernel/fiasco/MAINTAINER
kernel/fiasco/Makefile
kernel/fiasco/README
kernel/fiasco/doc/design/ipc-path-charts
kernel/fiasco/man
kernel/fiasco/src
kernel/fiasco/tool
) ],
modules => [ qw(preprocess) ],
},
kernel => {
paths => [ qw(kernel/Makefile) ],
},
dice => {
pub_module => 1,
paths => [ qw(dice) ],
},
grub => {
paths => [ qw(grub) ],
},
remote_repo_l4 => {
modules => [ qw(bid hello l4env l4env_diet l4env_uclibc dope misc) ],
paths => [ qw(l4/pkg/bmsi
l4/pkg/c++-examples
l4/pkg/cpu_reserve
l4/pkg/cxx_linux_io
l4/pkg/cxx_log_io
l4/pkg/dde
l4/pkg/dde_linux
l4/pkg/dde_linux26
l4/pkg/dice_hello
l4/pkg/dmon
l4/pkg/dsi
l4/pkg/dsi_example
l4/pkg/flips
l4/pkg/gmp
l4/pkg/ipreg
l4/pkg/l4ide
l4/pkg/l4vfs
l4/pkg/libcrypto
l4/pkg/libpng
l4/pkg/libvfb
l4/pkg/linux-26-headers
l4/pkg/lyon
l4/pkg/local_socks
l4/pkg/nethub
l4/pkg/nitpicker
l4/pkg/ore
l4/pkg/overlay_wm
l4/pkg/petze
l4/pkg/pingpong
l4/pkg/presenter
l4/pkg/qt3
l4/pkg/rt_mon
l4/pkg/signal
l4/pkg/socket_linux
l4/pkg/stpm
l4/pkg/tftp
l4/pkg/usbhid
l4/pkg/usb
l4/pkg/verner
) ],
},
remote_repo => { modules => [ qw(fiasco remote_repo_l4) ], },
all => {
modules => [ qw(remote_repo) ],
},
);
my %commands;
sub merge_modules
{
my %paths;
sub do_merge
{
my $pathsref = shift;
my $count = shift;
die "Possible looping in modules structure detected!" unless $count;
foreach my $m (@_)
{
die "Unknown module '$m' referenced!" unless defined $modules{$m};
$$pathsref{$_} = 1 foreach @{$modules{$m}{paths}};
do_merge($pathsref, $count - 1, @{$modules{$m}{modules}});
}
}
do_merge(\%paths, 20, scalar @_ ? @_ : 'all');
sort keys %paths;
}
sub usage
{
my $command = shift;
# check alias
$command = $commands{$command}{alias}
if defined $command and defined $commands{$command}{alias};
if (!defined $command or $command eq 'help')
{
print "$0 command [option]\n";
print "Available commands, use '$0 help command' for help on the command:\n";
foreach (sort keys %commands)
{
print " $_\n" if defined $commands{$_}{public};
}
}
elsif ($command eq 'update')
{
print " 'update' will update in the following way:\n".
" update itself and re-exec if necessary\n".
" call 'make update' in l4/pkg\n".
" call 'svn update' every directory in kernel\n";
}
elsif ($command eq 'checkout')
{
print " 'checkout' will check out the given modules.\n";
print "Available modules:\n";
foreach (sort keys %modules)
{
print " $_\n" if $modules{$_}{pub_module};
}
}
else
{
print " No such command '$command'.\n";
}
}
sub check_module_structure()
{
# make sure the paths look ok
foreach (merge_modules())
{
die "Leading/trailing /'s in modules structure" if /^\// or /\/$/;
die "Double // detected in modules structure" if /\/\//;
}
}
sub command_help
{
usage(@_);
}
sub command_update
{
print "XXX: todo\n";
}
sub command_checkout
{
unless (defined $_[0])
{
print "Supply module to check out.\n";
usage("checkout");
exit 1;
}
die "Current directory is no SVN WC" unless -d ".svn";
my @paths = merge_modules(@_);
foreach my $paths (@paths)
{
my @path_elems = split /\/+/, $paths;
my $last_elem = pop @path_elems;
my $path = '.';
foreach my $pe (@path_elems)
{
if (! -d "$path/$pe/.svn")
{
print "Creating $path/$pe\n";
system("cd $path && svn --quiet update -N $pe");
die "svn update failed" if $?;
}
$path .= '/'.$pe;
}
}
print "Getting sources\n";
system("svn update ".join(' ', @paths));
die "svn update failed" if $?;
}
sub command_modules
{
foreach (sort keys %modules)
{
print "$_\n" if defined $modules{$_}{pub_module};
}
}
sub command_paths
{
print "$_\n" foreach merge_modules(@_);
}
%commands =
(
help => { func => \&command_help, },
update => { func => \&command_update, },
up => { func => \&command_update, alias => 'update' },
checkout => { func => \&command_checkout, public => 1},
co => { func => \&command_checkout, alias => 'checkout'},
modules => { func => \&command_modules, public => 1},
paths => { func => \&command_paths, },
);
# ----------------------------------------------------------------
check_module_structure();
my $command = shift;
unless (defined $command)
{
usage();
exit 1;
}
if (defined $commands{$command})
{
&{$commands{$command}{func}}(@ARGV);
}
else
{
print "Unknown command '$command'.\n";
usage();
exit 1;
}