1 | #!/usr/bin/perl -w |
---|
2 | # |
---|
3 | # Project Builder main application |
---|
4 | # |
---|
5 | # $Id$ |
---|
6 | # |
---|
7 | # Copyright B. Cornec 2007 |
---|
8 | # Provided under the GPL v2 |
---|
9 | |
---|
10 | # Syntax: see at end |
---|
11 | |
---|
12 | use strict 'vars'; |
---|
13 | use Getopt::Std; |
---|
14 | use Data::Dumper; |
---|
15 | use English; |
---|
16 | use AppConfig qw(:argcount :expand); |
---|
17 | use File::Basename; |
---|
18 | use File::Copy; |
---|
19 | use Time::localtime qw(localtime); |
---|
20 | use POSIX qw(strftime); |
---|
21 | |
---|
22 | # Global variables |
---|
23 | use lib qw (lib); |
---|
24 | use ProjectBuilder::Distribution qw (pb_distro_init); |
---|
25 | use ProjectBuilder::Version qw (pb_version_init); |
---|
26 | use ProjectBuilder::Base qw (pb_conf_read pb_conf_get pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb pb_cms_export pb_cms_log); |
---|
27 | |
---|
28 | my %opts; # CLI Options |
---|
29 | my $action; # action to realize |
---|
30 | my $test = "FALSE"; |
---|
31 | my $option = ""; |
---|
32 | my @pkgs; |
---|
33 | my $pbtag; # Global Tag variable |
---|
34 | my $pbver; # Global Version variable |
---|
35 | my $pbscript; # Name of the script |
---|
36 | my %pbver; # per package |
---|
37 | my %pbtag; # per package |
---|
38 | my $pbrev; # Global REVISION variable |
---|
39 | my @date=(localtime->sec(), localtime->min(), localtime->hour(), localtime->mday(), localtime->mon(), localtime->year(), localtime->wday(), localtime->yday(), localtime->isdst()); |
---|
40 | my $pbdate = strftime("%Y-%m-%d", @date); |
---|
41 | my $pbdatecvs = strftime("%Y-%m-%d %H:%M:%S", @date); |
---|
42 | my $debug = 0; |
---|
43 | my $pbaccount; # Login to use to connect to the VM |
---|
44 | my $pbport; # Port to use to connect to the VM |
---|
45 | my $LOG = \*STDOUT; |
---|
46 | |
---|
47 | getopts('a:hl:m:P:p:qr:s:tv',\%opts); |
---|
48 | |
---|
49 | my ($projectbuilderver,$projectbuilderrev) = pb_version_init(); |
---|
50 | if (defined $opts{'h'}) { |
---|
51 | pb_syntax(); |
---|
52 | exit(0); |
---|
53 | } |
---|
54 | if (defined $opts{'v'}) { |
---|
55 | $debug++; |
---|
56 | } |
---|
57 | if (defined $opts{'q'}) { |
---|
58 | $debug=-1; |
---|
59 | } |
---|
60 | if (defined $opts{'l'}) { |
---|
61 | open(LOG,"> $opts{'l'}") || die "Unable to log to $opts{'l'}: $!"; |
---|
62 | $LOG = *LOG; |
---|
63 | $debug = 0 if ($debug == -1); |
---|
64 | } |
---|
65 | # Handles test option |
---|
66 | if (defined $opts{'t'}) { |
---|
67 | $test = "TRUE"; |
---|
68 | # Works only for SVN |
---|
69 | $option = "-r BASE"; |
---|
70 | } |
---|
71 | |
---|
72 | # Handle root of the project if defined |
---|
73 | if (defined $opts{'r'}) { |
---|
74 | $ENV{'PBROOT'} = $opts{'r'}; |
---|
75 | } |
---|
76 | # Handle virtual machines if any |
---|
77 | if (defined $opts{'m'}) { |
---|
78 | $ENV{'PBVM'} = $opts{'m'}; |
---|
79 | } |
---|
80 | if (defined $opts{'s'}) { |
---|
81 | $pbscript = $opts{'s'}; |
---|
82 | } |
---|
83 | if (defined $opts{'a'}) { |
---|
84 | $pbaccount = $opts{'a'}; |
---|
85 | } |
---|
86 | if (defined $opts{'P'}) { |
---|
87 | $pbport = $opts{'P'}; |
---|
88 | } |
---|
89 | |
---|
90 | # Get Action |
---|
91 | $action = shift @ARGV; |
---|
92 | die pb_syntax() if (not defined $action); |
---|
93 | |
---|
94 | my ($pbrc, $filteredfiles, $defpkgdir, $extpkgdir); |
---|
95 | |
---|
96 | # Handles project name if any |
---|
97 | # And get global params |
---|
98 | if (defined $opts{'p'}) { |
---|
99 | ($ENV{'PBPROJ'},$debug,$LOG, $pbrc, $filteredfiles, $defpkgdir, $extpkgdir) |
---|
100 | = pb_env_init($opts{'p'}); |
---|
101 | } else { |
---|
102 | ($ENV{'PBPROJ'},$debug,$LOG, $pbrc, $filteredfiles, $defpkgdir, $extpkgdir) |
---|
103 | = pb_env_init(); |
---|
104 | } |
---|
105 | |
---|
106 | print $LOG "Project: $ENV{'PBPROJ'}\n" if ($debug >= 0); |
---|
107 | print $LOG "Action: $action\n" if ($debug >= 0); |
---|
108 | |
---|
109 | # Keep those project values to store them at the end each time |
---|
110 | my $pbprojtag = $ENV{'PBTAG'}; |
---|
111 | my $pbprojver = $ENV{'PBVER'}; |
---|
112 | |
---|
113 | # Act depending on action |
---|
114 | if ($action =~ /^cms2build$/) { |
---|
115 | pb_cms2build(); |
---|
116 | } elsif ($action =~ /^build2pkg$/) { |
---|
117 | pb_build2pkg(); |
---|
118 | } elsif ($action =~ /^cms2pkg$/) { |
---|
119 | pb_cms2build(); |
---|
120 | pb_build2pkg(); |
---|
121 | } elsif ($action =~ /^build2ssh$/) { |
---|
122 | pb_build2ssh(); |
---|
123 | } elsif ($action =~ /^pkg2ssh$/) { |
---|
124 | pb_pkg2ssh(); |
---|
125 | } elsif ($action =~ /^build2vm$/) { |
---|
126 | pb_build2vm(); |
---|
127 | } elsif ($action =~ /^cms2vm$/) { |
---|
128 | pb_cms2build(); |
---|
129 | pb_build2vm(); |
---|
130 | } elsif ($action =~ /^launchvm$/) { |
---|
131 | pb_launchvm($ENV{'PBVM'}); |
---|
132 | } elsif ($action =~ /^script2vm$/) { |
---|
133 | pb_script2vm($pbscript); |
---|
134 | } elsif ($action =~ /^clean$/) { |
---|
135 | } else { |
---|
136 | print $LOG "'$action' is not available\n"; |
---|
137 | pb_syntax(); |
---|
138 | } |
---|
139 | |
---|
140 | sub pb_cms2build { |
---|
141 | |
---|
142 | my $ptr = pb_get_pkg($defpkgdir,$extpkgdir); |
---|
143 | @pkgs = @$ptr; |
---|
144 | my $cms=pb_cms_init($ENV{'PBPROJ'}); |
---|
145 | |
---|
146 | my ($pkgv, $pkgt) = pb_conf_read("$ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb","pkgver","pkgtag"); |
---|
147 | |
---|
148 | # declare packager for filtering |
---|
149 | my ($tmp) = pb_conf_get("packager"); |
---|
150 | my $pbpackager = $tmp->{$ENV{'PBPROJ'}}; |
---|
151 | |
---|
152 | foreach my $pbpkg (@pkgs) { |
---|
153 | $ENV{'PBPKG'} = $pbpkg; |
---|
154 | if ((defined $pkgv) && (defined $pkgv->{$pbpkg})) { |
---|
155 | $pbver = $pkgv->{$pbpkg}; |
---|
156 | $ENV{'PBVER'} = $pbver; |
---|
157 | } else { |
---|
158 | $pbver = $ENV{'PBVER'}; |
---|
159 | } |
---|
160 | if ((defined $pkgt) && (defined $pkgt->{$pbpkg})) { |
---|
161 | $pbtag = $pkgt->{$pbpkg}; |
---|
162 | $ENV{'PBTAG'} = $pbtag; |
---|
163 | } else { |
---|
164 | $pbtag = $ENV{'PBTAG'}; |
---|
165 | } |
---|
166 | |
---|
167 | $pbrev = $ENV{'PBREVISION'}; |
---|
168 | print $LOG "\n"; |
---|
169 | print $LOG "Management of $pbpkg $pbver-$pbtag (rev $pbrev)\n"; |
---|
170 | die "Unable to get env var PBDESTDIR" if (not defined $ENV{'PBDESTDIR'}); |
---|
171 | # Clean up dest if necessary. The export will recreate it |
---|
172 | my $dest = "$ENV{'PBDESTDIR'}/$pbpkg-$pbver"; |
---|
173 | pb_rm_rf($dest) if (-d $dest); |
---|
174 | |
---|
175 | # Export CMS tree for the concerned package to dest |
---|
176 | # And generate some additional files |
---|
177 | $OUTPUT_AUTOFLUSH=1; |
---|
178 | |
---|
179 | # computes in which dir we have to work |
---|
180 | my $dir = $defpkgdir->{$pbpkg}; |
---|
181 | $dir = $extpkgdir->{$pbpkg} if (not defined $dir); |
---|
182 | print "def:".Dumper($defpkgdir)." ext: ".Dumper($extpkgdir)." \n" if ($debug >= 1); |
---|
183 | pb_cms_export($cms,$pbdatecvs,"$ENV{'PBROOT'}/$dir",$dest); |
---|
184 | |
---|
185 | # Extract cms log history and store it |
---|
186 | pb_cms_log($cms,"$ENV{'PBROOT'}/$dir","$dest/$ENV{'PBCMSLOGFILE'}"); |
---|
187 | |
---|
188 | my %build; |
---|
189 | |
---|
190 | my ($ptr) = pb_conf_get("vmlist"); |
---|
191 | foreach my $d (split(/,/,$ptr->{$ENV{'PBPROJ'}})) { |
---|
192 | my ($name,$ver) = split(/_/,$d); |
---|
193 | chomp($ver); |
---|
194 | my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init($name,$ver); |
---|
195 | print $LOG "DEBUG: distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf)."\n" if ($debug >= 1); |
---|
196 | print $LOG "DEBUG Filtering PBDATE => $pbdate, PBTAG => $pbtag, PBVER => $pbver\n" if ($debug >= 1); |
---|
197 | |
---|
198 | # Filter build files from the less precise up to the most with overloading |
---|
199 | # Filter all files found, keeping the name, and generating in dest |
---|
200 | |
---|
201 | # Find all build files first relatively to PBROOT |
---|
202 | my %bfiles; |
---|
203 | print $LOG "DEBUG dir: $ENV{'PBCONF'}/$pbpkg\n" if ($debug >= 1); |
---|
204 | $build{"$ddir-$dver"} = "yes"; |
---|
205 | if (-d "$ENV{'PBCONF'}/$pbpkg/$dtype") { |
---|
206 | opendir(BDIR,"$ENV{'PBCONF'}/$pbpkg/$dtype") || die "Unable to open dir $ENV{'PBCONF'}/$pbpkg/$dtype: $!"; |
---|
207 | foreach my $f (readdir(BDIR)) { |
---|
208 | next if ($f =~ /^\./); |
---|
209 | $bfiles{$f} = "$ENV{'PBCONF'}/$pbpkg/$dtype/$f"; |
---|
210 | $bfiles{$f} =~ s~$ENV{'PBROOT'}~~; |
---|
211 | } |
---|
212 | closedir(BDIR); |
---|
213 | } elsif (-d "$ENV{'PBCONF'}/$pbpkg/$dfam") { |
---|
214 | opendir(BDIR,"$ENV{'PBCONF'}/$pbpkg/$dfam") || die "Unable to open dir $ENV{'PBCONF'}/$pbpkg/$dfam: $!"; |
---|
215 | foreach my $f (readdir(BDIR)) { |
---|
216 | next if ($f =~ /^\./); |
---|
217 | $bfiles{$f} = "$ENV{'PBCONF'}/$pbpkg/$dfam/$f"; |
---|
218 | $bfiles{$f} =~ s~$ENV{'PBROOT'}~~; |
---|
219 | } |
---|
220 | closedir(BDIR); |
---|
221 | } elsif (-d "$ENV{'PBCONF'}/$pbpkg/$ddir") { |
---|
222 | opendir(BDIR,"$ENV{'PBCONF'}/$pbpkg/$ddir") || die "Unable to open dir $ENV{'PBCONF'}/$pbpkg/$ddir: $!"; |
---|
223 | foreach my $f (readdir(BDIR)) { |
---|
224 | next if ($f =~ /^\./); |
---|
225 | $bfiles{$f} = "$ENV{'PBCONF'}/$pbpkg/$ddir/$f"; |
---|
226 | $bfiles{$f} =~ s~$ENV{'PBROOT'}~~; |
---|
227 | } |
---|
228 | closedir(BDIR); |
---|
229 | } elsif (-d "$ENV{'PBCONF'}/$pbpkg/$ddir-$dver") { |
---|
230 | opendir(BDIR,"$ENV{'PBCONF'}/$pbpkg/$ddir-$dver") || die "Unable to open dir $ENV{'PBCONF'}/$pbpkg/$ddir-$dver: $!"; |
---|
231 | foreach my $f (readdir(BDIR)) { |
---|
232 | next if ($f =~ /^\./); |
---|
233 | $bfiles{$f} = "$ENV{'PBCONF'}/$pbpkg/$ddir-$dver/$f"; |
---|
234 | $bfiles{$f} =~ s~$ENV{'PBROOT'}~~; |
---|
235 | } |
---|
236 | closedir(BDIR); |
---|
237 | } else { |
---|
238 | $build{"$ddir-$dver"} = "no"; |
---|
239 | next; |
---|
240 | } |
---|
241 | print $LOG "DEBUG bfiles: ".Dumper(\%bfiles)."\n" if ($debug >= 1); |
---|
242 | |
---|
243 | # Get all filters to apply |
---|
244 | my $ptr = pb_get_filters($pbpkg, $dtype, $dfam, $ddir, $dver); |
---|
245 | |
---|
246 | # Apply now all the filters on all the files concerned |
---|
247 | # destination dir depends on the type of file |
---|
248 | if (defined $ptr) { |
---|
249 | foreach my $f (values %bfiles) { |
---|
250 | pb_filter_file_pb("$ENV{'PBROOT'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir, $pbpackager); |
---|
251 | } |
---|
252 | if (defined $filteredfiles->{$pbpkg}) { |
---|
253 | foreach my $f (split(/,/,$filteredfiles->{$pbpkg})) { |
---|
254 | pb_filter_file("$ENV{'PBROOT'}/$dir/$f",$ptr,"$dest/$f",$pbsuf,$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$pbpackager); |
---|
255 | } |
---|
256 | } |
---|
257 | } |
---|
258 | } |
---|
259 | if ($debug >= 0) { |
---|
260 | my @found; |
---|
261 | my @notfound; |
---|
262 | foreach my $b (keys %build) { |
---|
263 | push @found,$b if ($build{$b} =~ /yes/); |
---|
264 | push @notfound,$b if ($build{$b} =~ /no/); |
---|
265 | } |
---|
266 | print $LOG "Build files generated for ".join(',',@found)."\n"; |
---|
267 | print $LOG "No Build files found for ".join(',',@notfound)."\n"; |
---|
268 | } |
---|
269 | # Prepare the dest directory for archive |
---|
270 | if (-x "$ENV{'PBCONF'}/$pbpkg/pbinit") { |
---|
271 | #pb_system("cd $dest ; $ENV{'PBCONF'}/$pbpkg/pbinit","Executing init script $ENV{'PBCONF'}/$pbpkg/pbinit"); |
---|
272 | print $LOG "Executing init script $ENV{'PBCONF'}/$pbpkg/pbinit\n"; |
---|
273 | system("cd $dest ; $ENV{'PBCONF'}/$pbpkg/pbinit"); |
---|
274 | } |
---|
275 | |
---|
276 | # Archive dest dir |
---|
277 | chdir "$ENV{'PBDESTDIR'}" || die "Unable to change dir to $ENV{'PBDESTDIR'}"; |
---|
278 | # Possibility to look at PBSRC to guess more the filename |
---|
279 | pb_system("tar cfz $pbpkg-$pbver.tar.gz $pbpkg-$pbver","Creating $pbpkg tar files compressed"); |
---|
280 | print $LOG "Under $ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz\n" if ($debug >= 0); |
---|
281 | |
---|
282 | # Keep track of what is generated for default |
---|
283 | open(LAST,"> $pbrc->{$ENV{'PBPROJ'}}") || die "Unable to create $pbrc->{$ENV{'PBPROJ'}}"; |
---|
284 | print LAST "pbroot $pbprojver-$pbprojtag = $ENV{'PBROOT'}\n"; |
---|
285 | close(LAST); |
---|
286 | |
---|
287 | # Keep track of per package version |
---|
288 | if (! -f "$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") { |
---|
289 | open(PKG,">$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb"; |
---|
290 | print PKG "# Empty\n"; |
---|
291 | close(PKG); |
---|
292 | } |
---|
293 | my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg"); |
---|
294 | $pkg = { } if (not defined $pkg); |
---|
295 | if ((not defined $pkg->{$pbpkg}) || ($pkg->{$pbpkg} ne "$pbver-$pbtag")) { |
---|
296 | $pkg->{$pbpkg} = "$pbver-$pbtag"; |
---|
297 | } |
---|
298 | |
---|
299 | print $LOG "DEBUG pkg: ".Dumper($pkg)."\n" if ($debug >= 1); |
---|
300 | open(PKG,"> $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb"; |
---|
301 | foreach my $p (keys %$pkg) { |
---|
302 | print PKG "pbpkg $p = $pkg->{$p}\n"; |
---|
303 | } |
---|
304 | close(PKG); |
---|
305 | } |
---|
306 | } |
---|
307 | |
---|
308 | sub pb_build2pkg { |
---|
309 | |
---|
310 | # Get list of packages to build |
---|
311 | my $ptr = pb_get_pkg($defpkgdir,$extpkgdir); |
---|
312 | @pkgs = @$ptr; |
---|
313 | |
---|
314 | # Get the running distro to build on |
---|
315 | my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init(); |
---|
316 | print $LOG "DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n" if ($debug >= 1); |
---|
317 | |
---|
318 | # Get content saved in cms2build |
---|
319 | my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg"); |
---|
320 | $pkg = { } if (not defined $pkg); |
---|
321 | |
---|
322 | # declare packager |
---|
323 | my ($tmp) = pb_conf_get("packager"); |
---|
324 | my $pbpackager = $tmp->{$ENV{'PBPROJ'}}; |
---|
325 | |
---|
326 | chdir "$ENV{'PBBUILDDIR'}"; |
---|
327 | my $made = ""; # pkgs made during build |
---|
328 | foreach my $pbpkg (@pkgs) { |
---|
329 | my $vertag = $pkg->{$pbpkg}; |
---|
330 | # get the version of the current package - maybe different |
---|
331 | ($pbver,$pbtag) = split(/-/,$vertag); |
---|
332 | |
---|
333 | my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz"; |
---|
334 | # Suse < 10.2 forces tar.bz2 usage :-( |
---|
335 | if ($ddir eq "suse") { |
---|
336 | print "SuSE needs bz2 type of packages so recompressing...\n"; |
---|
337 | my $newsrc="$ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.bz2"; |
---|
338 | system "gzip -cd $src | bzip2 -c6 > $newsrc"; |
---|
339 | $src = $newsrc; |
---|
340 | } |
---|
341 | print $LOG "Source file: $src\n" if ($debug >= 0); |
---|
342 | |
---|
343 | print $LOG "Working directory: $ENV{'PBBUILDDIR'}\n" if ($debug >= 0); |
---|
344 | if ($dtype eq "rpm") { |
---|
345 | foreach my $d ('RPMS','SRPMS','SPECS','SOURCES','BUILD') { |
---|
346 | if (! -d "$ENV{'PBBUILDDIR'}/$d") { |
---|
347 | pb_mkdir_p("$ENV{'PBBUILDDIR'}/$d") || die "Please ensure that you can write into $ENV{'PBBUILDDIR'} to create $d\nchown the $ENV{'PBBUILDDIR'} directory to your uid"; |
---|
348 | } |
---|
349 | } |
---|
350 | |
---|
351 | symlink "$src","$ENV{'PBBUILDDIR'}/SOURCES/".basename($src) || die "Unable to symlink $src in $ENV{'PBBUILDDIR'}/SOURCES"; |
---|
352 | # We need to first extract the spec file |
---|
353 | my @specfile; |
---|
354 | @specfile = pb_extract_build_files($src,"$pbpkg-$pbver/pbconf/$ddir-$dver/","$ENV{'PBBUILDDIR'}/SPECS"); |
---|
355 | |
---|
356 | print $LOG "specfile: ".Dumper(\@specfile)."\n" if ($debug >= 1); |
---|
357 | # set LANGUAGE to check for correct log messages |
---|
358 | $ENV{'LANGUAGE'}="C"; |
---|
359 | #system("ls -R $ENV{'PBBUILDDIR'}") if ($debug >= 1); |
---|
360 | foreach my $f (@specfile) { |
---|
361 | if ($f =~ /\.spec$/) { |
---|
362 | pb_system("rpmbuild --define \"packager $pbpackager\" --define \"_topdir $ENV{'PBBUILDDIR'}\" -ba $f","Building package with $f under $ENV{'PBBUILDDIR'}"); |
---|
363 | last; |
---|
364 | } |
---|
365 | } |
---|
366 | $made="$made RPMS/*/$pbpkg-$pbver-$pbtag$pbsuf.*.rpm SRPMS/$pbpkg-$pbver-$pbtag$pbsuf.src.rpm"; |
---|
367 | if (-f "/usr/bin/rpmlint") { |
---|
368 | pb_system("rpmlint $made","Checking validity of rpms with rpmlint"); |
---|
369 | } |
---|
370 | } elsif ($dtype eq "deb") { |
---|
371 | chdir "$ENV{'PBBUILDDIR'}" || die "Unable to chdir to $ENV{'PBBUILDDIR'}"; |
---|
372 | pb_system("tar xfz $src","Extracting sources"); |
---|
373 | |
---|
374 | chdir "$pbpkg-$pbver" || die "Unable to chdir to $pbpkg-$pbver"; |
---|
375 | symlink "pbconf/$ddir-$dver","debian" || die "Unable to symlink to pbconf/$ddir-$dver"; |
---|
376 | pb_system("dpkg-buildpackage -us -uc -rfakeroot","Building package"); |
---|
377 | $made="$made $pbpkg"."_*.deb $pbpkg"."_*.dsc $pbpkg"."_*.tar.gz"; |
---|
378 | } elsif ($dtype eq "ebuild") { |
---|
379 | my @ebuildfile; |
---|
380 | # For gentoo we need to take pb as subsystem name |
---|
381 | pb_mkdir_p("$ENV{'PBBUILDDIR'}/portage/pb/$pbpkg") if (! -d "$ENV{'PBBUILDDIR'}/portage/pb/$pbpkg"); |
---|
382 | |
---|
383 | # We need to first extract the ebuild file |
---|
384 | @ebuildfile = pb_extract_build_files($src,"$pbpkg-$pbver/pbconf/$ddir-$dver/","$ENV{'PBBUILDDIR'}/portage/pb/$pbpkg"); |
---|
385 | |
---|
386 | # Prepare the build env for gentoo |
---|
387 | my $found = 0; |
---|
388 | my $pbbd = $ENV{'PBBUILDDIR'}; |
---|
389 | $pbbd =~ s|/|\\/|g; |
---|
390 | open(MAKE,"/etc/make.conf") || die "Unable to open /etc/make.conf"; |
---|
391 | while (<MAKE>) { |
---|
392 | $found = 1 if (/$pbbd\/portage/); |
---|
393 | } |
---|
394 | close(MAKE); |
---|
395 | if ($found == 0) { |
---|
396 | pb_system("sudo \'echo \"$ENV{'PBBUILDDIR'}/portage\" >> /etc/make.conf\'"); |
---|
397 | } |
---|
398 | $found = 0; |
---|
399 | open(KEYW,"/etc/portage/package.keywords") || die "Unable to open /etc/portage/package.keywords"; |
---|
400 | while (<KEYW>) { |
---|
401 | $found = 1 if (/portage\/pb/); |
---|
402 | } |
---|
403 | close(KEYW); |
---|
404 | if ($found == 0) { |
---|
405 | pb_system("sudo \'echo \"portage/pb\" >> /etc/portage/package.keywords\'"); |
---|
406 | } |
---|
407 | |
---|
408 | # Build |
---|
409 | foreach my $f (@ebuildfile) { |
---|
410 | if ($f =~ /\.ebuild$/) { |
---|
411 | pb_system("ebuild $f digest ; ebuild $f package"); |
---|
412 | } |
---|
413 | } |
---|
414 | print $LOG "ebuild file: ".Dumper(\@ebuildfile)."\n" if ($debug >= 1); |
---|
415 | |
---|
416 | $made="$made portage/pb/$pbpkg/$pbpkg-$pbver.ebuild"; |
---|
417 | } elsif ($dtype eq "slackware") { |
---|
418 | $made="$made build-$pbpkg/$pbpkg-$pbver-*-$pbtag.tgz"; |
---|
419 | pb_mkdir_p("$ENV{'PBBUILDDIR'}/install") if (! -d "$ENV{'PBBUILDDIR'}/install"); |
---|
420 | } else { |
---|
421 | die "Unknown dtype format $dtype"; |
---|
422 | } |
---|
423 | } |
---|
424 | # Keep track of what is generated so that we can get them back from VMs |
---|
425 | open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag"; |
---|
426 | print KEEP "$made\n"; |
---|
427 | close(KEEP); |
---|
428 | } |
---|
429 | |
---|
430 | sub pb_build2ssh { |
---|
431 | pb_send2ssh("Sources"); |
---|
432 | } |
---|
433 | |
---|
434 | sub pb_pkg2ssh { |
---|
435 | pb_send2ssh("Packages"); |
---|
436 | } |
---|
437 | |
---|
438 | # By default deliver to the the public site hosting the |
---|
439 | # ftp structure (or whatever) or a VM |
---|
440 | sub pb_send2ssh { |
---|
441 | |
---|
442 | my $cmt = shift; |
---|
443 | my $vm = shift || undef; |
---|
444 | my $vmexist = shift || 0; # 0 is FALSE |
---|
445 | my $host = shift || "sshhost"; |
---|
446 | my $login = shift || "sshlogin"; |
---|
447 | my $dir = shift || "sshdir"; |
---|
448 | my $port = shift || "sshport"; |
---|
449 | my $cmd = ""; |
---|
450 | |
---|
451 | # Get list of packages to build |
---|
452 | my $ptr = pb_get_pkg($defpkgdir,$extpkgdir); |
---|
453 | @pkgs = @$ptr; |
---|
454 | |
---|
455 | # Get the running distro to consider |
---|
456 | my ($odir,$over) = (undef, undef); |
---|
457 | if (defined $vm) { |
---|
458 | ($odir,$over) = split(/_/,$vm); |
---|
459 | } |
---|
460 | my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init($odir,$over); |
---|
461 | print $LOG "DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n" if ($debug >= 1); |
---|
462 | |
---|
463 | # Get content saved in cms2build |
---|
464 | my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg"); |
---|
465 | $pkg = { } if (not defined $pkg); |
---|
466 | |
---|
467 | my $src = ""; |
---|
468 | chdir "$ENV{'PBBUILDDIR'}"; |
---|
469 | foreach my $pbpkg (@pkgs) { |
---|
470 | my $vertag = $pkg->{$pbpkg}; |
---|
471 | # get the version of the current package - maybe different |
---|
472 | ($pbver,$pbtag) = split(/-/,$vertag); |
---|
473 | |
---|
474 | if (($cmt eq "Sources") || ($cmt eq "VMs")) { |
---|
475 | $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz"; |
---|
476 | if ($cmd eq "") { |
---|
477 | $cmd = "ln -sf $pbpkg-$pbver.tar.gz $pbpkg-latest.tar.gz"; |
---|
478 | } else { |
---|
479 | $cmd = "$cmd ; ln -sf $pbpkg-$pbver.tar.gz $pbpkg-latest.tar.gz"; |
---|
480 | } |
---|
481 | } |
---|
482 | } |
---|
483 | if ($cmt eq "VMs") { |
---|
484 | $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb $ENV{'PBETC'}"; |
---|
485 | } elsif ($cmt eq "Script") { |
---|
486 | $src="$src $ENV{'PBDESTDIR'}/pbscript"; |
---|
487 | } elsif ($cmt eq "Packages") { |
---|
488 | # Get package list from file made during build2pkg |
---|
489 | open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag"; |
---|
490 | $src = <KEEP>; |
---|
491 | chomp($src); |
---|
492 | close(KEEP); |
---|
493 | if ($dtype eq "rpm") { |
---|
494 | # Also make a pbscript to generate yum/urpmi bases |
---|
495 | # $src = "$src $ENV{'PBDESTDIR'}/pbscript" |
---|
496 | } elsif ($dtype eq "deb") { |
---|
497 | # Also make a pbscript to generate apt bases |
---|
498 | # $src = "$src $ENV{'PBDESTDIR'}/pbscript" |
---|
499 | } |
---|
500 | } |
---|
501 | # Remove potential leading spaces (cause pb with basename) |
---|
502 | $src =~ s/^ *//; |
---|
503 | my $basesrc = ""; |
---|
504 | foreach my $i (split(/ +/,$src)) { |
---|
505 | $basesrc .= " ".basename($i); |
---|
506 | } |
---|
507 | |
---|
508 | print $LOG "Sources handled ($cmt): $src\n" if ($debug >= 0); |
---|
509 | my ($sshhost,$sshlogin,$sshdir,$sshport) = pb_conf_get($host,$login,$dir,$port); |
---|
510 | my $mac = "$sshlogin->{$ENV{'PBPROJ'}}\@$sshhost->{$ENV{'PBPROJ'}}"; |
---|
511 | # Overwrite account value if passed as parameter |
---|
512 | $mac = "$pbaccount\@$sshhost->{$ENV{'PBPROJ'}}" if (defined $pbaccount); |
---|
513 | $port = "$pbport" if (defined $pbport); |
---|
514 | my $tdir; |
---|
515 | my $bdir; |
---|
516 | if (($cmt eq "Sources") || ($cmt eq "Script")) { |
---|
517 | $tdir = "$sshdir->{$ENV{'PBPROJ'}}/src"; |
---|
518 | } elsif ($cmt eq "VMs") { |
---|
519 | $tdir = dirname("$sshdir->{$ENV{'PBPROJ'}}")."/delivery"; |
---|
520 | $bdir = dirname("$sshdir->{$ENV{'PBPROJ'}}")."/build"; |
---|
521 | # Remove a potential $ENV{'HOME'} as bdir should be relative to pb's home |
---|
522 | $bdir =~ s|\$ENV.+\}/||; |
---|
523 | } elsif ($cmt eq "Packages") { |
---|
524 | $tdir = "$sshdir->{$ENV{'PBPROJ'}}/$ddir/$dver"; |
---|
525 | } else { |
---|
526 | return; |
---|
527 | } |
---|
528 | # Remove a potential $ENV{'HOME'} as tdir should be relative to pb's home |
---|
529 | $tdir =~ s|\$ENV.+\}/||; |
---|
530 | |
---|
531 | $port = $sshport->{$ENV{'PBPROJ'}}; |
---|
532 | pb_system("ssh -q -p $port $mac \"mkdir -p $tdir ; cd $tdir ; echo \'for i in $basesrc; do if [ -f \$i ]; then rm -f \$i; fi; done\ ; $cmd' | bash\"","Preparing $tdir on $mac"); |
---|
533 | pb_system("cd $ENV{'PBBUILDDIR'} ; scp -p -P $port $src $mac:$tdir 2> /dev/null","$cmt delivery in $tdir on $mac"); |
---|
534 | pb_system("ssh -q -p $port $mac \"echo \'cd $tdir ; if [ -f pbscript ]; then ./pbscript; fi\' | bash\"","Executing pbscript on $mac if needed"); |
---|
535 | if ($cmt eq "VMs") { |
---|
536 | # Get back info on pkg produced, compute their name and get them from the VM |
---|
537 | pb_system("scp -p -P $port $mac:$bdir/pbgen-$pbprojver-$pbprojtag $ENV{'PBBUILDDIR'} 2> /dev/null","Get package names in $tdir on $mac"); |
---|
538 | open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag"; |
---|
539 | my $src = <KEEP>; |
---|
540 | chomp($src); |
---|
541 | close(KEEP); |
---|
542 | $src =~ s/^ *//; |
---|
543 | pb_mkdir_p("$ENV{'PBBUILDDIR'}/$odir/$over"); |
---|
544 | # Change pgben to make the next send2ssh happy |
---|
545 | my $made = ""; |
---|
546 | open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag"; |
---|
547 | foreach my $p (split(/ +/,$src)) { |
---|
548 | my $j = basename($p); |
---|
549 | pb_system("scp -p -P $port $mac:\'$bdir/$p\' $ENV{'PBBUILDDIR'}/$odir/$over 2> /dev/null","Package recovery of $j in $tdir from $mac"); |
---|
550 | $made="$made $odir/$over/$j" if (($dtype ne "rpm") || ($j !~ /.src.rpm$/)); |
---|
551 | } |
---|
552 | print KEEP "$made\n"; |
---|
553 | close(KEEP); |
---|
554 | pb_system("ssh -q -p $port $mac \"rm -rf $tdir\"","VM cleanup on $mac"); |
---|
555 | if (! $vmexist) { |
---|
556 | pb_system("ssh -q -p $port $mac \"sudo /usr/bin/poweroff \"; sleep 120 ; echo \'if [ -d /proc/$vmexist ]; then kill $vmexist; fi \' | bash ; sleep 10","VM halt on $mac"); |
---|
557 | } |
---|
558 | pb_send2ssh("Packages","$odir"."_"."$over"); |
---|
559 | pb_rm_rf("$ENV{'PBBUILDDIR'}/$odir"); |
---|
560 | } |
---|
561 | } |
---|
562 | |
---|
563 | sub pb_script2vm { |
---|
564 | my $pbscript=shift; |
---|
565 | |
---|
566 | # Prepare the script to be executed on the VM |
---|
567 | # in $ENV{'PBDESTDIR'}/pbscript |
---|
568 | if ((defined $pbscript ) && ($pbscript ne "$ENV{'PBDESTDIR'}/pbscript")) { |
---|
569 | copy($pbscript,"$ENV{'PBDESTDIR'}/pbscript") || die "Unable to create $ENV{'PBDESTDIR'}/pbscript"; |
---|
570 | chmod 0755,"$ENV{'PBDESTDIR'}/pbscript"; |
---|
571 | } |
---|
572 | |
---|
573 | my ($vm,$all) = pb_get_vm(); |
---|
574 | |
---|
575 | foreach my $v (@$vm) { |
---|
576 | # Launch the VM |
---|
577 | my $vmexist = pb_launchvm($v); |
---|
578 | if (! $vmexist) { |
---|
579 | pb_system("sleep 300","Waiting for it to come up"); |
---|
580 | } |
---|
581 | |
---|
582 | # Gather all required files to send them to the VM |
---|
583 | # and launch the build thourgh pbscript |
---|
584 | pb_send2ssh("Script","$v",$vmexist,"vmhost","vmlogin","pbrc","vmport"); |
---|
585 | |
---|
586 | } |
---|
587 | } |
---|
588 | |
---|
589 | sub pb_launchvm { |
---|
590 | my $vm = shift; |
---|
591 | |
---|
592 | die "No VM defined, unable to launch" if (not defined $vm); |
---|
593 | # Keep only the first VM in case many were given |
---|
594 | $vm =~ s/,.*//; |
---|
595 | |
---|
596 | # Launch the VMs |
---|
597 | my ($ptr,$vmopt,$vmport,$vmpath) = pb_conf_get("vmtype","vmopt","vmport","vmpath"); |
---|
598 | my $vmtype = $ptr->{$ENV{'PBPROJ'}}; |
---|
599 | if (defined $vmopt->{$ENV{'PBPROJ'}}) { |
---|
600 | $ENV{'PBVMOPT'} = $vmopt->{$ENV{'PBPROJ'}}; |
---|
601 | } else { |
---|
602 | $ENV{'PBVMOPT'} = ""; |
---|
603 | } |
---|
604 | $vmport->{$ENV{'PBPROJ'}} = "$pbport" if (defined $pbport); |
---|
605 | |
---|
606 | my $cmd; |
---|
607 | my $vmcmd; # has to be used for pb_check_ps |
---|
608 | my $vmm; # has to be used for pb_check_ps |
---|
609 | if ($vmtype eq "qemu") { |
---|
610 | my $arch = `uname -m`; |
---|
611 | chomp($arch); |
---|
612 | my $qemucmd32; |
---|
613 | my $qemucmd64; |
---|
614 | if ($arch eq "x86_64") { |
---|
615 | $qemucmd32 = "/usr/bin/qemu-system-i386"; |
---|
616 | $qemucmd64 = "/usr/bin/qemu"; |
---|
617 | } else { |
---|
618 | $qemucmd32 = "/usr/bin/qemu"; |
---|
619 | $qemucmd64 = "/usr/bin/qemu-system-x86_64"; |
---|
620 | } |
---|
621 | if ($vm =~ /_64/) { |
---|
622 | $vmcmd = "$qemucmd64 -no-kqemu"; |
---|
623 | } else { |
---|
624 | $vmcmd = "$qemucmd32"; |
---|
625 | } |
---|
626 | $vmm = "$vmpath->{$ENV{'PBPROJ'}}/$vm.qemu"; |
---|
627 | if (! -f "$vmm") { |
---|
628 | print "Unable to find VM $vmm"; |
---|
629 | return; |
---|
630 | } |
---|
631 | $cmd = "$vmcmd $ENV{'PBVMOPT'} -redir tcp:$vmport->{$ENV{'PBPROJ'}}:10.0.2.15:22 $vmm" |
---|
632 | } elsif ($vmtype eq "xen") { |
---|
633 | } elsif ($vmtype eq "vmware") { |
---|
634 | } else { |
---|
635 | die "VM of type $vmtype not supported. Report to the dev team"; |
---|
636 | } |
---|
637 | my $vmexist = pb_check_ps($vmcmd,$vmm); |
---|
638 | if (! $vmexist) { |
---|
639 | pb_system("$cmd &","Launching the VM"); |
---|
640 | } |
---|
641 | return($vmexist); |
---|
642 | } |
---|
643 | |
---|
644 | sub pb_build2vm { |
---|
645 | # Prepare the script to be executed on the VM |
---|
646 | # in $ENV{'PBDESTDIR'}/pbscript |
---|
647 | open(SCRIPT,"> $ENV{'PBDESTDIR'}/pbscript") || die "Unable to create $ENV{'PBDESTDIR'}/pbscript"; |
---|
648 | print SCRIPT "#!/bin/bash\n"; |
---|
649 | print SCRIPT "echo ... Execution needed\n"; |
---|
650 | print SCRIPT "# This is in directory delivery\n"; |
---|
651 | print SCRIPT "# Setup the variables required for building\n"; |
---|
652 | print SCRIPT "export PBPROJ=$ENV{'PBPROJ'}\n"; |
---|
653 | print SCRIPT "# Preparation for pb\n"; |
---|
654 | print SCRIPT "mkdir -p ../pbconf\n"; |
---|
655 | print SCRIPT "mv $ENV{'PBPROJ'}.pb ../pbconf\n"; |
---|
656 | print SCRIPT "mv .pbrc \$HOME\n"; |
---|
657 | print SCRIPT "cd ..\n"; |
---|
658 | print SCRIPT "export PBROOT=\`pwd\`\n"; |
---|
659 | print SCRIPT "# Build\n"; |
---|
660 | my $p = ""; |
---|
661 | $p = $ARGV[0] if (defined $ARGV[0]); |
---|
662 | print SCRIPT "echo Building packages on VM...\n"; |
---|
663 | print SCRIPT "pb -p $ENV{'PBPROJ'} build2pkg $p\n"; |
---|
664 | close(SCRIPT); |
---|
665 | chmod 0755,"$ENV{'PBDESTDIR'}/pbscript"; |
---|
666 | |
---|
667 | my ($vm,$all) = pb_get_vm(); |
---|
668 | |
---|
669 | # Send tar files when we do a global generation |
---|
670 | pb_build2ssh() if ($all == 1); |
---|
671 | |
---|
672 | foreach my $v (@$vm) { |
---|
673 | # Launch the VM |
---|
674 | my $vmexist = pb_launchvm($v); |
---|
675 | if (! $vmexist) { |
---|
676 | pb_system("sleep 300","Waiting for it to come up"); |
---|
677 | } |
---|
678 | |
---|
679 | # Gather all required files to send them to the VM |
---|
680 | # and launch the build thourgh pbscript |
---|
681 | pb_send2ssh("VMs","$v",$vmexist,"vmhost","vmlogin","pbrc","vmport"); |
---|
682 | } |
---|
683 | } |
---|
684 | |
---|
685 | sub pb_get_pkg { |
---|
686 | |
---|
687 | my @pkgs; |
---|
688 | my $defpkgdir = shift; |
---|
689 | my $extpkgdir = shift; |
---|
690 | |
---|
691 | # Get packages list |
---|
692 | if (not defined $ARGV[0]) { |
---|
693 | @pkgs = keys %$defpkgdir; |
---|
694 | } elsif ($ARGV[0] =~ /^all$/) { |
---|
695 | @pkgs = keys %$defpkgdir; |
---|
696 | push(@pkgs, keys %$extpkgdir); |
---|
697 | } else { |
---|
698 | @pkgs = @ARGV; |
---|
699 | } |
---|
700 | print $LOG "Packages: ".join(',',@pkgs)."\n" if ($debug >= 0); |
---|
701 | return(\@pkgs); |
---|
702 | } |
---|
703 | |
---|
704 | # |
---|
705 | # Return the list of VMs we are working on |
---|
706 | # $all is a flag to know if we return all of them |
---|
707 | # or only some (if all we publish also tar files in addition to pkgs |
---|
708 | # |
---|
709 | sub pb_get_vm { |
---|
710 | |
---|
711 | my @vm; |
---|
712 | my $all = 0; |
---|
713 | |
---|
714 | # Get VM list |
---|
715 | if ((not defined $ENV{'PBVM'}) || ($ENV{'PBVM'} =~ /^all$/)) { |
---|
716 | my ($ptr) = pb_conf_get("vmlist"); |
---|
717 | $ENV{'PBVM'} = $ptr->{$ENV{'PBPROJ'}}; |
---|
718 | $all = 1; |
---|
719 | } |
---|
720 | @vm = split(/,/,$ENV{'PBVM'}); |
---|
721 | print $LOG "VMs: ".join(',',@vm)."\n"; |
---|
722 | return(\@vm,$all); |
---|
723 | } |
---|
724 | |
---|
725 | # Returns the pid of a running VM command using a specific VM file |
---|
726 | sub pb_check_ps { |
---|
727 | my $vmcmd = shift; |
---|
728 | my $vmm = shift; |
---|
729 | my $vmexist = 0; # FALSE by default |
---|
730 | |
---|
731 | open(PS, "ps auxhww|") || die "Unable to call ps"; |
---|
732 | while (<PS>) { |
---|
733 | next if (! /$vmcmd/); |
---|
734 | next if (! /$vmm/); |
---|
735 | my ($void1, $void2); |
---|
736 | ($void1, $vmexist, $void2) = split(/ +/); |
---|
737 | last; |
---|
738 | } |
---|
739 | return($vmexist); |
---|
740 | } |
---|
741 | |
---|
742 | |
---|
743 | sub pb_extract_build_files { |
---|
744 | |
---|
745 | my $src=shift; |
---|
746 | my $dir=shift; |
---|
747 | my $ddir=shift; |
---|
748 | my @files; |
---|
749 | |
---|
750 | if ($src =~ /tar\.gz$/) { |
---|
751 | pb_system("tar xfpz $src $dir","Extracting build files"); |
---|
752 | } elsif ($src =~ /tar\.bz2$/) { |
---|
753 | pb_system("tar xfpj $src $dir","Extracting build files"); |
---|
754 | } else { |
---|
755 | die "Unknown compression algorithm for $src"; |
---|
756 | } |
---|
757 | opendir(DIR,"$dir") || die "Unable to open directory $dir"; |
---|
758 | foreach my $f (readdir(DIR)) { |
---|
759 | next if ($f =~ /^\./); |
---|
760 | move("$dir/$f","$ddir") || die "Unable to move $dir/$f to $ddir"; |
---|
761 | print $LOG "mv $dir/$f $ddir\n" if ($debug >= 1); |
---|
762 | push @files,"$ddir/$f"; |
---|
763 | } |
---|
764 | closedir(DIR); |
---|
765 | # Not enough but still a first cleanup |
---|
766 | pb_rm_rf("$dir"); |
---|
767 | return(@files); |
---|
768 | } |
---|
769 | |
---|
770 | sub pb_syntax { |
---|
771 | |
---|
772 | print "pb (aka project-builder) Version $projectbuilderver-$projectbuilderrev\n"; |
---|
773 | print "\n"; |
---|
774 | print "Syntax: pb [-vhqt][-r pbroot][-p project][[-s script -a account -P port] -m \"mach-1[,...]\"] <action> [<pkg1>...]\n"; |
---|
775 | print "\n"; |
---|
776 | print "-h : This help file\n"; |
---|
777 | print "-q : Quiet mode\n"; |
---|
778 | print "-t : Test mode (not done yet)\n"; |
---|
779 | print "-v : Verbose mode\n"; |
---|
780 | print "\n"; |
---|
781 | print "-m machine : Name of the Virtual Machines (VM) you want\n"; |
---|
782 | print " to build on (coma separated). All if none precised\n"; |
---|
783 | print " (or use the env variable PBVM) \n"; |
---|
784 | print "\n"; |
---|
785 | print "-s script : Name of the script you want\n"; |
---|
786 | print " to execute on the related VMs.\n"; |
---|
787 | print "\n"; |
---|
788 | print "-a account : Name of the account to use\n"; |
---|
789 | print " to connect on the related VMs.\n"; |
---|
790 | print "\n"; |
---|
791 | print "-p project : Name of the project you're working on\n"; |
---|
792 | print " (or use the env variable PBPROJ) \n"; |
---|
793 | print "\n"; |
---|
794 | print "-r pbroot : Path Name of project under the CMS \n"; |
---|
795 | print " (or use the env variable PBROOT) \n"; |
---|
796 | print "\n"; |
---|
797 | print "<action> can be:\n"; |
---|
798 | print "\n"; |
---|
799 | print "\tcms2build: Create tar files for the project under your CMS\n"; |
---|
800 | print "\t CMS supported are SVN and CVS\n"; |
---|
801 | print "\t parameters are packages to build\n"; |
---|
802 | print "\t if not using default list\n"; |
---|
803 | print "\n"; |
---|
804 | print "\tbuild2pkg: Create packages for your running distribution \n"; |
---|
805 | print "\n"; |
---|
806 | print "\tcms2pkg: cms2build + build2pkg\n"; |
---|
807 | print "\n"; |
---|
808 | print "\tbuild2ssh: Send the tar files to a SSH host \n"; |
---|
809 | print "\n"; |
---|
810 | print "\tpkg2ssh: Send the packages built to a SSH host \n"; |
---|
811 | print "\n"; |
---|
812 | print "\tbuild2vm: Create packages in VMs, launching them if needed\n"; |
---|
813 | print "\t and send those packages to a SSH host once built\n"; |
---|
814 | print "\t VM type supported are QEMU \n"; |
---|
815 | print "\n"; |
---|
816 | print "\tcms2vm: cms2build + build2vm\n"; |
---|
817 | print "\n"; |
---|
818 | print "\tlaunchvm: Launch one virtual machine\n"; |
---|
819 | print "\n"; |
---|
820 | print "\tscript2vm: Launch one virtual machine if needed \n"; |
---|
821 | print "\t and executes a script on it \n"; |
---|
822 | print "\n"; |
---|
823 | } |
---|