Changeset 199


Ignore:
Timestamp:
Oct 12, 2007, 2:02:02 AM (12 years ago)
Author:
bruno
Message:

Handles newver (begining of skeleton)
improve VM stop + messages

Location:
devel/pb
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r194 r199  
    4343my $pbaccount;              # Login to use to connect to the VM
    4444my $pbport;                 # Port to use to connect to the VM
     45my $newver;                 # New version to create
    4546my $LOG = \*STDOUT;
    4647
    47 getopts('a:hl:m:P:p:qr:s:tv',\%opts);
     48getopts('a:hl:m:P:p:qr:s:tvV:',\%opts);
    4849
    4950my ($projectbuilderver,$projectbuilderrev) = pb_version_init();
     
    8687if (defined $opts{'P'}) {
    8788    $pbport = $opts{'P'};
     89}
     90if (defined $opts{'V'}) {
     91    $newver = $opts{'V'};
    8892}
    8993
     
    132136} elsif ($action =~ /^script2vm$/) {
    133137    pb_script2vm($pbscript);
     138} elsif ($action =~ /^newver$/) {
     139    pb_newver();
    134140} elsif ($action =~ /^clean$/) {
    135141} else {
     
    374380            chdir "$pbpkg-$pbver" || die "Unable to chdir to $pbpkg-$pbver";
    375381            symlink "pbconf/$ddir-$dver","debian" || die "Unable to symlink to pbconf/$ddir-$dver";
     382            chmod 0755,"debian/rules";
    376383            pb_system("dpkg-buildpackage -us -uc -rfakeroot","Building package");
    377384            $made="$made $pbpkg"."_*.deb $pbpkg"."_*.dsc $pbpkg"."_*.tar.gz";
     
    552559        print KEEP "$made\n";
    553560        close(KEEP);
    554         pb_system("ssh -q -p $port $mac \"rm -rf $tdir\"","VM cleanup on $mac");
     561        pb_system("ssh -q -p $port $mac \"rm -rf $tdir $bdir\"","VM cleanup on $mac");
    555562        if (! $vmexist) {
    556             pb_system("ssh -q -p $port $mac \"sudo /usr/bin/poweroff \"; sleep 120 ; echo \'if [ -d /proc/$vmexist ]; then kill $vmexist; fi \' | bash ; sleep 10","VM halt on $mac");
     563            pb_system("ssh -q -p $port $mac \"sudo /usr/bin/poweroff \"; sleep 120 ; echo \'if [ -d /proc/$vmexist ]; then kill -9 $vmexist; fi \' | bash ; sleep 10","VM $vm halt (pid $vmexist)");
    557564        }
    558565        pb_send2ssh("Packages","$odir"."_"."$over");
     
    577584        my $vmexist = pb_launchvm($v);
    578585        if (! $vmexist) {
    579             pb_system("sleep 300","Waiting for it to come up");
     586            pb_system("sleep 300","Waiting for $v to come up");
     587        } else {
     588            print "Using VM pid $vmexist\n";
    580589        }
    581590
     
    635644        die "VM of type $vmtype not supported. Report to the dev team";
    636645    }
    637     my $vmexist = pb_check_ps($vmcmd,$vmm);
     646    my ($tmpcmd,$void) = split(/ +/,$cmd);
     647    my $vmexist = pb_check_ps($tmpcmd,$vmm);
    638648    if (! $vmexist) {
    639         pb_system("$cmd &","Launching the VM");
     649        pb_system("$cmd &","Launching the VM $vmm");
    640650    }
    641651    return($vmexist);
     
    674684        my $vmexist = pb_launchvm($v);
    675685        if (! $vmexist) {
    676             pb_system("sleep 300","Waiting for it to come up");
     686            pb_system("sleep 300","Waiting for $v to come up");
     687        } else {
     688            print "Using VM pid $vmexist\n";
    677689        }
    678690
     
    681693        pb_send2ssh("VMs","$v",$vmexist,"vmhost","vmlogin","pbrc","vmport");
    682694    }
     695}
     696
     697sub pb_newver {
     698
     699    my $cms=pb_cms_init($ENV{'PBPROJ'});
     700    if ($cms->{$ENV{'PBPROJ'}} ne "svn") {
     701        die "Only SVN is supported at the moment";
     702    }
     703    my $res = pb_cms_isdiff($cms);
     704    die "You need to have no differences before creating a new version" if ($res != 0);
     705    my $cmsurl = pb_cms_getinfo($cms);
     706    my $newurl = dirname($cmsurl).$newver;
     707    pb_cms_copy($cmsurl,$newurl);
     708    pb_cms_checkout($newurl);
    683709}
    684710
     
    789815    print "             to connect on the related VMs.\n";
    790816    print "\n";
     817    print "-P port    : Number of the port to use\n";
     818    print "             to connect on the related VMs.\n";
     819    print "\n";
    791820    print "-p project : Name of the project you're working on\n";
    792821    print "             (or use the env variable PBPROJ)     \n";
     
    794823    print "-r pbroot  : Path Name of project under the CMS \n";
    795824    print "             (or use the env variable PBROOT)   \n";
     825    print "\n";
     826    print "-V newver  : New version of the project to create\n";
     827    print "             from the current one.              \n";
    796828    print "\n";
    797829    print "<action> can be:\n";
     
    821853    print "\t           and executes a script on it                 \n";
    822854    print "\n";
    823 }
     855    print "\tnewver:    Create a new version of the project derived \n";
     856    print "\t           from the current one                        \n";
     857    print "\n";
     858}
  • devel/pb/contrib/pbsetupqemu

    r191 r199  
    9292    chomp($topbuilddir);
    9393
    94     my $p = `rpm -q afio`;
    95     chomp($p);
    96     if ($p !~ /^afio/) {
    97         system "rm -f afio-* ; wget ftp://ftp.mondorescue.org/src/afio-2.4.7-1.src.rpm ; rpm -ivh afio-2.4.7-1.src.rpm ; rpmbuild -ba $topbuilddir/SPECS/afio.spec ; chmod 644 $topbuilddir/RPMS/*/*.rpm";
    98     }
    99     $p = `rpm -q buffer`;
    100     chomp($p);
    101     if ($p !~ /^buffer/) {
    102         system "rm -f buffer-* ; wget ftp://ftp.mondorescue.org/src/buffer-1.19-1.src.rpm ; rpm -ivh buffer-1.19-1.src.rpm ; rpmbuild -ba $topbuilddir/SPECS/buffer.spec ; chmod 644 $topbuilddir/RPMS/*/*.rpm";
    103     }
    10494    if ( $dver <= 4 ) {
    10595        # FC4 - AppConfig unavailable
  • devel/pb/lib/ProjectBuilder/Base.pm

    r174 r199  
    1313use AppConfig qw(ARGCOUNT_HASH);
    1414use Data::Dumper;
     15
     16use ProjectBuilder::Changelog qw (pb_changelog);
    1517
    1618$ENV{'PBETC'} = "$ENV{'HOME'}/.pbrc";
Note: See TracChangeset for help on using the changeset viewer.