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

Last change on this file since 610 was 610, checked in by pstorz, on Sep 17, 2002 at 11:50:26 AM

neu

File size: 4.3 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.1 2002/09/17 09:50:20 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)
17
18my $smartclient_root="../../"; # Pfad, zu dem die Pfade in buildlist stehen
19my $build = "build.sh";
20our ($opt_b);
21my @ArrayofBuilds;
22getopts('b:');
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(open(BUILDLIST,$opt_b)) || die "Die Buildlist $opt_b konnte nicht gefunden werden";
33
34
35while (<BUILDLIST>) #Buildlist parsen
36 {
37 next if (/^\#.*$/);
38# if (/([\w\/]+)\s*:([\/\w\-\+\.]+)\s+:((\s*\-\-\w*)*)$/)
39 if (/(\S+)\s*:(\S+)\s*:(\S+)\s*$/)
40 {
41 ($dir, $arch, $opt) = ($1, $2, $3);
42 chomp ($arch);
43 @build=($dir, $arch, $opt);
44 push @ArrayofBuilds, [@build];
45 }
46 }
47
48
49
50print "What will be done:\n\n";
51($wert1,$wert2,$wert3)= ("Path","Distribuition","Buildoptions");
52$~="TABELLE";
53write;
54print "\n";
55for $i (0 .. $#ArrayofBuilds)
56 {
57 ($wert1,$wert2,$wert3)= ($ArrayofBuilds[$i][0],$ArrayofBuilds[$i][1],$ArrayofBuilds[$i][2]);
58 $~="TABELLE";
59 write;
60 }
61print 'are all options OK? (y/n)';
62
63$answer =<STDIN>;
64chomp ($answer);
65if ($answer ne "y") {die("canceled")};
66
67#print "erasing old directories\n";
68#system "cd ./clean_dirs.sh";
69
70
71for $i (0 .. $#ArrayofBuilds)
72 {
73 print("$ArrayofBuilds[$i][0]\t\t$ArrayofBuild[$i][1]\t\t$ArrayofBuilds[$i][2]\n");
74 $_ = $smartclient_root.$ArrayofBuilds[$i][0];
75 ($mypath,$myrpm) = /(.*)\/(.*\.src\.rpm)/;
76 print "mypath: $mypath\n";
77 print "myrpm: $myrpm\n";
78 print "cleaning old dirs of packet $myrpm\n";
79 system "./clean_dirs.sh $mypath";
80}
81
82
83for $i (0 .. $#ArrayofBuilds)
84 {
85 print("$ArrayofBuilds[$i][0]\t\t$ArrayofBuilds[$i][1]\t\t$ArrayofBuilds[$i][2]\n");
86 $_ = $smartclient_root.$ArrayofBuilds[$i][0];
87 ($mypath,$myrpm) = /(.*\/.*)(\.src\.rpm)/;
88 print "mypath: $mypath\n";
89# print "myrpm: $myrpm\n";
90
91 print "Unpacking packet $myrpm\n";
92 system "./unpack_srpm.sh $_";
93
94
95 if ($ArrayofBuilds[$i][2])
96 {
97 $ENV{'BUILD_MODE'}=$ArrayofBuilds[$i][2];
98 }
99 else
100 {
101 $ENV{'BUILD_MODE'}="--clean";
102 }
103 $ENV{'BUILD_DIST'}=$ArrayofBuilds[$i][1];
104 $_=$ArrayofBuilds[$i][0];
105 print "$_ \n";
106 tr/\//\_/;
107 $logfilename = $_.".$ArrayofBuilds[$i][1].log";
108 print "++++++++++++++++++++++++++++++++++++++++++\n";
109 print "executing command: cd $mypath; $build 2>&1 > $logfilename\n";
110 print "BUILD_DIST ist $ENV{'BUILD_DIST'}\n";
111 print "BUILD_MODE ist $ENV{'BUILD_MODE'}\n";
112
113 print "writing logfile to $logfilename \n\n\n";
114 print "you can watch building with following command: \n";
115 $workdir=`pwd`;
116 chomp $workdir;
117 print "less +F $workdir/$mypath/$logfilename\n";
118 system "xterm -T \"build log for PACKET: $mypath ARCH:$ArrayofBuilds[$i][1] \" -e less +F $workdir/$mypath/$logfilename &";
119 print "++++++++++++++++++++++++++++++++++++++++++\n";
120 $retval = system "cd $mypath; $build >$logfilename 2>&1;";
121# $retval = system "./exit.sh 2>&1 > $logfilename;";
122
123
124 if ($retval == 0)
125 {
126 $ArrayofBuilds[$i][3]= "SUCESS $ArrayofBuilds[$i][0] :";
127 print"****** ******\n";
128 print"****** building of $ArrayofBuilds[$i][0] SUCCESSFULL: \n" ;
129 print"****** ******\n";
130 }
131 else
132 {
133 $ArrayofBuilds[$i][3]="ERROR $ArrayofBuilds[$i][0] UNSUCCESSFULL:\n";
134 print"****** ******\n";
135 print"\n\n\nERROR: building of $ArrayofBuilds[$i][0] UNSUCCESSFULL \n";
136 print"****** ******\n";
137 }
138
139}
140
141print "Building results:\n";
142
143
144($wert1,$wert2,$wert3)= ("Path","Distribuition","Result");
145$~="TABELLE";
146write;
147print "\n";
148
149for $i (0 .. $#ArrayofBuilds)
150 {
151 ($wert1,$wert2,$wert3)= ($ArrayofBuilds[$i][0],$ArrayofBuilds[$i][1],$ArrayofBuilds[$i][3]);
152 $~="TABELLE";
153 write;
154# print("$ArrayofBuilds[$i][0]:Result: $ArrayofBuilds[$i][3]");
155 }
156
157
158
159
160print "buildlist_srpms.pl terminated\n";
161
162
163
164
Note: See TracBrowser for help on using the repository browser.