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.6 2002/09/05 09:21:58 pstorz Exp $
|
---|
5 | use Getopt::Std;
|
---|
6 |
|
---|
7 |
|
---|
8 | format TABELLE =
|
---|
9 | @<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
---|
10 | $wert1, $wert2, $wert3
|
---|
11 | .
|
---|
12 |
|
---|
13 |
|
---|
14 | # Programmoptionen: -b (buildlist)
|
---|
15 |
|
---|
16 | my $smartclient_root="../../"; # Pfad, zu dem die Pfade in buildlist stehen
|
---|
17 | my $build = "build.sh";
|
---|
18 | our ($opt_b);
|
---|
19 | my @ArrayofBuilds;
|
---|
20 | getopts('b:');
|
---|
21 |
|
---|
22 | if (!$opt_b)
|
---|
23 | {die "usage: buildall.pl -b buildlist\n";
|
---|
24 | };
|
---|
25 |
|
---|
26 | (open(BUILDLIST,$opt_b)) || die "Die Buildlist $opt_b konnte nicht gefunden werden";
|
---|
27 |
|
---|
28 |
|
---|
29 | while (<BUILDLIST>) #Buildlist parsen
|
---|
30 | {
|
---|
31 | next if (/^\#.*$/);
|
---|
32 | # if (/([\w\/]+)\s*:([\/\w\-\+\.]+)\s+:((\s*\-\-\w*)*)$/)
|
---|
33 | if (/(\S+)\s*:(\S+)\s*:(\S+)\s*$/)
|
---|
34 | {
|
---|
35 | ($dir, $arch, $opt) = ($1, $2, $3);
|
---|
36 | chomp ($arch);
|
---|
37 | @build=($dir, $arch, $opt);
|
---|
38 | push @ArrayofBuilds, [@build];
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 |
|
---|
43 |
|
---|
44 | print "What will be done:\n\n";
|
---|
45 | ($wert1,$wert2,$wert3)= ("Path","Distribuition","Buildoptions");
|
---|
46 | $~="TABELLE";
|
---|
47 | write;
|
---|
48 | print "\n";
|
---|
49 | for $i (0 .. $#ArrayofBuilds)
|
---|
50 | {
|
---|
51 | ($wert1,$wert2,$wert3)= ($ArrayofBuilds[$i][0],$ArrayofBuilds[$i][1],$ArrayofBuilds[$i][2]);
|
---|
52 | $~="TABELLE";
|
---|
53 | write;
|
---|
54 | }
|
---|
55 | print "\n\n\n ATTENTION: the srpms from the directory external/SuSE must be built before!\n";
|
---|
56 | print "to build srpms, goto dir external/SuSE, execute build_srpms.sh script!\n\n\n";
|
---|
57 | print 'Are the srpms built and all options OK? (y/n)';
|
---|
58 |
|
---|
59 | $answer =<STDIN>;
|
---|
60 | chomp ($answer);
|
---|
61 | if ($answer ne "y") {die("canceled")};
|
---|
62 |
|
---|
63 | for $i (0 .. $#ArrayofBuilds)
|
---|
64 | {
|
---|
65 | print("$ArrayofBuilds[$i][0]\t\t$ArrayofBuilds[$i][1]\t\t$ArrayofBuilds[$i][2]\n");
|
---|
66 | $mypath = $smartclient_root.$ArrayofBuilds[$i][0];
|
---|
67 |
|
---|
68 | if ($ArrayofBuilds[$i][2])
|
---|
69 | {
|
---|
70 | $ENV{'BUILD_MODE'}=$ArrayofBuilds[$i][2];
|
---|
71 | }
|
---|
72 | else
|
---|
73 | {
|
---|
74 | $ENV{'BUILD_MODE'}="--clean";
|
---|
75 | }
|
---|
76 | $ENV{'BUILD_DIST'}=$ArrayofBuilds[$i][1];
|
---|
77 |
|
---|
78 |
|
---|
79 | # system "./test.sh";
|
---|
80 | $_=$ArrayofBuilds[$i][0];
|
---|
81 | print "$_ \n";
|
---|
82 | tr/\//\_/;
|
---|
83 | $logfilename = $_.".$ArrayofBuilds[$i][1].log";
|
---|
84 | print "++++++++++++++++++++++++++++++++++++++++++\n";
|
---|
85 | print "executing command: cd $mypath; $build 2>&1 > $logfilename\n";
|
---|
86 | print "BUILD_DIST ist $ENV{'BUILD_DIST'}\n";
|
---|
87 | print "BUILD_MODE ist $ENV{'BUILD_MODE'}\n";
|
---|
88 |
|
---|
89 | print "writing logfile to $logfilename \n\n\n";
|
---|
90 | print "you can watch building with following command: \n";
|
---|
91 | $workdir=`pwd`;
|
---|
92 | chomp $workdir;
|
---|
93 | print "less +F $workdir/$mypath/$logfilename\n";
|
---|
94 | system "xterm -T \"build log for PACKET: $mypath ARCH:$ArrayofBuilds[$i][1] \" -e less +F $workdir/$mypath/$logfilename &";
|
---|
95 | print "++++++++++++++++++++++++++++++++++++++++++\n";
|
---|
96 | $retval = system "cd $mypath; $build >$logfilename 2>&1;";
|
---|
97 | # $retval = system "./exit.sh 2>&1 > $logfilename;";
|
---|
98 |
|
---|
99 |
|
---|
100 | if ($retval == 0)
|
---|
101 | {
|
---|
102 | $ArrayofBuilds[$i][3]= "SUCESS $ArrayofBuilds[$i][0] :";
|
---|
103 | print"****** ******\n";
|
---|
104 | print"****** building of $ArrayofBuilds[$i][0] SUCCESSFULL: \n" ;
|
---|
105 | print"****** ******\n";
|
---|
106 | }
|
---|
107 | else
|
---|
108 | {
|
---|
109 | $ArrayofBuilds[$i][3]="ERROR $ArrayofBuilds[$i][0] UNSUCCESSFULL:\n";
|
---|
110 | print"****** ******\n";
|
---|
111 | print"\n\n\nERROR: building of $ArrayofBuilds[$i][0] UNSUCCESSFULL \n";
|
---|
112 | print"****** ******\n";
|
---|
113 | }
|
---|
114 |
|
---|
115 | }
|
---|
116 |
|
---|
117 | print "Building results:\n";
|
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 | ($wert1,$wert2,$wert3)= ("Path","Distribuition","Result");
|
---|
122 | $~="TABELLE";
|
---|
123 | write;
|
---|
124 | print "\n";
|
---|
125 |
|
---|
126 | for $i (0 .. $#ArrayofBuilds)
|
---|
127 | {
|
---|
128 | ($wert1,$wert2,$wert3)= ($ArrayofBuilds[$i][0],$ArrayofBuilds[$i][1],$ArrayofBuilds[$i][3]);
|
---|
129 | $~="TABELLE";
|
---|
130 | write;
|
---|
131 | # print("$ArrayofBuilds[$i][0]:Result: $ArrayofBuilds[$i][3]");
|
---|
132 | }
|
---|
133 |
|
---|
134 |
|
---|
135 |
|
---|
136 |
|
---|
137 | print "buildall.pl terminated\n";
|
---|
138 |
|
---|
139 |
|
---|
140 |
|
---|
141 |
|
---|