source: ProjectBuilder/devel/pb/bin/pb@ 315

Last change on this file since 315 was 315, checked in by Bruno Cornec, 16 years ago

Backup of local dev. cms2pkg compiles but doesn't work and even remove the SVN :-(
pb_log added

  • Property svn:executable set to *
File size: 34.5 KB
Line 
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
12use strict 'vars';
13use Getopt::Std;
14use Data::Dumper;
15use English;
16use File::Basename;
17use File::Copy;
18use Time::localtime qw(localtime);
19use POSIX qw(strftime);
20
21# Global variables
22use lib qw (lib);
23use ProjectBuilder::Distribution qw (pb_distro_init);
24use ProjectBuilder::Version qw (pb_version_init);
25use 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_filter_file_inplace pb_cms_export pb_cms_log pb_cms_isdiff pb_cms_copy pb_cms_checkout pb_get_date pb_log pb_log_init);
26
27my %opts; # CLI Options
28my $action; # action to realize
29my $test = "FALSE";
30my $option = "";
31my @pkgs;
32my $pbtag; # Global Tag variable
33my $pbver; # Global Version variable
34my $pbscript; # Name of the script
35my %pbver; # per package
36my %pbtag; # per package
37my $pbrev; # Global REVISION variable
38my @date=pb_get_date();
39my $pbdate = strftime("%Y-%m-%d", @date);
40my $debug = 0;
41my $pbaccount; # Login to use to connect to the VM
42my $pbport; # Port to use to connect to the VM
43my $newver; # New version to create
44my $iso; # ISO iage for the VM to create
45my $LOG = \*STDOUT;
46
47getopts('a:hi:l:m:P:p:qr:s:tvV:',\%opts);
48
49my ($projectbuilderver,$projectbuilderrev) = pb_version_init();
50if (defined $opts{'h'}) {
51 pb_syntax();
52 exit(0);
53}
54if (defined $opts{'v'}) {
55 $debug++;
56}
57if (defined $opts{'q'}) {
58 $debug=-1;
59}
60if (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 }
65pb_log_init($debug, $LOG);
66
67# Handles test option
68if (defined $opts{'t'}) {
69 $test = "TRUE";
70 # Works only for SVN
71 $option = "-r BASE";
72}
73
74# Handle root of the project if defined
75if (defined $opts{'r'}) {
76 $ENV{'PBROOT'} = $opts{'r'};
77}
78# Handle virtual machines if any
79if (defined $opts{'m'}) {
80 $ENV{'PBVM'} = $opts{'m'};
81}
82if (defined $opts{'s'}) {
83 $pbscript = $opts{'s'};
84}
85if (defined $opts{'a'}) {
86 $pbaccount = $opts{'a'};
87}
88if (defined $opts{'P'}) {
89 $pbport = $opts{'P'};
90}
91if (defined $opts{'V'}) {
92 $newver = $opts{'V'};
93}
94if (defined $opts{'i'}) {
95 $iso = $opts{'i'};
96}
97
98# Get Action
99$action = shift @ARGV;
100die pb_syntax() if (not defined $action);
101
102my ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir);
103my $pbinit = undef;
104$pbinit = 1 if ($action =~ /^newproj$/);
105
106# Handles project name if any
107# And get global params
108if (defined $opts{'p'}) {
109 ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir)
110 = pb_env_init($opts{'p'},$pbinit);
111} else {
112 ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir)
113 = pb_env_init(undef,$pbinit);
114}
115
116pb_log(0,"Project: $ENV{'PBPROJ'}\n");
117pb_log(0,"Action: $action\n");
118
119# Keep those project values to store them at the end each time
120my $pbprojtag = $ENV{'PBTAG'};
121my $pbprojver = $ENV{'PBVER'};
122
123# Act depending on action
124if ($action =~ /^cms2build$/) {
125 pb_cms2build();
126} elsif ($action =~ /^build2pkg$/) {
127 pb_build2pkg();
128} elsif ($action =~ /^cms2pkg$/) {
129 pb_cms2build();
130 pb_build2pkg();
131} elsif ($action =~ /^build2ssh$/) {
132 pb_build2ssh();
133} elsif ($action =~ /^cms2ssh$/) {
134 pb_cms2build();
135 pb_build2ssh();
136} elsif ($action =~ /^pkg2ssh$/) {
137 pb_pkg2ssh();
138} elsif ($action =~ /^build2vm$/) {
139 pb_build2vm();
140} elsif ($action =~ /^cms2vm$/) {
141 pb_cms2build();
142 pb_build2vm();
143} elsif ($action =~ /^launchvm$/) {
144 pb_launchvm($ENV{'PBVM'},0);
145} elsif ($action =~ /^script2vm$/) {
146 pb_script2vm($pbscript);
147} elsif ($action =~ /^newver$/) {
148 pb_newver();
149} elsif ($action =~ /^newchroot$/) {
150 pb_launchchroot($ENV{'PBCHROOT'},1);
151} elsif ($action =~ /^newvm$/) {
152 pb_launchvm($ENV{'PBVM'},1);
153} elsif ($action =~ /^newproj$/) {
154 # Nothing to do - already done in pb_env_init
155} elsif ($action =~ /^clean$/) {
156} else {
157 pb_log(0,"\'$action\' is not available\n");
158 pb_syntax();
159}
160
161sub pb_cms2build {
162
163 my $ptr = pb_get_pkg($defpkgdir,$extpkgdir);
164 @pkgs = @$ptr;
165 my ($scheme,$uri)=pb_cms_init($ENV{'PBPROJ'});
166
167 my ($pkgv, $pkgt) = pb_conf_get_if("pkgver","pkgtag");
168
169 # declare packager for filtering
170 my ($tmp) = pb_conf_get("packager");
171 my $pbpackager = $tmp->{$ENV{'PBPROJ'}};
172
173 foreach my $pbpkg (@pkgs) {
174 $ENV{'PBPKG'} = $pbpkg;
175 $ENV{'PBVER'} = $pbprojver;
176 $ENV{'PBTAG'} = $pbprojtag;
177 if ((defined $pkgv) && (defined $pkgv->{$pbpkg})) {
178 $pbver = $pkgv->{$pbpkg};
179 $ENV{'PBVER'} = $pbver;
180 } else {
181 $pbver = $ENV{'PBVER'};
182 }
183 if ((defined $pkgt) && (defined $pkgt->{$pbpkg})) {
184 $pbtag = $pkgt->{$pbpkg};
185 $ENV{'PBTAG'} = $pbtag;
186 } else {
187 $pbtag = $ENV{'PBTAG'};
188 }
189
190 $pbrev = $ENV{'PBREVISION'};
191 pb_log(2,"\n");
192 pb_log(2,"Management of $pbpkg $pbver-$pbtag (rev $pbrev)\n");
193 die "Unable to get env var PBDESTDIR" if (not defined $ENV{'PBDESTDIR'});
194 # Clean up dest if necessary. The export will recreate it
195 my $dest = "$ENV{'PBDESTDIR'}/$pbpkg-$pbver";
196 pb_rm_rf($dest) if (-d $dest);
197
198 # Export CMS tree for the concerned package to dest
199 # And generate some additional files
200 $OUTPUT_AUTOFLUSH=1;
201
202 # computes in which dir we have to work
203 my $dir = $defpkgdir->{$pbpkg};
204 $dir = $extpkgdir->{$pbpkg} if (not defined $dir);
205 pb_log(2,"def:".Dumper($defpkgdir)." ext: ".Dumper($extpkgdir)." \n");
206
207 # If it isn't a flat CMS, then we have the choice to export subdir
208 $dir = "$uri/$dir" if ($ENV{'PBREVISION'} ne "flat");
209 pb_cms_export($scheme,"$dir",$dest);
210
211 # Get project info on authors and log file
212 my $chglog = "$ENV{'PBCONF'}/$pbpkg/pbcl";
213 $chglog = "$ENV{'PBCONF'}/pbcl" if (! -f $chglog);
214 $chglog = undef if (! -f $chglog);
215
216 my $authors = "$ENV{'PBCONF'}/$pbpkg/pbauthors";
217 $authors = "$ENV{'PBCONF'}/pbauthors" if (! -f $authors);
218 $authors = "/dev/null" if (! -f $authors);
219
220 # Extract cms log history and store it
221 if ((defined $chglog) && (! -f "$dest/NEWS")) {
222 pb_log(2,"Generating NEWS file from $chglog\n");
223 copy($chglog,"$dest/NEWS") || die "Unable to create $dest/NEWS";
224 }
225 pb_cms_log($scheme,$dir,$dest,$chglog,$authors);
226
227 my %build;
228
229 my ($ptr) = pb_conf_get_if("vmlist","chrootlist");
230 foreach my $d (split(/,/,$ptr->{$ENV{'PBPROJ'}})) {
231 my ($name,$ver,$arch) = split(/-/,$d);
232 chomp($arch);
233 my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init($name,$ver);
234 pb_log(2,"DEBUG: distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf)."\n");
235 pb_log(2,"DEBUG Filtering PBDATE => $pbdate, PBTAG => $pbtag, PBVER => $pbver\n");
236
237 # Filter build files from the less precise up to the most with overloading
238 # Filter all files found, keeping the name, and generating in dest
239
240 # Find all build files first relatively to PBROOT
241 # Find also all specific files referenced in the .pb conf file
242 my %bfiles = {};
243 my %pkgfiles = {};
244 pb_log(2,"DEBUG dir: $ENV{'PBCONF'}/$pbpkg\n");
245 $build{"$ddir-$dver"} = "yes";
246
247 if (-d "$ENV{'PBROOT'}/$pbpkg/$dtype") {
248 pb_list_bfiles("$ENV{'PBROOT'}/$pbpkg/$dtype",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);
249 } elsif (-d "$ENV{'PBROOT'}/$pbpkg/$dfam") {
250 pb_list_bfiles("$ENV{'PBROOT'}/$pbpkg/$dfam",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);
251 } elsif (-d "$ENV{'PBROOT'}/$pbpkg/$ddir") {
252 pb_list_bfiles("$ENV{'PBROOT'}/$pbpkg/$ddir",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);
253 } elsif (-d "$ENV{'PBROOT'}/$pbpkg/$ddir-$dver") {
254 pb_list_bfiles("$ENV{'PBROOT'}/$pbpkg/$ddir-$dver",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);
255 } else {
256 $build{"$ddir-$dver"} = "no";
257 next;
258 }
259 pb_log(2,"DEBUG bfiles: ".Dumper(\%bfiles)."\n");
260
261 # Get all filters to apply
262 my $ptr = pb_get_filters($pbpkg, $dtype, $dfam, $ddir, $dver);
263
264 # Apply now all the filters on all the files concerned
265 # destination dir depends on the type of file
266 if (defined $ptr) {
267 foreach my $f (values %bfiles,values %pkgfiles) {
268 pb_filter_file_pb("$ENV{'PBROOT'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$pbpackager,$chglog);
269 }
270 }
271 }
272 my @found;
273 my @notfound;
274 foreach my $b (keys %build) {
275 push @found,$b if ($build{$b} =~ /yes/);
276 push @notfound,$b if ($build{$b} =~ /no/);
277 }
278 pb_log(0,"Build files generated for ".join(',',@found)."\n");
279 pb_log(0,"No Build files found for ".join(',',@notfound)."\n") if (@notfound);
280 # Get the generic filter (all.pbf) and
281 # apply those to the non-build files including those
282 # generated by pbinit if applicable
283
284 # Get only all.pbf filter
285 $ptr = pb_get_filters($pbpkg);
286
287 my $liste ="";
288 if (defined $filteredfiles->{$pbpkg}) {
289 foreach my $f (split(/,/,$filteredfiles->{$pbpkg})) {
290 pb_filter_file_inplace($ptr,"$dest/$f",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$pbpackager);
291 $liste = "$f $liste";
292 }
293 }
294 pb_log(2,"Files ".$liste."have been filtered\n");
295
296 # Prepare the dest directory for archive
297 if (-x "$ENV{'PBROOT'}/$pbpkg/pbinit") {
298 pb_filter_file("$ENV{'PBROOT'}/$pbpkg/pbinit",$ptr,"$ENV{'PBTMP'}/pbinit",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$pbpackager);
299 chmod 0755,"$ENV{'PBTMP'}/pbinit";
300 pb_system("cd $dest ; $ENV{'PBTMP'}/pbinit","Executing init script from $ENV{'PBROOT'}/$pbpkg/pbinit");
301 }
302
303 # Archive dest dir
304 chdir "$ENV{'PBDESTDIR'}" || die "Unable to change dir to $ENV{'PBDESTDIR'}";
305 # Possibility to look at PBSRC to guess more the filename
306 pb_system("tar cfz $pbpkg-$pbver.tar.gz $pbpkg-$pbver","Creating $pbpkg tar files compressed");
307 pb_log(2,"Under $ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz\n");
308
309 # Keep track of what is generated by default
310 open(LAST,"> $ENV{'PBDESTDIR'}/pbrc") || die "Unable to create $ENV{'PBDESTDIR'}/pbrc";
311 #print LAST "pbroot $pbprojver-$pbprojtag = $ENV{'PBROOT'}\n";
312 # Why not use pbproj ?
313 print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOT'}\n";
314 close(LAST);
315
316 # Keep track of per package version
317 my ($pkg) = pb_conf_read_if("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
318 $pkg = { } if (not defined $pkg);
319 if ((not defined $pkg->{$pbpkg}) || ($pkg->{$pbpkg} ne "$pbver-$pbtag")) {
320 $pkg->{$pbpkg} = "$pbver-$pbtag";
321 }
322
323 pb_log(2,"DEBUG pkg: ".Dumper($pkg)."\n");
324 open(PKG,"> $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb";
325 foreach my $p (keys %$pkg) {
326 print PKG "pbpkg $p = $pkg->{$p}\n";
327 }
328 close(PKG);
329
330 # Final cleanup
331 pb_rm_rf($dest) if (-d $dest);
332 }
333}
334
335sub pb_build2pkg {
336
337 # Get list of packages to build
338 my $ptr = pb_get_pkg($defpkgdir,$extpkgdir);
339 @pkgs = @$ptr;
340
341 # Get the running distro to build on
342 my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init();
343 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n");
344
345 # Get content saved in cms2build
346 my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
347 $pkg = { } if (not defined $pkg);
348
349 # declare packager
350 my ($tmp) = pb_conf_get("packager");
351 my $pbpackager = $tmp->{$ENV{'PBPROJ'}};
352
353 chdir "$ENV{'PBBUILDDIR'}";
354 my $made = ""; # pkgs made during build
355 foreach my $pbpkg (@pkgs) {
356 my $vertag = $pkg->{$pbpkg};
357 # get the version of the current package - maybe different
358 ($pbver,$pbtag) = split(/-/,$vertag);
359
360 my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz";
361 pb_log(2,"Source file: $src\n");
362
363 pb_log(2,"Working directory: $ENV{'PBBUILDDIR'}\n");
364 if ($dtype eq "rpm") {
365 foreach my $d ('RPMS','SRPMS','SPECS','SOURCES','BUILD') {
366 if (! -d "$ENV{'PBBUILDDIR'}/$d") {
367 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";
368 }
369 }
370
371 # Remove in case a previous link/file was there
372 unlink "$ENV{'PBBUILDDIR'}/SOURCES/".basename($src);
373 symlink "$src","$ENV{'PBBUILDDIR'}/SOURCES/".basename($src) || die "Unable to symlink $src in $ENV{'PBBUILDDIR'}/SOURCES";
374 # We need to first extract the spec file
375 my @specfile;
376 @specfile = pb_extract_build_files($src,"$pbpkg-$pbver/pbconf/$ddir-$dver/","$ENV{'PBBUILDDIR'}/SPECS");
377
378 pb_log(2,"specfile: ".Dumper(\@specfile)."\n");
379 # set LANGUAGE to check for correct log messages
380 $ENV{'LANGUAGE'}="C";
381 foreach my $f (@specfile) {
382 if ($f =~ /\.spec$/) {
383 pb_system("rpmbuild --define \'packager $pbpackager\' --define \"_topdir $ENV{'PBBUILDDIR'}\" -ba $f","Building package with $f under $ENV{'PBBUILDDIR'}");
384 last;
385 }
386 }
387 $made="$made RPMS/*/$pbpkg-$pbver-$pbtag$pbsuf.*.rpm SRPMS/$pbpkg-$pbver-$pbtag$pbsuf.src.rpm";
388 if (-f "/usr/bin/rpmlint") {
389 pb_system("rpmlint $made","Checking validity of rpms with rpmlint");
390 }
391 } elsif ($dtype eq "deb") {
392 chdir "$ENV{'PBBUILDDIR'}" || die "Unable to chdir to $ENV{'PBBUILDDIR'}";
393 pb_system("tar xfz $src","Extracting sources");
394
395 chdir "$pbpkg-$pbver" || die "Unable to chdir to $pbpkg-$pbver";
396 pb_rm_rf("debian");
397 symlink "pbconf/$ddir-$dver","debian" || die "Unable to symlink to pbconf/$ddir-$dver";
398 chmod 0755,"debian/rules";
399 pb_system("dpkg-buildpackage -us -uc -rfakeroot","Building package");
400 $made="$made $pbpkg"."_*.deb $pbpkg"."_*.dsc $pbpkg"."_*.tar.gz";
401 if (-f "/usr/bin/lintian") {
402 pb_system("lintian $made","Checking validity of debs with lintian");
403 }
404 } elsif ($dtype eq "ebuild") {
405 my @ebuildfile;
406 # For gentoo we need to take pb as subsystem name
407 # We put every apps here under sys-apps. hope it's correct
408 # We use pb's home dir in order o have a single OVERLAY line
409 my $tmpd = "$ENV{'HOME'}/portage/pb/sys-apps/$pbpkg";
410 pb_mkdir_p($tmpd) if (! -d "$tmpd");
411 pb_mkdir_p("$ENV{'HOME'}/portage/distfiles") if (! -d "$ENV{'HOME'}/portage/distfiles");
412
413 # We need to first extract the ebuild file
414 @ebuildfile = pb_extract_build_files($src,"$pbpkg-$pbver/pbconf/$ddir-$dver/","$tmpd");
415
416 # Prepare the build env for gentoo
417 my $found = 0;
418 my $pbbd = $ENV{'HOME'};
419 $pbbd =~ s|/|\\/|g;
420 if (-r "/etc/make.conf") {
421 open(MAKE,"/etc/make.conf");
422 while (<MAKE>) {
423 $found = 1 if (/$pbbd\/portage/);
424 }
425 close(MAKE);
426 }
427 if ($found == 0) {
428 pb_system("sudo sh -c 'echo PORTDIR_OVERLAY=\"$ENV{'HOME'}/portage\" >> /etc/make.conf'");
429 }
430 #$found = 0;
431 #if (-r "/etc/portage/package.keywords") {
432 #open(KEYW,"/etc/portage/package.keywords");
433 #while (<KEYW>) {
434 #$found = 1 if (/portage\/pb/);
435 #}
436 #close(KEYW);
437 #}
438 #if ($found == 0) {
439 #pb_system("sudo sh -c \"echo portage/pb >> /etc/portage/package.keywords\"");
440 #}
441
442 # Build
443 foreach my $f (@ebuildfile) {
444 if ($f =~ /\.ebuild$/) {
445 move($f,"$tmpd/$pbpkg-$pbver.ebuild");
446 pb_system("cd $tmpd ; ebuild $pbpkg-$pbver.ebuild clean ; ebuild $pbpkg-$pbver.ebuild digest ; ebuild $pbpkg-$pbver.ebuild package");
447 # Now move it where pb expects it
448 pb_mkdir_p("$ENV{'PBBUILDDIR'}/portage/pb/sys-apps/$pbpkg");
449 move("$tmpd/$pbpkg-$pbver.ebuild","$ENV{'PBBUILDDIR'}/portage/pb/sys-apps/$pbpkg");
450 }
451 }
452
453 $made="$made portage/pb/sys-apps/$pbpkg/$pbpkg-$pbver.ebuild";
454 } elsif ($dtype eq "slackware") {
455 $made="$made build-$pbpkg/$pbpkg-$pbver-*-$pbtag.tgz";
456 pb_mkdir_p("$ENV{'PBBUILDDIR'}/install") if (! -d "$ENV{'PBBUILDDIR'}/install");
457 } else {
458 die "Unknown dtype format $dtype";
459 }
460 }
461 # Keep track of what is generated so that we can get them back from VMs
462 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";
463 print KEEP "$made\n";
464 close(KEEP);
465}
466
467sub pb_build2ssh {
468 pb_send2ssh("Sources");
469}
470
471sub pb_pkg2ssh {
472 pb_send2ssh("Packages");
473}
474
475# By default deliver to the the public site hosting the
476# ftp structure (or whatever) or a VM
477sub pb_send2ssh {
478
479 my $cmt = shift;
480 my $vm = shift || undef;
481 my $vmexist = shift || 0; # 0 is FALSE
482 my $vmpid = shift || 0; # 0 is FALSE
483 my $host = shift || "sshhost";
484 my $login = shift || "sshlogin";
485 my $dir = shift || "sshdir";
486 my $port = shift || "sshport";
487 my $tmout = shift || "vmtmout";
488 my $cmd = "";
489
490 # Get list of packages to build
491 my $ptr = pb_get_pkg($defpkgdir,$extpkgdir);
492 @pkgs = @$ptr;
493
494 # Get the running distro to consider
495 my ($odir,$over) = (undef, undef);
496 if (defined $vm) {
497 ($odir,$over) = split(/_/,$vm);
498 }
499 my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init($odir,$over);
500 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n");
501
502 # Get content saved in cms2build
503 my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
504 $pkg = { } if (not defined $pkg);
505
506 my $src = "";
507 chdir "$ENV{'PBBUILDDIR'}";
508 foreach my $pbpkg (@pkgs) {
509 my $vertag = $pkg->{$pbpkg};
510 # get the version of the current package - maybe different
511 ($pbver,$pbtag) = split(/-/,$vertag);
512
513 if (($cmt eq "Sources") || ($cmt eq "VMs")) {
514 $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz";
515 if ($cmd eq "") {
516 $cmd = "ln -sf $pbpkg-$pbver.tar.gz $pbpkg-latest.tar.gz";
517 } else {
518 $cmd = "$cmd ; ln -sf $pbpkg-$pbver.tar.gz $pbpkg-latest.tar.gz";
519 }
520 }
521 }
522 if ($cmt eq "VMs") {
523 $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb $ENV{'PBETC'}";
524 } elsif ($cmt eq "Script") {
525 $src="$src $ENV{'PBDESTDIR'}/pbscript";
526 } elsif ($cmt eq "Packages") {
527 # Get package list from file made during build2pkg
528 open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";
529 $src = <KEEP>;
530 chomp($src);
531 close(KEEP);
532 if ($dtype eq "rpm") {
533 # Also make a pbscript to generate yum/urpmi bases
534 # $src = "$src $ENV{'PBDESTDIR'}/pbscript"
535 } elsif ($dtype eq "deb") {
536 # Also make a pbscript to generate apt bases
537 # $src = "$src $ENV{'PBDESTDIR'}/pbscript"
538 }
539 }
540 # Remove potential leading spaces (cause pb with basename)
541 $src =~ s/^ *//;
542 my $basesrc = "";
543 foreach my $i (split(/ +/,$src)) {
544 $basesrc .= " ".basename($i);
545 }
546
547 pb_log(2,"Sources handled ($cmt): $src\n");
548 my ($sshhost,$sshlogin,$sshdir,$sshport,$vmtmout,$testver) = pb_conf_get($host,$login,$dir,$port,$tmout,"testver");
549 my $mac = "$sshlogin->{$ENV{'PBPROJ'}}\@$sshhost->{$ENV{'PBPROJ'}}";
550 # Overwrite account value if passed as parameter
551 $mac = "$pbaccount\@$sshhost->{$ENV{'PBPROJ'}}" if (defined $pbaccount);
552 my $tdir;
553 my $bdir;
554 if (($cmt eq "Sources") || ($cmt eq "Script")) {
555 $tdir = "$sshdir->{$ENV{'PBPROJ'}}/src";
556 } elsif ($cmt eq "VMs") {
557 $tdir = dirname("$sshdir->{$ENV{'PBPROJ'}}")."/delivery";
558 $bdir = dirname("$sshdir->{$ENV{'PBPROJ'}}")."/build";
559 # Remove a potential $ENV{'HOME'} as bdir should be relative to pb's home
560 $bdir =~ s|\$ENV.+\}/||;
561 } elsif ($cmt eq "Packages") {
562 $tdir = "$sshdir->{$ENV{'PBPROJ'}}/$ddir/$dver";
563 if ((defined $testver->{$ENV{'PBPROJ'}}) && ($testver->{$ENV{'PBPROJ'}} eq "true")) {
564 # This is a test pkg => target dir is under test
565 $tdir .= "/test";
566 }
567 } else {
568 return;
569 }
570 my $nport = $sshport->{$ENV{'PBPROJ'}};
571 $nport = "$pbport" if (defined $pbport);
572
573 # Remove a potential $ENV{'HOME'} as tdir should be relative to pb's home
574 $tdir =~ s|\$ENV.+\}/||;
575
576 my $tm = $vmtmout->{$ENV{'PBPROJ'}};
577 pb_system("ssh -q -p $nport $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");
578 pb_system("cd $ENV{'PBBUILDDIR'} ; scp -p -P $nport $src $mac:$tdir 2> /dev/null","$cmt delivery in $tdir on $mac");
579 pb_system("ssh -q -p $nport $mac \"echo \'cd $tdir ; if [ -f pbscript ]; then ./pbscript; fi\' | bash\"","Executing pbscript on $mac if needed");
580 if ($cmt eq "VMs") {
581 # Get back info on pkg produced, compute their name and get them from the VM
582 pb_system("scp -p -P $nport $mac:$bdir/pbgen-$pbprojver-$pbprojtag $ENV{'PBBUILDDIR'} 2> /dev/null","Get package names in $bdir on $mac");
583 open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";
584 my $src = <KEEP>;
585 chomp($src);
586 close(KEEP);
587 $src =~ s/^ *//;
588 pb_mkdir_p("$ENV{'PBBUILDDIR'}/$odir/$over");
589 # Change pgben to make the next send2ssh happy
590 my $made = "";
591 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";
592 foreach my $p (split(/ +/,$src)) {
593 my $j = basename($p);
594 pb_system("scp -p -P $nport $mac:\'$bdir/$p\' $ENV{'PBBUILDDIR'}/$odir/$over 2> /dev/null","Package recovery of $j in $bdir from $mac");
595 $made="$made $odir/$over/$j" if (($dtype ne "rpm") || ($j !~ /.src.rpm$/));
596 }
597 print KEEP "$made\n";
598 close(KEEP);
599 pb_system("ssh -q -p $nport $mac \"rm -rf $tdir $bdir\"","VM cleanup on $mac");
600 pb_send2ssh("Packages","$odir"."_"."$over");
601 if (! $vmexist) {
602 pb_system("ssh -q -p $nport $mac \"sudo /sbin/halt -p \"; sleep $tm ; echo \'if [ -d /proc/$vmpid ]; then kill -9 $vmpid; fi \' | bash ; sleep 10","VM $vm halt (pid $vmpid)");
603 }
604 pb_rm_rf("$ENV{'PBBUILDDIR'}/$odir");
605 }
606}
607
608sub pb_script2vm {
609 my $pbscript=shift;
610
611 # Prepare the script to be executed on the VM
612 # in $ENV{'PBDESTDIR'}/pbscript
613 if ((defined $pbscript ) && ($pbscript ne "$ENV{'PBDESTDIR'}/pbscript")) {
614 copy($pbscript,"$ENV{'PBDESTDIR'}/pbscript") || die "Unable to create $ENV{'PBDESTDIR'}/pbscript";
615 chmod 0755,"$ENV{'PBDESTDIR'}/pbscript";
616 }
617
618 my ($vm,$all) = pb_get_vm();
619
620 foreach my $v (@$vm) {
621 # Launch the VM
622 my ($vmexist,$vmpid) = pb_launchvm($v,0);
623
624 # Skip that VM if it something went wrong
625 next if (($vmpid == 0) && ($vmexist ==0));
626
627 # Gather all required files to send them to the VM
628 # and launch the build thourgh pbscript
629 pb_send2ssh("Script","$v",$vmexist,$vmpid,"vmhost","vmlogin","$ENV{'PBDESTDIR'}/pbrc","vmport","vmtmout");
630
631 }
632}
633
634sub pb_launchchroot {
635 # Virtual env.
636 my $ve = shift;
637 my $create = shift || 0; # By default do not create a chroot
638
639 #die "-i iso parameter needed" if (((not defined $iso) || ($iso eq "")) && ($create != 0));
640 #die "No VM defined, unable to launch" if (not defined $ve);
641
642 # Keep only the first chroot in case many were given
643 $ve =~ s/,.*//;
644
645 # Launch the chroot
646 my ($ptr,$veopt,$veport,$vepath,$vetmout,$vesize) = pb_conf_get("vetype","veopt","veport","vepath","vetmout","vesize");
647 my $vetype = $ptr->{$ENV{'PBPROJ'}};
648 if (not defined $ENV{'PBCHROOTOPT'}) {
649 $ENV{'PBCHROOTOPT'} = "";
650 }
651 if (defined $veopt->{$ENV{'PBPROJ'}}) {
652 $ENV{'PBVMOPT'} .= " $veopt->{$ENV{'PBPROJ'}}" if ($ENV{'PBVMOPT'} !~ / $veopt->{$ENV{'PBPROJ'}}/);
653 }
654 my $nport = $veport->{$ENV{'PBPROJ'}};
655 $nport = "$pbport" if (defined $pbport);
656
657 my $cmd;
658 my $vecmd; # has to be used for pb_check_ps
659 my $vem; # has to be used for pb_check_ps
660 if ($vetype eq "qemu") {
661 my $arch = `uname -m`;
662 chomp($arch);
663 my $qemucmd32;
664 my $qemucmd64;
665 if ($arch eq "x86_64") {
666 $qemucmd32 = "/usr/bin/qemu-system-i386";
667 $qemucmd64 = "/usr/bin/qemu";
668 } else {
669 $qemucmd32 = "/usr/bin/qemu";
670 $qemucmd64 = "/usr/bin/qemu-system-x86_64";
671 }
672 if ($ve =~ /_64/) {
673 $vecmd = "$qemucmd64 -no-kqemu";
674 } else {
675 $vecmd = "$qemucmd32";
676 }
677 $vem = "$vepath->{$ENV{'PBPROJ'}}/$ve.qemu";
678 if ($create != 0) {
679 $ENV{'PBVMOPT'} .= " -cdrom $iso -boot d";
680 }
681 $cmd = "$vecmd $ENV{'PBVMOPT'} -redir tcp:$nport:10.0.2.15:22 $vem"
682 } elsif ($vetype eq "xen") {
683 } elsif ($vetype eq "vmware") {
684 } else {
685 die "VM of type $vetype not supported. Report to the dev team";
686 }
687 my ($tmpcmd,$void) = split(/ +/,$cmd);
688 my $veexist = pb_check_ps($tmpcmd,$vem);
689 my $vepid = 0;
690 if (! $veexist) {
691 if ($create != 0) {
692 pb_system("/usr/bin/qemu-img create -f qcow2 $vem $vesize->{$ENV{'PBPROJ'}}","Creating the QEMU VM");
693 }
694 if (! -f "$vem") {
695 pb_log(0,"Unable to find VM $vem\n");
696 } else {
697 pb_system("$cmd &","Launching the VM $vem");
698 pb_system("sleep $vetmout->{$ENV{'PBPROJ'}}","Waiting for VM $ve to come up");
699 $vepid = pb_check_ps($tmpcmd,$vem);
700 }
701 } else {
702 pb_log(0,"Found an existing VM $vem (pid $veexist)\n");
703 }
704 return($veexist,$vepid);
705}
706
707sub pb_launchvm {
708 my $vm = shift;
709 my $create = shift || 0; # By default do not create a VM
710
711 die "-i iso parameter needed" if (((not defined $iso) || ($iso eq "")) && ($create != 0));
712 die "No VM defined, unable to launch" if (not defined $vm);
713 # Keep only the first VM in case many were given
714 $vm =~ s/,.*//;
715
716 # Launch the VMs
717 my ($ptr,$vmopt,$vmport,$vmpath,$vmtmout,$vmsize) = pb_conf_get("vmtype","vmopt","vmport","vmpath","vmtmout","vmsize");
718 my $vmtype = $ptr->{$ENV{'PBPROJ'}};
719 if (not defined $ENV{'PBVMOPT'}) {
720 $ENV{'PBVMOPT'} = "";
721 }
722 if (defined $vmopt->{$ENV{'PBPROJ'}}) {
723 $ENV{'PBVMOPT'} .= " $vmopt->{$ENV{'PBPROJ'}}" if ($ENV{'PBVMOPT'} !~ / $vmopt->{$ENV{'PBPROJ'}}/);
724 }
725 my $nport = $vmport->{$ENV{'PBPROJ'}};
726 $nport = "$pbport" if (defined $pbport);
727
728 my $cmd;
729 my $vmcmd; # has to be used for pb_check_ps
730 my $vmm; # has to be used for pb_check_ps
731 if ($vmtype eq "qemu") {
732 my $arch = `uname -m`;
733 chomp($arch);
734 my $qemucmd32;
735 my $qemucmd64;
736 if ($arch eq "x86_64") {
737 $qemucmd32 = "/usr/bin/qemu-system-i386";
738 $qemucmd64 = "/usr/bin/qemu";
739 } else {
740 $qemucmd32 = "/usr/bin/qemu";
741 $qemucmd64 = "/usr/bin/qemu-system-x86_64";
742 }
743 if ($vm =~ /_64/) {
744 $vmcmd = "$qemucmd64 -no-kqemu";
745 } else {
746 $vmcmd = "$qemucmd32";
747 }
748 $vmm = "$vmpath->{$ENV{'PBPROJ'}}/$vm.qemu";
749 if ($create != 0) {
750 $ENV{'PBVMOPT'} .= " -cdrom $iso -boot d";
751 }
752 $cmd = "$vmcmd $ENV{'PBVMOPT'} -redir tcp:$nport:10.0.2.15:22 $vmm"
753 } elsif ($vmtype eq "xen") {
754 } elsif ($vmtype eq "vmware") {
755 } else {
756 die "VM of type $vmtype not supported. Report to the dev team";
757 }
758 my ($tmpcmd,$void) = split(/ +/,$cmd);
759 my $vmexist = pb_check_ps($tmpcmd,$vmm);
760 my $vmpid = 0;
761 if (! $vmexist) {
762 if ($create != 0) {
763 if (($vmtype eq "qemu") || ($vmtype eq "xen")) {
764 pb_system("/usr/bin/qemu-img create -f qcow2 $vmm $vmsize->{$ENV{'PBPROJ'}}","Creating the QEMU VM");
765 } elsif ($vmtype eq "vmware") {
766 } else {
767 }
768 }
769 if (! -f "$vmm") {
770 pb_log(0,"Unable to find VM $vmm\n");
771 } else {
772 pb_system("$cmd &","Launching the VM $vmm");
773 pb_system("sleep $vmtmout->{$ENV{'PBPROJ'}}","Waiting for VM $vm to come up");
774 $vmpid = pb_check_ps($tmpcmd,$vmm);
775 }
776 } else {
777 pb_log(0,"Found an existing VM $vmm (pid $vmexist)\n");
778 }
779 return($vmexist,$vmpid);
780}
781
782sub pb_build2vm {
783 # Prepare the script to be executed on the VM
784 # in $ENV{'PBDESTDIR'}/pbscript
785 my ($ntp) = pb_conf_get("vmntp");
786 my $vmntp = $ntp->{$ENV{'PBPROJ'}};
787 open(SCRIPT,"> $ENV{'PBDESTDIR'}/pbscript") || die "Unable to create $ENV{'PBDESTDIR'}/pbscript";
788 print SCRIPT "#!/bin/bash\n";
789 print SCRIPT "echo ... Execution needed\n";
790 print SCRIPT "# This is in directory delivery\n";
791 print SCRIPT "# Setup the variables required for building\n";
792 print SCRIPT "export PBPROJ=$ENV{'PBPROJ'}\n";
793 print SCRIPT "# Preparation for pb\n";
794 print SCRIPT "mkdir -p ../pbconf\n";
795 print SCRIPT "mv $ENV{'PBPROJ'}.pb ../pbconf\n";
796 print SCRIPT "mv .pbrc \$HOME\n";
797 print SCRIPT "cd ..\n";
798 # Force new date to be in the future compared to the date of the tar file by adding 1 minute
799 my @date=(localtime->sec(), localtime->min(), localtime->hour(), localtime->mday(), localtime->mon(), localtime->year(), localtime->wday(), localtime->yday(), localtime->isdst());
800 $date[1]++;
801 my $upddate = strftime("%m%d%H%M%Y", @date);
802 print SCRIPT "echo Setting up date on $vmntp...\n";
803 # Or use ntpdate if available
804 print SCRIPT "sudo date $upddate\n";
805 print SCRIPT "export PBROOT=\`pwd\`\n";
806 print SCRIPT "# Build\n";
807 my $p = "";
808 $p = join(' ',@ARGV) if (defined $ARGV[0]);
809 print SCRIPT "echo Building packages on VM...\n";
810 print SCRIPT "pb -p $ENV{'PBPROJ'} build2pkg $p\n";
811 close(SCRIPT);
812 chmod 0755,"$ENV{'PBDESTDIR'}/pbscript";
813
814 my ($vm,$all) = pb_get_vm();
815
816 # Send tar files when we do a global generation
817 pb_build2ssh() if ($all == 1);
818
819 foreach my $v (@$vm) {
820 # Launch the VM
821 my ($vmexist,$vmpid) = pb_launchvm($v,0);
822
823 # Skip that VM if it something went wrong
824 next if (($vmpid == 0) && ($vmexist == 0));
825
826 # Gather all required files to send them to the VM
827 # and launch the build thourgh pbscript
828 pb_send2ssh("VMs","$v",$vmexist,$vmpid,"vmhost","vmlogin","$ENV{'PBDESTDIR'}/pbrc","vmport","vmtmout");
829 }
830}
831
832
833sub pb_newver {
834
835 die "-V Version parameter needed" if ((not defined $newver) || ($newver eq ""));
836 my $scheme=pb_cms_init($ENV{'PBPROJ'});
837 if ($scheme ne "svn") {
838 die "Only SVN is supported at the moment";
839 }
840 my $res = pb_cms_isdiff($scheme);
841 die "You need to have no differences before creating a new version" if ($res != 0);
842 my $cmsurl = pb_cms_getinfo($scheme,$ENV{'PBROOT'},"URL:");
843 my $newurl = dirname($cmsurl)."/$newver";
844 pb_cms_copy($scheme,$cmsurl,$newurl);
845 pb_cms_checkout($scheme,$newurl,"$ENV{'PBROOT'}/../$newver");
846 my $oldver=basename($cmsurl);
847 open(FILE,"$ENV{'PBROOT'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb") || die "Unable to open $ENV{'PBROOT'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb";
848 open(OUT,"> $ENV{'PBROOT'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb.new") || die "Unable to write to $ENV{'PBROOT'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb.new";
849 while(<FILE>) {
850 s/projver\s+$ENV{'PBPROJ'}\s*=\s*$oldver/projver $ENV{'PBPROJ'} = $newver/;
851 print OUT $_;
852 }
853 close(FILE);
854 close(OUT);
855 rename("$ENV{'PBROOT'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb.new","$ENV{'PBROOT'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb");
856 pb_cms_checkin($scheme,"$ENV{'PBROOT'}/../$newver");
857}
858
859#
860# Return the list of packages we are working on
861#
862sub pb_get_pkg {
863
864my @pkgs;
865my $defpkgdir = shift;
866my $extpkgdir = shift;
867
868# Get packages list
869if (not defined $ARGV[0]) {
870 @pkgs = keys %$defpkgdir;
871} elsif ($ARGV[0] =~ /^all$/) {
872 @pkgs = keys %$defpkgdir;
873 push(@pkgs, keys %$extpkgdir);
874} else {
875 @pkgs = @ARGV;
876}
877pb_log(2,"Packages: ".join(',',@pkgs)."\n");
878return(\@pkgs);
879}
880
881#
882# Return the list of VMs we are working on
883# $all is a flag to know if we return all of them
884# or only some (if all we publish also tar files in addition to pkgs
885#
886sub pb_get_vm {
887
888my @vm;
889my $all = 0;
890
891# Get VM list
892if ((not defined $ENV{'PBVM'}) || ($ENV{'PBVM'} =~ /^all$/)) {
893 my ($ptr) = pb_conf_get("vmlist");
894 my $ptr2 = $ptr->{$ENV{'PBPROJ'}};
895 $ptr2 =~ s/,/_64,/g;
896 $ptr2 =~ s/$/_64/g;
897 $ENV{'PBVM'} = "$ptr->{$ENV{'PBPROJ'}},$ptr2";
898 $all = 1;
899}
900pb_log(2,"VMs: $ENV{'PBVM'}\n");
901@vm = split(/,/,$ENV{'PBVM'});
902return(\@vm,$all);
903}
904
905# Returns the pid of a running VM command using a specific VM file
906sub pb_check_ps {
907 my $vmcmd = shift;
908 my $vmm = shift;
909 my $vmexist = 0; # FALSE by default
910
911 open(PS, "ps auxhww|") || die "Unable to call ps";
912 while (<PS>) {
913 next if (! /$vmcmd/);
914 next if (! /$vmm/);
915 my ($void1, $void2);
916 ($void1, $vmexist, $void2) = split(/ +/);
917 last;
918 }
919 return($vmexist);
920}
921
922
923sub pb_extract_build_files {
924
925my $src=shift;
926my $dir=shift;
927my $ddir=shift;
928my @files;
929
930if ($src =~ /tar\.gz$/) {
931 pb_system("tar xfpz $src $dir","Extracting build files");
932} elsif ($src =~ /tar\.bz2$/) {
933 pb_system("tar xfpj $src $dir","Extracting build files");
934} else {
935 die "Unknown compression algorithm for $src";
936}
937opendir(DIR,"$dir") || die "Unable to open directory $dir";
938foreach my $f (readdir(DIR)) {
939 next if ($f =~ /^\./);
940 move("$dir/$f","$ddir") || die "Unable to move $dir/$f to $ddir";
941 pb_log(2,"mv $dir/$f $ddir\n");
942 push @files,"$ddir/$f";
943}
944closedir(DIR);
945# Not enough but still a first cleanup
946pb_rm_rf("$dir");
947return(@files);
948}
949
950sub pb_list_bfiles {
951
952my $dir = shift;
953my $pbpkg = shift;
954my $bfiles = shift;
955my $pkgfiles = shift;
956my $supfiles = shift;
957
958opendir(BDIR,"$dir") || die "Unable to open dir $dir: $!";
959foreach my $f (readdir(BDIR)) {
960 next if ($f =~ /^\./);
961 $bfiles->{$f} = "$dir/$f";
962 $bfiles->{$f} =~ s~$ENV{'PBROOT'}~~;
963 if (defined $supfiles->{$pbpkg}) {
964 $pkgfiles->{$f} = "$dir/$f" if ($f =~ /$supfiles->{$pbpkg}/);
965 }
966}
967closedir(BDIR);
968}
969
970sub pb_syntax {
971
972 print "pb (aka project-builder) Version $projectbuilderver-$projectbuilderrev\n";
973 print "\n";
974 print "Syntax: pb [-vhqt][-r pbroot][-p project][[-s script -a account -P port] -m \"mach-1[,...]\"][-i iso] <action> [<pkg1> ...]\n";
975 print "\n";
976 print "-h: This help file\n";
977 print "-q: Quiet mode\n";
978 print "-t: Test mode (not done yet)\n";
979 print "-v: Verbose mode\n";
980 print "\n";
981 print "-m machine: Name of the Virtual Machines (VM) you want\n";
982 print " to build on (coma separated). All if none precised\n";
983 print " (or use the env variable PBVM) \n";
984 print "\n";
985 print "-s script: Name of the script you want\n";
986 print " to execute on the related VMs.\n";
987 print "\n";
988 print "-i iso: Name of the ISO image of the distribution you want\n";
989 print " to install on the related VMs.\n";
990 print "\n";
991 print "-a account: Name of the account to use\n";
992 print " to connect on the related VMs.\n";
993 print "\n";
994 print "-P port: Port number to use\n";
995 print " to connect on the related VMs.\n";
996 print "\n";
997 print "-p project: Name of the project you're working on\n";
998 print " (or use the env variable PBPROJ) \n";
999 print "\n";
1000 print "-r pbroot: Path Name of project under the CMS \n";
1001 print " (or use the env variable PBROOT) \n";
1002 print "\n";
1003 print "-V newver: New version of the project to create\n";
1004 print " from the current one. \n";
1005 print "\n";
1006 print "<action> can be:\n";
1007 print "\n";
1008 print "\tcms2build: Create tar files for the project under your CMS\n";
1009 print "\t CMS supported are SVN and CVS\n";
1010 print "\t parameters are packages to build\n";
1011 print "\t if not using default list\n";
1012 print "\n";
1013 print "\tbuild2pkg: Create packages for your running distribution \n";
1014 print "\n";
1015 print "\tcms2pkg: cms2build + build2pkg\n";
1016 print "\n";
1017 print "\tbuild2ssh: Send the tar files to a SSH host \n";
1018 print "\n";
1019 print "\tcms2ssh: cms2build + build2ssh\n";
1020 print "\n";
1021 print "\tpkg2ssh: Send the packages built to a SSH host \n";
1022 print "\n";
1023 print "\tbuild2vm: Create packages in VMs, launching them if needed\n";
1024 print "\t and send those packages to a SSH host once built\n";
1025 print "\t VM type supported are QEMU \n";
1026 print "\n";
1027 print "\tbuild2chroot: Create packages in a chroot, creating it if needed\n";
1028 print "\t and send those packages to a SSH host once built\n";
1029 print "\n";
1030 print "\tcms2vm: cms2build + build2vm\n";
1031 print "\n";
1032 print "\tlaunchvm: Launch one virtual machine\n";
1033 print "\n";
1034 print "\tscript2vm: Launch one virtual machine if needed \n";
1035 print "\t and executes a script on it \n";
1036 print "\n";
1037 print "\tnewvm: Create a new virtual machine\n";
1038 print "\n";
1039 print "\tnewchroot: Create a new chroot environment\n";
1040 print "\n";
1041 print "\tnewver: Create a new version of the project derived \n";
1042 print "\t from the current one \n";
1043 print "\n";
1044 print "\tnewproj: Create a new project and a template set of \n";
1045 print "\t configuration files under pbconf \n";
1046 print "\n";
1047}
Note: See TracBrowser for help on using the repository browser.