Changeset 132 for devel/pb/bin/pb


Ignore:
Timestamp:
Sep 11, 2007, 12:55:17 AM (12 years ago)
Author:
bruno
Message:

Lots of small fixes for vm management.
pb is able now to lauch correctly script on the VM and build packages.
Still working on result backup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r131 r132  
    405405    }
    406406    if ($cmt eq "VMs") {
    407         $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb $ENV{'PBETC'}";
     407        $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb $ENV{'PBETC'}";
    408408    } elsif ($cmt eq "Packages") {
    409409        # Get package list from file made during build2pkg
     
    420420        }
    421421    }
     422    # Remove potential leading spaces (cause pb with basename)
     423    $src =~ s/^ *//;
    422424    my $basesrc = "";
    423425    foreach my $i (split(/ +/,$src)) {
     
    433435    } elsif ($cmt eq "VMs") {
    434436        $tdir = dirname("$sshdir->{$ENV{'PBPROJ'}}");
    435         # Expand a potential $ENV{'HOME'}
    436         eval { $tdir =~ s/(\$ENV.+\})/$1/eeg };
    437437    } elsif ($cmt eq "Packages") {
    438438        $tdir = "$sshdir->{$ENV{'PBPROJ'}}/$ddir/$dver";
     
    440440        return;
    441441    }
     442    # Remove a potential $ENV{'HOME'} as tdir shold be relative to pb's home
     443    $tdir =~ s|\$ENV.+\}/||;
     444
    442445    $port = $sshport->{$ENV{'PBPROJ'}};
    443     pb_system("ssh -q -p $port $mac \"mkdir -p $tdir ; cd $tdir ; rm -f $basesrc\"","Preparing $tdir on $mac");
    444     pb_system("scp -p -P $port $src $mac:$tdir","$cmt delivery in $tdir on $mac");
    445     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");
     446    pb_system("ssh -q -p $port $mac \"mkdir -p $tdir/delivery ; cd $tdir/delivery ; rm -f $basesrc\"","Preparing $tdir on $mac");
     447    pb_system("scp -p -P $port $src $mac:$tdir/delivery","$cmt delivery in $tdir on $mac");
     448    pb_system("ssh -q -p $port $mac \"echo \'cd $tdir/delivery ; if [ -f pbscript ]; then ./pbscript; fi\' | bash\"","Executing pbscript on $mac  if needed");
    446449    if ($cmt eq "VMs") {
    447450        # Get back info on pkg produced, compute their name and get them from the VM
    448         pb_system("scp -p -P $port $mac:$tdir/pbgen-$pbprojver-$pbprojtag $ENV{'PBBUILDDIR'}","Get package names in $tdir on $mac");
     451        pb_system("scp -p -P $port $mac:$tdir/delivery/pbgen-$pbprojver-$pbprojtag $ENV{'PBBUILDDIR'}","Get package names in $tdir on $mac");
    449452        open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";
    450453        my $src = <KEEP>;
     
    452455        close(KEEP);
    453456        $src =~ s/^ *//;
    454         $src =~ s/ +/,/;
    455         pb_system("scp -p -P $port $mac:$tdir/{$src} $ENV{'PBBUILDDIR'}/$odir/$over","Package recovery of in $tdir from $mac");
     457        $src =~ s/ +/,/g;
     458        pb_system("scp -p -P $port $mac:$tdir/delivery/{$src} $ENV{'PBBUILDDIR'}/$odir/$over","Package recovery of in $tdir from $mac");
     459        #pb_system("ssh -q -p $port $mac \"rm -rf $tdir ; sido /usr/bin/poweroff\"","VM cleanup and halt on $mac");
    456460        pb_send2ssh("Packages","$odir"."_"."$over");
    457         pb_rm_rf($ENV{'PBBUILDDIR'}/$odir);
     461        pb_rm_rf("$ENV{'PBBUILDDIR'}/$odir");
    458462    }
    459463}
     
    467471    print SCRIPT "#!/bin/bash\n";
    468472    print SCRIPT "echo ... Execution needed\n";
    469     print SCRIPT "# Move the copied .pbrc to the home dir on the build account\n";
    470     print SCRIPT "mv .pbrc \$HOME\n";
     473    print SCRIPT "# This is in directory delivery\n";
    471474    print SCRIPT "# Setup the variables required for building\n";
    472475    print SCRIPT "export PBPROJ=$ENV{'PBPROJ'}\n";
     476    print SCRIPT "# Preparation for pb\n";
     477    print SCRIPT "mkdir -p ../pbconf\n";
     478    print SCRIPT "mv $ENV{'PBPROJ'}.pb ../pbconf\n";
     479    print SCRIPT "mv .pbrc \$HOME\n";
     480    print SCRIPT "cd ..\n";
    473481    print SCRIPT "export PBROOT=\`pwd\`\n";
    474482    print SCRIPT "# Build\n";
    475483    my $p = "";
    476484    $p = $ARGV[0] if (defined $ARGV[0]);
    477     print SCRIPT "echo Building packages on $vm\n";
     485    print SCRIPT "echo Building packages on VM...\n";
    478486    print SCRIPT "pb build2pkg $p\n";
    479     print SCRIPT "echo End of build. Halting VM.\n";
    480     print SCRIPT "sudo halt -p\n";
    481487    close(SCRIPT);
    482488    chmod 0755,"$ENV{'PBDESTDIR'}/pbscript";
Note: See TracChangeset for help on using the changeset viewer.