Changeset 127 in ProjectBuilder for devel


Ignore:
Timestamp:
Sep 10, 2007, 10:48:42 AM (17 years ago)
Author:
Bruno Cornec
Message:

Work on build2vm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r126 r127  
    346346            pb_mkdir_p("$ENV{'PBBUILDDIR'}/portage") if (! -d "$ENV{'PBBUILDDIR'}/portage");
    347347        } elsif ($dtype eq "slackware") {
     348            $made="$made $ENV{'PBBUILDDIR'}/build-$pbpkg/$pbpkg-$pbver-*-$pbtag.tgz";
    348349            pb_mkdir_p("$ENV{'PBBUILDDIR'}/install") if (! -d "$ENV{'PBBUILDDIR'}/install");
    349             $made="$made $ENV{'PBBUILDDIR'}/build-$pbpkg/$pbpkg-$pbver-*-$pbtag.tgz";
    350350        } else {
    351351            die "Unknown dtype format $dtype";
     
    466466    print SCRIPT "export PBROOT=\`pwd\`\n";
    467467    print SCRIPT "# Build\n";
    468     print SCRIPT "pb build2pkg $ARGV[0]\n";
     468    my $p = "";
     469    $p = $ARGV[0] if (defined $ARGV[0]);
     470    print SCRIPT "pb build2pkg $p\n";
     471    print SCRIPT "sudo halt -p\n";
    469472    close(SCRIPT);
    470473    chmod 0755,"$ENV{'PBDESTDIR'}/pbscript";
     
    475478    foreach my $v (@$vm) {
    476479        # Launch the VMs
     480        my ($ptr) = pb_conf_get("vmtype");
     481        my $vmtype = $ptr->{$ENV{'PBPROJ'}};
     482        my ($vmopt,$vmport,$vmpath) = pb_conf_read("$ENV{'PBETC'}","vmopt","vmport","vmpath");
     483        $vmopt->{$vmtype} = $vmopt->{'default'} if ((not defined $vmopt->{$vmtype}) and (defined $vmopt->{'default'}));
     484        $vmport->{$vmtype} = $vmport->{'default'} if ((not defined $vmport->{$vmtype}) and (defined $vmport->{'default'}));
     485        $vmpath->{$vmtype} = $vmpath->{'default'} if ((not defined $vmpath->{$vmtype}) and (defined $vmpath->{'default'}));
     486        if (defined $vmopt->{$vmtype}) {
     487            $ENV{'PBVMOPT'} = $vmopt->{$vmtype};
     488        } else {
     489            $ENV{'PBVMOPT'} = "";
     490        }
     491
     492        my $cmd;
     493        if ($vmtype eq "qemu") {
     494            my $arch = `uname -m`;
     495            chomp($arch);
     496            my $qemucmd;
     497            my $qemucmd32;
     498            my $qemucmd64;
     499            if ($arch eq "x86_64") {
     500                $qemucmd32 = "/usr/bin/qemu-system-i386";
     501                $qemucmd64 = "/usr/bin/qemu";
     502            } else {
     503                $qemucmd32 = "/usr/bin/qemu";
     504                $qemucmd64 = "/usr/bin/qemu-system-x86_64";
     505            }
     506            if ($v =~ /_64/) {
     507                $qemucmd = "$qemucmd64 -no-kqemu";
     508            } else {
     509                $qemucmd = "$qemucmd32";
     510            }
     511            if (! -f "$vmpath->{$vmtype}/$v.qemu") {
     512                print "Unable to find VM $vmpath->{$vmtype}/$v.qemu";
     513                next;
     514            }
     515            $cmd = "$qemucmd $ENV{'PBVMOPT'} -redir tcp:$vmport->{$vmtype}:10.0.2.15:22 $vmpath->{$vmtype}/$v.qemu"
     516        } elsif ($vmtype eq "xen") {
     517        } elsif ($vmtype eq "vmware") {
     518        } else {
     519            die "VM of type $vmtype not supported. Report to the dev team";
     520        }
     521        pb_system("$cmd &","Launching the VM");
     522        pb_system("sleep 300","Waiting for it to come up");
    477523
    478524        # Gather all required files to send them to the VM and launch the build thourgh pbscript
Note: See TracChangeset for help on using the changeset viewer.