|
1 #!/usr/bin/perl |
|
2 # Copyright (c) 2010 Symbian Foundation Ltd |
|
3 # This component and the accompanying materials are made available |
|
4 # under the terms of the License "Eclipse Public License v1.0" |
|
5 # which accompanies this distribution, and is available |
|
6 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 # |
|
8 # Initial Contributors: |
|
9 # Mike Kinghan, mikek@symbian.org, for Symbian Foundation Ltd - initial contribution. |
|
10 |
|
11 # Script to clean all tools2 targets with Raptor, except Raptor itself |
|
12 # and any that were broken upstream when last checked. |
|
13 |
|
14 use strict; |
|
15 use perl_run; |
|
16 my $keepgoing = 0; |
|
17 my @cleaned = (); |
|
18 my @uncleaned = (); |
|
19 my @skipped = (); |
|
20 |
|
21 if (@ARGV) { |
|
22 if (grep(/$ARGV[0]/,("-h","--help"))) { |
|
23 print "This script really-cleans all TOOLS2 targets with Raptor, " . |
|
24 "except Raptor itself and any that were broken upstream when last checked.\n"; |
|
25 print "Valid arguments are -h, --help; -k, --keepgoing, or none.\n"; |
|
26 print "-k, --keepgoing makes the script carry on after a failed clean,\n"; |
|
27 exit 0; |
|
28 } elsif (grep(/$ARGV[0]/,("-k","--keepgoing"))) { |
|
29 $keepgoing = 1; |
|
30 } else { |
|
31 print "Valid arguments are -h, --help; -k, --keepgoing, or none.\n". |
|
32 exit 1; |
|
33 } |
|
34 } |
|
35 my @targ_lines = perl_slurp("list_targets.pl"); |
|
36 foreach my $line (@targ_lines) { |
|
37 chomp $line; |
|
38 next, if ($line =~ /^>>>/); |
|
39 if ($line =~ /(\*\*\*.*\*\*\*)/) { |
|
40 my $reason = $1; |
|
41 my @words = split(/ /,$line); |
|
42 print ">>> Skipping target $words[0]: \"$reason\"\n"; |
|
43 push (@skipped,[$words[0],$reason]); |
|
44 } else { |
|
45 print ">>> Really-cleaning target $line\n"; |
|
46 my $rc = perl_run("reallyclean_target.pl $line"); |
|
47 if ($rc) { |
|
48 print "*** $rc ***\n"; |
|
49 print "*** Failed to really-clean target $line ***\n"; |
|
50 if ($keepgoing) { |
|
51 push(@uncleaned,$line); |
|
52 } else { |
|
53 exit $rc; |
|
54 } |
|
55 } else { |
|
56 push(@cleaned,$line); |
|
57 } |
|
58 } |
|
59 } |
|
60 if (@cleaned) { |
|
61 if (@uncleaned == 0) { |
|
62 print ">>> Really-cleaned all eligible targets:-\n"; |
|
63 } else { |
|
64 print ">>> Really-cleaned eligible targets:-\n"; |
|
65 } |
|
66 foreach my $targ (@cleaned) { |
|
67 print "+++ $targ\n"; |
|
68 } |
|
69 } |
|
70 if (@uncleaned) { |
|
71 print ">>> Failed to really-clean eligible targets:-\n"; |
|
72 foreach my $targ (@uncleaned) { |
|
73 print "+++ $targ\n"; |
|
74 } |
|
75 } |
|
76 if (@skipped) { |
|
77 print ">>> Skipped targets:-\n"; |
|
78 foreach my $skipped (@skipped) { |
|
79 print "+++ " . $skipped->[0] . ' '. $skipped->[1] . "\n"; |
|
80 } |
|
81 } |
|
82 exit 0; |
|
83 |