1 | #!/usr/bin/perl -w
|
---|
2 | # automatisches buildskript fuer smartclient
|
---|
3 | # liest die konfiguration aus der mit -b übergebenen Datei
|
---|
4 | # $Id: buildall.pl,v 1.2 2002/09/04 11:36:19 pstorz Exp $
|
---|
5 | use Getopt::Std;
|
---|
6 |
|
---|
7 | # Programmoptionen: -b (buildlist)
|
---|
8 |
|
---|
9 | my $smartclient_root="../../"; # Pfad, zu dem die Pfade in buildlist stehen
|
---|
10 | my $build = "/home/pstorz/bin/build.sh";
|
---|
11 | our ($opt_b);
|
---|
12 | my @ArrayofBuilds;
|
---|
13 | getopts('b:');
|
---|
14 |
|
---|
15 | if (!$opt_b)
|
---|
16 | {die "usage: buildall.pl -b buildlist\n";
|
---|
17 | };
|
---|
18 |
|
---|
19 | (open(BUILDLIST,$opt_b)) || die "Die Buildlist $opt_b konnte nicht gefunden werden";
|
---|
20 |
|
---|
21 |
|
---|
22 | while (<BUILDLIST>) #Buildlist parsen
|
---|
23 | {
|
---|
24 | next if (/^\#.*$/);
|
---|
25 | # if (/([\w\/]+)\s*:([\/\w\-\+\.]+)\s+:((\s*\-\-\w*)*)$/)
|
---|
26 | if (/(\S+)\s*:(\S+)\s*:(\S+)\s*$/)
|
---|
27 | {
|
---|
28 | ($dir, $arch, $opt) = ($1, $2, $3);
|
---|
29 | chomp ($arch);
|
---|
30 | @build=($dir, $arch, $opt);
|
---|
31 | push @ArrayofBuilds, [@build];
|
---|
32 | }
|
---|
33 | }
|
---|
34 |
|
---|
35 |
|
---|
36 |
|
---|
37 | print "What will be done:\n";
|
---|
38 | print "Path\tDistribution\tBuildoptions\n";
|
---|
39 | for $i (0 .. $#ArrayofBuilds)
|
---|
40 | {
|
---|
41 | print("$ArrayofBuilds[$i][0]\t\t$ArrayofBuilds[$i][1]\t\t$ArrayofBuilds[$i][2]\n");
|
---|
42 | }
|
---|
43 | print "\n\n\n ATTENTION: the srpms from the directory external/SuSE must be built before!\n";
|
---|
44 | print "to build srpms, goto dir external/SuSE, execute build_srpms.sh script!\n\n\n";
|
---|
45 | print 'Are the srpms built and all options OK? (y/n)';
|
---|
46 |
|
---|
47 | $answer =<STDIN>;
|
---|
48 | chomp ($answer);
|
---|
49 | if ($answer ne "y") {die("canceled")};
|
---|
50 |
|
---|
51 | for $i (0 .. $#ArrayofBuilds)
|
---|
52 | {
|
---|
53 | print("$ArrayofBuilds[$i][0]\t\t$ArrayofBuilds[$i][1]\t\t$ArrayofBuilds[$i][2]\n");
|
---|
54 | $mypath = $smartclient_root.$ArrayofBuilds[$i][0];
|
---|
55 |
|
---|
56 | if ($ArrayofBuilds[$i][2])
|
---|
57 | {
|
---|
58 | $ENV{'BUILD_MODE'}=$ArrayofBuilds[$i][2];
|
---|
59 | }
|
---|
60 | else
|
---|
61 | {
|
---|
62 | $ENV{'BUILD_MODE'}="--clean";
|
---|
63 | }
|
---|
64 | $ENV{'BUILD_DIST'}=$ArrayofBuilds[$i][1];
|
---|
65 | $ENV{'BUILD_DIST'}=$ArrayofBuilds[$i][1];
|
---|
66 |
|
---|
67 | # system "./test.sh";
|
---|
68 | $_=$ArrayofBuilds[$i][0];
|
---|
69 | print "$_ \n";
|
---|
70 | tr/\//\_/;
|
---|
71 | $logfilename = $_.".$ArrayofBuilds[$i][1].log";
|
---|
72 | print "++++++++++++++++++++++++++++++++++++++++++\n";
|
---|
73 | print "executing command: cd $mypath; $build 2>&1 |tee $logfilename\n";
|
---|
74 | print "BUILD_DIST ist $ENV{'BUILD_DIST'}\n";
|
---|
75 | print "BUILD_MODE ist $ENV{'BUILD_MODE'}\n";
|
---|
76 |
|
---|
77 | print "writing logfile to $logfilename \n";
|
---|
78 | print "++++++++++++++++++++++++++++++++++++++++++\n";
|
---|
79 | # system "cd $mypath; $build 2>&1 > $logfilename;"
|
---|
80 | system "cd $mypath; $build 2>&1 |tee $logfilename;"
|
---|
81 | }
|
---|
82 |
|
---|
83 | print "buildall.pl terminated\n";
|
---|
84 |
|
---|
85 |
|
---|
86 |
|
---|