source: devel/pb/bin/pb @ 262

Revision 262, 30.6 KB checked in by bruno, 6 years ago (diff)

Fix bug #7 where .pbrc nearly empty wasn't working

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