source: trunk/technical/common/build/build_srpms.pl@ 613

Last change on this file since 613 was 611, checked in by pstorz, on Sep 17, 2002 at 12:03:24 PM

* empty log message *

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