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.5 2002/09/04 14:49:42 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 = "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 |
|
---|
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 > $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\n\n";
|
---|
78 | print "you can watch building with following command: \n";
|
---|
79 | $workdir=`pwd`;
|
---|
80 | chomp $workdir;
|
---|
81 | print "less +F $workdir/$mypath/$logfilename\n";
|
---|
82 | system "xterm -T \"build log for PACKET: $mypath ARCH:$ArrayofBuilds[$i][1] \" -e less +F $workdir/$mypath/$logfilename &";
|
---|
83 | print "++++++++++++++++++++++++++++++++++++++++++\n";
|
---|
84 | $retval = system "cd $mypath; $build >$logfilename 2>&1;";
|
---|
85 | # $retval = system "./exit.sh 2>&1 > $logfilename;";
|
---|
86 |
|
---|
87 |
|
---|
88 | if ($retval == 0)
|
---|
89 | {
|
---|
90 | $ArrayofBuilds[$i][3]= "building of $ArrayofBuilds[$i][0] SUCCESSFULL:";
|
---|
91 | print"****** ******\n";
|
---|
92 | print"****** building of $ArrayofBuilds[$i][0] SUCCESSFULL: \n" ;
|
---|
93 | print"****** ******\n";
|
---|
94 | }
|
---|
95 | else
|
---|
96 | {
|
---|
97 | $ArrayofBuilds[$i][3]="ERROR: building of $ArrayofBuilds[$i][0] UNSUCCESSFULL:\n";
|
---|
98 | print"****** ******\n";
|
---|
99 | print"\n\n\nERROR: building of $ArrayofBuilds[$i][0] UNSUCCESSFULL \n";
|
---|
100 | print"****** ******\n";
|
---|
101 | }
|
---|
102 |
|
---|
103 | }
|
---|
104 |
|
---|
105 | print "Building results:\n";
|
---|
106 |
|
---|
107 | for $i (0 .. $#ArrayofBuilds)
|
---|
108 | {
|
---|
109 | print("$ArrayofBuilds[$i][0]:Result: $ArrayofBuilds[$i][3]");
|
---|
110 | }
|
---|
111 |
|
---|
112 |
|
---|
113 |
|
---|
114 |
|
---|
115 | print "buildall.pl terminated\n";
|
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|