Changeset 128


Ignore:
Timestamp:
Sep 10, 2007, 12:16:45 PM (13 years ago)
Author:
Bruno Cornec
Message:

More fixes in the vm part

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r127 r128  
    422422    my $basesrc = map { basename($_) } split(/ /,$src);
    423423
    424     print $LOG "$cmt: $src\n" if ($debug >= 0);
     424    print $LOG "Sources handled ($cmt): $src\n" if ($debug >= 0);
    425425    my ($sshhost,$sshlogin,$sshdir,$sshport) = pb_conf_get($host,$login,$dir,$port);
    426426    my $mac = "$sshlogin->{$ENV{'PBPROJ'}}\@$sshhost->{$ENV{'PBPROJ'}}";
     
    429429        $tdir = "$sshdir->{$ENV{'PBPROJ'}}/src";
    430430    } elsif ($cmt eq "VMs") {
    431         $tdir = "$sshdir->{$ENV{'PBPROJ'}}";
     431        $tdir = basename("$sshdir->{$ENV{'PBPROJ'}}");
    432432    } elsif ($cmt eq "Packages") {
    433433        $tdir = "$sshdir->{$ENV{'PBPROJ'}}/$ddir/$dver";
     
    440440    pb_system("ssh -q -p $port $mac \"echo \'cd $tdir ; if [ -f pbscript ]; then ./pbscript; rm -f ./pbscript; fi\' | bash\"","Executing pbscript on $mac  if needed");
    441441    if ($cmt eq "VMs") {
    442             # Get back info on pkg produced, compute their name and get them from the VM
     442        # Get back info on pkg produced, compute their name and get them from the VM
    443443        pb_system("scp -p -P $port $mac:$tdir/pbgen-$pbprojver$pbprojtag $ENV{'PBBUILDDIR'}","Get package names in $tdir on $mac");
    444444        open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$pbprojver$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver$pbprojtag";
     
    461461    print SCRIPT "echo ... Execution needed\n";
    462462    print SCRIPT "# Move the copied .pbrc to the home dir on the build account\n";
    463     print SCRIPT "mv .pbrc \$ENV{'HOME'}\n";
     463    print SCRIPT "mv .pbrc \$HOME\n";
    464464    print SCRIPT "# Setup the variables required for building\n";
    465465    print SCRIPT "export PBPROJ=$ENV{'PBPROJ'}\n";
     
    468468    my $p = "";
    469469    $p = $ARGV[0] if (defined $ARGV[0]);
     470    print SCRIPT "echo Building packages on $vm\n";
    470471    print SCRIPT "pb build2pkg $p\n";
     472    print SCRIPT "echo End of build. Halting VM.\n";
    471473    print SCRIPT "sudo halt -p\n";
    472474    close(SCRIPT);
     
    478480    foreach my $v (@$vm) {
    479481        # Launch the VMs
    480         my ($ptr) = pb_conf_get("vmtype");
     482        my ($ptr,$vmopt,$vmport,$vmpath) = pb_conf_get("vmtype","vmopt","vmport","vmpath");
    481483        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};
     484        if (defined $vmopt->{$ENV{'PBPROJ'}}) {
     485            $ENV{'PBVMOPT'} = $vmopt->{$ENV{'PBPROJ'}};
    488486        } else {
    489487            $ENV{'PBVMOPT'} = "";
     
    509507                $qemucmd = "$qemucmd32";
    510508            }
    511             if (! -f "$vmpath->{$vmtype}/$v.qemu") {
    512                 print "Unable to find VM $vmpath->{$vmtype}/$v.qemu";
     509            if (! -f "$vmpath->{$ENV{'PBPROJ'}}/$v.qemu") {
     510                print "Unable to find VM $vmpath->{$ENV{'PBPROJ'}}/$v.qemu";
    513511                next;
    514512            }
    515             $cmd = "$qemucmd $ENV{'PBVMOPT'} -redir tcp:$vmport->{$vmtype}:10.0.2.15:22 $vmpath->{$vmtype}/$v.qemu"
     513            $cmd = "$qemucmd $ENV{'PBVMOPT'} -redir tcp:$vmport->{$ENV{'PBPROJ'}}:10.0.2.15:22 $vmpath->{$ENV{'PBPROJ'}}/$v.qemu"
    516514        } elsif ($vmtype eq "xen") {
    517515        } elsif ($vmtype eq "vmware") {
     
    523521
    524522        # Gather all required files to send them to the VM and launch the build thourgh pbscript
    525         pb_send2ssh("VMs","$v","vmhost","vmlogin",dirname($pbrc->{$ENV{'PBPROJ'}}),"vmport");
     523        pb_send2ssh("VMs","$v","vmhost","vmlogin","pbrc","vmport");
    526524    }
    527525}
Note: See TracChangeset for help on using the changeset viewer.