Changeset 200


Ignore:
Timestamp:
Oct 13, 2007, 2:26:55 AM (13 years ago)
Author:
Bruno Cornec
Message:

More fixes for handling creation/destruction of VMs
SuSE 10.0 forces bz2 files (not more recent versions)

Location:
devel/pb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r199 r200  
    338338
    339339        my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz";
    340         # Suse < 10.2 forces tar.bz2 usage :-(
    341         if ($ddir eq "suse") {
    342             print "SuSE needs bz2 type of packages so recompressing...\n";
     340        # Suse 10.0 forces tar.bz2 usage :-(
     341        if (($ddir eq "suse") && ($dver eq "10.0")) {
     342            print "SuSE 10.0 needs bz2 type of packages so recompressing...\n";
    343343            my $newsrc="$ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.bz2";
    344344            system "gzip -cd $src | bzip2 -c6 > $newsrc";
     
    450450    my $vm = shift || undef;
    451451    my $vmexist = shift || 0;           # 0 is FALSE
     452    my $vmpid = shift || 0;             # 0 is FALSE
    452453    my $host = shift || "sshhost";
    453454    my $login = shift || "sshlogin";
    454455    my $dir = shift || "sshdir";
    455456    my $port = shift || "sshport";
     457    my $tmout = shift || "120";
    456458    my $cmd = "";
    457459
     
    537539
    538540    $port = $sshport->{$ENV{'PBPROJ'}};
     541    my $tm = $tmout->{$ENV{'PBPROJ'}};
    539542    pb_system("ssh -q -p $port $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");
    540543    pb_system("cd $ENV{'PBBUILDDIR'} ; scp -p -P $port $src $mac:$tdir 2> /dev/null","$cmt delivery in $tdir on $mac");
     
    542545    if ($cmt eq "VMs") {
    543546        # Get back info on pkg produced, compute their name and get them from the VM
    544         pb_system("scp -p -P $port $mac:$bdir/pbgen-$pbprojver-$pbprojtag $ENV{'PBBUILDDIR'} 2> /dev/null","Get package names in $tdir on $mac");
     547        pb_system("scp -p -P $port $mac:$bdir/pbgen-$pbprojver-$pbprojtag $ENV{'PBBUILDDIR'} 2> /dev/null","Get package names in $bdir on $mac");
    545548        open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";
    546549        my $src = <KEEP>;
     
    554557        foreach my $p (split(/ +/,$src)) {
    555558            my $j = basename($p);
    556             pb_system("scp -p -P $port $mac:\'$bdir/$p\' $ENV{'PBBUILDDIR'}/$odir/$over 2> /dev/null","Package recovery of $j in $tdir from $mac");
     559            pb_system("scp -p -P $port $mac:\'$bdir/$p\' $ENV{'PBBUILDDIR'}/$odir/$over 2> /dev/null","Package recovery of $j in $bdir from $mac");
    557560            $made="$made $odir/$over/$j" if (($dtype ne "rpm") || ($j !~ /.src.rpm$/));
    558561        }
     
    561564        pb_system("ssh -q -p $port $mac \"rm -rf $tdir $bdir\"","VM cleanup on $mac");
    562565        if (! $vmexist) {
    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)");
     566            pb_system("ssh -q -p $port $mac \"sudo /usr/bin/poweroff \"; sleep $tm ; echo \'if [ -d /proc/$vmpid ]; then kill -9 $vmpid; fi \' | bash ; sleep 10","VM $vm halt (pid $vmpid)");
    564567        }
    565568        pb_send2ssh("Packages","$odir"."_"."$over");
     
    582585    foreach my $v (@$vm) {
    583586        # Launch the VM
    584         my $vmexist = pb_launchvm($v);
    585         if (! $vmexist) {
    586             pb_system("sleep 300","Waiting for $v to come up");
    587         } else {
    588             print "Using VM pid $vmexist\n";
    589         }
     587        my ($vmexist,$vmpid) = pb_launchvm($v);
    590588
    591589        # Gather all required files to send them to the VM
    592590        # and launch the build thourgh pbscript
    593         pb_send2ssh("Script","$v",$vmexist,"vmhost","vmlogin","pbrc","vmport");
     591        pb_send2ssh("Script","$v",$vmexist,$vmpid,"vmhost","vmlogin","pbrc","vmport","vmtmout");
    594592
    595593    }
     
    604602
    605603    # Launch the VMs
    606     my ($ptr,$vmopt,$vmport,$vmpath) = pb_conf_get("vmtype","vmopt","vmport","vmpath");
     604    my ($ptr,$vmopt,$vmport,$vmpath,$vmtmout) = pb_conf_get("vmtype","vmopt","vmport","vmpath","vmtmout");
    607605    my $vmtype = $ptr->{$ENV{'PBPROJ'}};
    608606    if (defined $vmopt->{$ENV{'PBPROJ'}}) {
     
    646644    my ($tmpcmd,$void) = split(/ +/,$cmd);
    647645    my $vmexist = pb_check_ps($tmpcmd,$vmm);
     646    my $vmpid = 0;
    648647    if (! $vmexist) {
    649648        pb_system("$cmd &","Launching the VM $vmm");
    650     }
    651     return($vmexist);
     649        pb_system("sleep $vmtmout->{$ENV{'PBPROJ'}}","Waiting for VM $vm to come up");
     650        $vmpid = pb_check_ps($tmpcmd,$vmm);
     651    } else {
     652        print "Found an existing VM $vmm (pid $vmexist)\n";
     653    }
     654    return($vmexist,$vmpid);
    652655}
    653656
     
    682685    foreach my $v (@$vm) {
    683686        # Launch the VM
    684         my $vmexist = pb_launchvm($v);
    685         if (! $vmexist) {
    686             pb_system("sleep 300","Waiting for $v to come up");
    687         } else {
    688             print "Using VM pid $vmexist\n";
    689         }
     687        my ($vmexist,$vmpid) = pb_launchvm($v);
    690688
    691689        # Gather all required files to send them to the VM
    692690        # and launch the build thourgh pbscript
    693         pb_send2ssh("VMs","$v",$vmexist,"vmhost","vmlogin","pbrc","vmport");
     691        pb_send2ssh("VMs","$v",$vmexist,$vmpid,"vmhost","vmlogin","pbrc","vmport","vmtmout");
    694692    }
    695693}
  • devel/pb/contrib/pbsetupqemu

    r199 r200  
    7676
    7777my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init();
     78# Suse wants sudoers as 640
     79if (($ddir eq "sles") || ($ddir eq "suse")) {
     80    chmod 0640,$file;
     81}
    7882print "distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n";
    7983
     
    9498    if ( $dver <= 4 ) {
    9599        # FC4 - AppConfig unavailable
    96         system "yum -y $opt install neon newt-devel slang-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick man patch cdrecord mkisofs perl-DateManip ntp ; rm -rf AppConfig-* ; wget http://search.cpan.org/CPAN/authors/id/A/AB/ABW/AppConfig-1.66.tar.gz ; tar xvfz AppConfig-1.66.tar.gz ; cd AppConfig* ; perl Makefile.PL ; make ; make install ; cd ..";
     100        system "yum -y $opt install neon newt-devel slang-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick man patch cdrecord mkisofs perl-DateManip ntp sudo ; rm -rf AppConfig-* ; wget http://search.cpan.org/CPAN/authors/id/A/AB/ABW/AppConfig-1.66.tar.gz ; tar xvfz AppConfig-1.66.tar.gz ; cd AppConfig* ; perl Makefile.PL ; make ; make install ; cd ..";
    97101    } else {
    98102        # FC5/6/7
    99         system "yum -y $opt install neon newt-devel slang-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick man patch cdrecord mkisofs ntp perl-AppConfig perl-DateManip";
     103        system "yum -y $opt install neon newt-devel slang-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick man patch cdrecord mkisofs ntp sudo perl-AppConfig perl-DateManip";
    100104    }
    101105} elsif (( $dfam eq "rh" ) || ($ddir eq "sles") || (($ddir eq "suse") && (($dver eq "10.1") || ($dver eq "10.0"))) || (($ddir eq "mandrake") && ($dver eq "10.1"))) {
    102106    # Suppose pkg are installed already
    103     system "rpm -e lsb";
     107    system "rpm -e lsb 2>&1 > /dev/null";
    104108    system "rm -rf AppConfig-* ; wget http://search.cpan.org/CPAN/authors/id/A/AB/ABW/AppConfig-1.66.tar.gz ; tar xvfz AppConfig-1.66.tar.gz ; cd AppConfig* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf DateManip* ; wget http://search.cpan.org/CPAN/authors/id/S/SB/SBECK/Date-Manip-5.46.tar.gz ; tar xvfz Date-Manip-5.46.tar.gz ; cd Date-Manip* ; perl Makefile.PL ; make ; make install ; cd .. ";
    105109} elsif ($ddir eq "suse") {
    106110    # New OpenSuSE
    107     system "export TERM=linux ; liste=\"\" ; for i in neon newt-devel slang-devel autoconf automake libtool gcc wget gcc-c++ docbook-utils ImageMagick man patch mkisofs perl-DateManip perl-AppConfig perl-File-HomeDir xntp; do rpm -q \$i 1> /dev/null 2> /dev/null ; if [ \$\? != 0 ]; then liste=\"\$liste \$i\"; fi; done; echo \"Liste: \$liste\" ; if [ \"\$liste\" != \"\" ]; then yast2 -i \$liste ; fi";
     111    system "export TERM=linux ; liste=\"\" ; for i in neon newt-devel slang-devel autoconf automake libtool gcc wget gcc-c++ docbook-utils ImageMagick man patch mkisofs sudo perl-DateManip perl-AppConfig perl-File-HomeDir xntp; do rpm -q \$i 1> /dev/null 2> /dev/null ; if [ \$\? != 0 ]; then liste=\"\$liste \$i\"; fi; done; echo \"Liste: \$liste\" ; if [ \"\$liste\" != \"\" ]; then yast2 -i \$liste ; fi";
    108112} elsif ( $dfam eq "md" ) {
    109113    if (( $dver eq "2006.0" ) || ( $dver eq "10.2" )) {
    110114        # mondo not available
    111         system "urpmi.update -a ; urpmi --auto neon newt-devel slang-devel glibc-static-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick man patch mkisofs cdrecord ntp-client perl-AppConfig perl-DateManip";
     115        system "urpmi.update -a ; urpmi --auto neon newt-devel slang-devel glibc-static-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick sudo man patch mkisofs cdrecord ntp-client perl-AppConfig perl-DateManip";
    112116    } else {
    113117        system "urpmi.update -a ; urpmi --auto neon newt-devel slang-devel glibc-static-devel autoconf automake libtool gcc rpm-build wget gcc-c++ docbook-utils-pdf ImageMagick man patch mondo mkisofs cdrecord ntp-client perl-AppConfig perl-DateManip";
    114118    }
    115119} elsif ( $dfam eq "du" ) {
    116     system "apt-get update; apt-get -y install autoconf automake libtool g++ wget patch mondo groff imagemagick docbook-utils docbook2x docbook-to-man openssh-server dpkg-dev debian-builder dh-make fakeroot libnewt-dev ntpdate libncurses5-dev libdate-manip-perl libappconfig-perl";
     120    system "apt-get update; apt-get -y install autoconf automake libtool g++ wget patch mondo groff imagemagick docbook-utils docbook2x docbook-to-man openssh-server dpkg-dev sudo debian-builder dh-make fakeroot libnewt-dev ntpdate libncurses5-dev libdate-manip-perl libappconfig-perl";
    117121} elsif ( $dfam eq "gen" ) {
    118122    system "emerge neon newt slang autoconf automake subversion libtool gcc wget vim man groff lynx grub afio buffer mindi mondo-rescue cdrecord mkisofs ntp-client";
Note: See TracChangeset for help on using the changeset viewer.