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

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

Attempt to solve gentoo generation with sudo and pb_system

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