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