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