source: 0.8.13/pb/bin/pb @ 336

Revision 336, 33.3 KB checked in by bruno, 5 years ago (diff)

Fix a bug on testver usage (now take in account the content of the value)

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