[589] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | # automatisches buildskript fuer smartclient
|
---|
| 3 | # liest die konfiguration aus der mit -b übergebenen Datei
|
---|
[601] | 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
|
---|
[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 |
|
---|
[593] | 24 | if (!$opt_b)
|
---|
| 25 | {die "usage: buildall.pl -b buildlist\n";
|
---|
| 26 | };
|
---|
| 27 |
|
---|
[589] | 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 (/^\#.*$/);
|
---|
[593] | 34 | # if (/([\w\/]+)\s*:([\/\w\-\+\.]+)\s+:((\s*\-\-\w*)*)$/)
|
---|
| 35 | if (/(\S+)\s*:(\S+)\s*:(\S+)\s*$/)
|
---|
[589] | 36 | {
|
---|
| 37 | ($dir, $arch, $opt) = ($1, $2, $3);
|
---|
| 38 | chomp ($arch);
|
---|
| 39 | @build=($dir, $arch, $opt);
|
---|
| 40 | push @ArrayofBuilds, [@build];
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 |
|
---|
[593] | 44 |
|
---|
| 45 |
|
---|
[599] | 46 | print "What will be done:\n\n";
|
---|
| 47 | ($wert1,$wert2,$wert3)= ("Path","Distribuition","Buildoptions");
|
---|
| 48 | $~="TABELLE";
|
---|
| 49 | write;
|
---|
| 50 | print "\n";
|
---|
[589] | 51 | for $i (0 .. $#ArrayofBuilds)
|
---|
| 52 | {
|
---|
[599] | 53 | ($wert1,$wert2,$wert3)= ($ArrayofBuilds[$i][0],$ArrayofBuilds[$i][1],$ArrayofBuilds[$i][2]);
|
---|
| 54 | $~="TABELLE";
|
---|
| 55 | write;
|
---|
[593] | 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");
|
---|
[589] | 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];
|
---|
[596] | 79 |
|
---|
[593] | 80 |
|
---|
[589] | 81 | # system "./test.sh";
|
---|
| 82 | $_=$ArrayofBuilds[$i][0];
|
---|
| 83 | print "$_ \n";
|
---|
| 84 | tr/\//\_/;
|
---|
[593] | 85 | $logfilename = $_.".$ArrayofBuilds[$i][1].log";
|
---|
[589] | 86 | print "++++++++++++++++++++++++++++++++++++++++++\n";
|
---|
[596] | 87 | print "executing command: cd $mypath; $build 2>&1 > $logfilename\n";
|
---|
[589] | 88 | print "BUILD_DIST ist $ENV{'BUILD_DIST'}\n";
|
---|
| 89 | print "BUILD_MODE ist $ENV{'BUILD_MODE'}\n";
|
---|
[593] | 90 |
|
---|
[596] | 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 &";
|
---|
[589] | 97 | print "++++++++++++++++++++++++++++++++++++++++++\n";
|
---|
[596] | 98 | $retval = system "cd $mypath; $build >$logfilename 2>&1;";
|
---|
| 99 | # $retval = system "./exit.sh 2>&1 > $logfilename;";
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 | if ($retval == 0)
|
---|
| 103 | {
|
---|
[599] | 104 | $ArrayofBuilds[$i][3]= "SUCESS $ArrayofBuilds[$i][0] :";
|
---|
[596] | 105 | print"****** ******\n";
|
---|
| 106 | print"****** building of $ArrayofBuilds[$i][0] SUCCESSFULL: \n" ;
|
---|
| 107 | print"****** ******\n";
|
---|
| 108 | }
|
---|
| 109 | else
|
---|
| 110 | {
|
---|
[599] | 111 | $ArrayofBuilds[$i][3]="ERROR $ArrayofBuilds[$i][0] UNSUCCESSFULL:\n";
|
---|
[596] | 112 | print"****** ******\n";
|
---|
| 113 | print"\n\n\nERROR: building of $ArrayofBuilds[$i][0] UNSUCCESSFULL \n";
|
---|
| 114 | print"****** ******\n";
|
---|
| 115 | }
|
---|
| 116 |
|
---|
[589] | 117 | }
|
---|
| 118 |
|
---|
[596] | 119 | print "Building results:\n";
|
---|
| 120 |
|
---|
[599] | 121 |
|
---|
| 122 |
|
---|
| 123 | ($wert1,$wert2,$wert3)= ("Path","Distribuition","Result");
|
---|
| 124 | $~="TABELLE";
|
---|
| 125 | write;
|
---|
| 126 | print "\n";
|
---|
| 127 |
|
---|
[596] | 128 | for $i (0 .. $#ArrayofBuilds)
|
---|
| 129 | {
|
---|
[599] | 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]");
|
---|
[596] | 134 | }
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 |
|
---|
| 138 |
|
---|
[589] | 139 | print "buildall.pl terminated\n";
|
---|
| 140 |
|
---|
| 141 |
|
---|
| 142 |
|
---|
[599] | 143 |
|
---|