[589] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | # automatisches buildskript fuer smartclient
|
---|
| 3 | # liest die konfiguration aus der mit -b übergebenen Datei
|
---|
[599] | 4 | # $Id: buildall.pl,v 1.6 2002/09/05 09:21:58 pstorz Exp $
|
---|
[589] | 5 | use Getopt::Std;
|
---|
| 6 |
|
---|
[599] | 7 |
|
---|
| 8 | format TABELLE =
|
---|
| 9 | @<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
---|
| 10 | $wert1, $wert2, $wert3
|
---|
| 11 | .
|
---|
| 12 |
|
---|
| 13 |
|
---|
[589] | 14 | # Programmoptionen: -b (buildlist)
|
---|
| 15 |
|
---|
| 16 | my $smartclient_root="../../"; # Pfad, zu dem die Pfade in buildlist stehen
|
---|
[594] | 17 | my $build = "build.sh";
|
---|
[589] | 18 | our ($opt_b);
|
---|
| 19 | my @ArrayofBuilds;
|
---|
| 20 | getopts('b:');
|
---|
| 21 |
|
---|
[593] | 22 | if (!$opt_b)
|
---|
| 23 | {die "usage: buildall.pl -b buildlist\n";
|
---|
| 24 | };
|
---|
| 25 |
|
---|
[589] | 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 (/^\#.*$/);
|
---|
[593] | 32 | # if (/([\w\/]+)\s*:([\/\w\-\+\.]+)\s+:((\s*\-\-\w*)*)$/)
|
---|
| 33 | if (/(\S+)\s*:(\S+)\s*:(\S+)\s*$/)
|
---|
[589] | 34 | {
|
---|
| 35 | ($dir, $arch, $opt) = ($1, $2, $3);
|
---|
| 36 | chomp ($arch);
|
---|
| 37 | @build=($dir, $arch, $opt);
|
---|
| 38 | push @ArrayofBuilds, [@build];
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 |
|
---|
[593] | 42 |
|
---|
| 43 |
|
---|
[599] | 44 | print "What will be done:\n\n";
|
---|
| 45 | ($wert1,$wert2,$wert3)= ("Path","Distribuition","Buildoptions");
|
---|
| 46 | $~="TABELLE";
|
---|
| 47 | write;
|
---|
| 48 | print "\n";
|
---|
[589] | 49 | for $i (0 .. $#ArrayofBuilds)
|
---|
| 50 | {
|
---|
[599] | 51 | ($wert1,$wert2,$wert3)= ($ArrayofBuilds[$i][0],$ArrayofBuilds[$i][1],$ArrayofBuilds[$i][2]);
|
---|
| 52 | $~="TABELLE";
|
---|
| 53 | write;
|
---|
[593] | 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");
|
---|
[589] | 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];
|
---|
[596] | 77 |
|
---|
[593] | 78 |
|
---|
[589] | 79 | # system "./test.sh";
|
---|
| 80 | $_=$ArrayofBuilds[$i][0];
|
---|
| 81 | print "$_ \n";
|
---|
| 82 | tr/\//\_/;
|
---|
[593] | 83 | $logfilename = $_.".$ArrayofBuilds[$i][1].log";
|
---|
[589] | 84 | print "++++++++++++++++++++++++++++++++++++++++++\n";
|
---|
[596] | 85 | print "executing command: cd $mypath; $build 2>&1 > $logfilename\n";
|
---|
[589] | 86 | print "BUILD_DIST ist $ENV{'BUILD_DIST'}\n";
|
---|
| 87 | print "BUILD_MODE ist $ENV{'BUILD_MODE'}\n";
|
---|
[593] | 88 |
|
---|
[596] | 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 &";
|
---|
[589] | 95 | print "++++++++++++++++++++++++++++++++++++++++++\n";
|
---|
[596] | 96 | $retval = system "cd $mypath; $build >$logfilename 2>&1;";
|
---|
| 97 | # $retval = system "./exit.sh 2>&1 > $logfilename;";
|
---|
| 98 |
|
---|
| 99 |
|
---|
| 100 | if ($retval == 0)
|
---|
| 101 | {
|
---|
[599] | 102 | $ArrayofBuilds[$i][3]= "SUCESS $ArrayofBuilds[$i][0] :";
|
---|
[596] | 103 | print"****** ******\n";
|
---|
| 104 | print"****** building of $ArrayofBuilds[$i][0] SUCCESSFULL: \n" ;
|
---|
| 105 | print"****** ******\n";
|
---|
| 106 | }
|
---|
| 107 | else
|
---|
| 108 | {
|
---|
[599] | 109 | $ArrayofBuilds[$i][3]="ERROR $ArrayofBuilds[$i][0] UNSUCCESSFULL:\n";
|
---|
[596] | 110 | print"****** ******\n";
|
---|
| 111 | print"\n\n\nERROR: building of $ArrayofBuilds[$i][0] UNSUCCESSFULL \n";
|
---|
| 112 | print"****** ******\n";
|
---|
| 113 | }
|
---|
| 114 |
|
---|
[589] | 115 | }
|
---|
| 116 |
|
---|
[596] | 117 | print "Building results:\n";
|
---|
| 118 |
|
---|
[599] | 119 |
|
---|
| 120 |
|
---|
| 121 | ($wert1,$wert2,$wert3)= ("Path","Distribuition","Result");
|
---|
| 122 | $~="TABELLE";
|
---|
| 123 | write;
|
---|
| 124 | print "\n";
|
---|
| 125 |
|
---|
[596] | 126 | for $i (0 .. $#ArrayofBuilds)
|
---|
| 127 | {
|
---|
[599] | 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]");
|
---|
[596] | 132 | }
|
---|
| 133 |
|
---|
| 134 |
|
---|
| 135 |
|
---|
| 136 |
|
---|
[589] | 137 | print "buildall.pl terminated\n";
|
---|
| 138 |
|
---|
| 139 |
|
---|
| 140 |
|
---|
[599] | 141 |
|
---|