source: trunk/technical/common/build/buildall.pl@ 625

Last change on this file since 625 was 623, checked in by joergs, on Oct 16, 2002 at 8:08:34 PM

build of src.rpm (without extracting into directory)

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