Changeset 357


Ignore:
Timestamp:
Apr 7, 2008, 12:53:56 AM (11 years ago)
Author:
bruno
Message:
  • When specifying packages on the CLI they are now transmitted to build functions correctly
  • Fix a bug with the pid of the VM (problem of visibility of variables)
  • Improve setupvm for fedora, mandriva
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r356 r357  
    11#!/usr/bin/perl -w
    2 
    3 eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
    4     if 0; # not running under some shell
    52#
    63# Project Builder main application
     
    435432sub pb_cms2build {
    436433
    437     my $ptr = pb_cms_get_pkg($defpkgdir,$extpkgdir);
    438     @pkgs = @$ptr;
     434    my $pkg = pb_cms_get_pkg($defpkgdir,$extpkgdir);
     435    my @pkgs = @$pkg;
     436    my %pkgs;
    439437
    440438    my ($scheme, $uri) = pb_cms_init($pbinit);
     
    564562
    565563        # Get only all.pbf filter
    566         $ptr = pb_get_filters($pbpkg);
     564        my $ptr = pb_get_filters($pbpkg);
    567565
    568566        my $liste ="";
     
    588586        pb_log(0,"Under $ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz\n");
    589587
    590         # Keep track of what is generated by default
    591         # We need to store the dir and info on version-tag
    592         # Base our content on the existing .pb file
    593         copy("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb","$ENV{'PBDESTDIR'}/pbrc");
    594         open(LAST,">> $ENV{'PBDESTDIR'}/pbrc") || die "Unable to create $ENV{'PBDESTDIR'}/pbrc";
    595         print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOTDIR'}\n";
    596         print LAST "pbprojver $ENV{'PBPROJ'} = $ENV{'PBPROJVER'}\n";
    597         print LAST "pbprojtag $ENV{'PBPROJ'} = $ENV{'PBPROJTAG'}\n";
    598         print LAST "pbpackager $ENV{'PBPROJ'} = $ENV{'PBPACKAGER'}\n";
    599         close(LAST);
    600 
    601         # Keep track of per package version
    602         my ($pkg) = pb_conf_read_if("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
    603         $pkg = { } if (not defined $pkg);
    604         if ((not defined $pkg->{$pbpkg}) || ($pkg->{$pbpkg} ne "$pbver-$pbtag")) {
    605             $pkg->{$pbpkg} = "$pbver-$pbtag";
    606         }
    607 
    608         pb_log(2,"DEBUG pkg: ".Dumper($pkg)."\n");
    609         open(PKG,"> $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb";
    610         foreach my $p (keys %$pkg) {
    611             print PKG "pbpkg $p = $pkg->{$p}\n";
    612         }
    613         close(PKG);
     588        # Keep track of version-tag per pkg
     589        $pkgs{$pbpkg} = "$pbver-$pbtag";
    614590
    615591        # Final cleanup
    616592        pb_rm_rf($dest) if (-d $dest);
    617593    }
     594
     595    # Keep track of per package version
     596    pb_log(2,"DEBUG pkgs: ".Dumper(%pkgs)."\n");
     597    open(PKG,"> $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb";
     598    foreach my $pbpkg (@pkgs) {
     599        print PKG "pbpkg $pbpkg = $pkgs{$pbpkg}\n";
     600    }
     601    close(PKG);
     602
     603    # Keep track of what is generated by default
     604    # We need to store the dir and info on version-tag
     605    # Base our content on the existing .pb file
     606    copy("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb","$ENV{'PBDESTDIR'}/pbrc");
     607    open(LAST,">> $ENV{'PBDESTDIR'}/pbrc") || die "Unable to create $ENV{'PBDESTDIR'}/pbrc";
     608    print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOTDIR'}\n";
     609    print LAST "pbprojver $ENV{'PBPROJ'} = $ENV{'PBPROJVER'}\n";
     610    print LAST "pbprojtag $ENV{'PBPROJ'} = $ENV{'PBPROJTAG'}\n";
     611    print LAST "pbpackager $ENV{'PBPROJ'} = $ENV{'PBPACKAGER'}\n";
     612    close(LAST);
    618613}
    619614
     
    943938        # We want to send them to the ssh account so overwrite what has been done before
    944939        undef $pbaccount;
     940        pb_log(2,"Before sending pkgs, vmexist: $vmexist, vmpid: $vmpid\n");
    945941        pb_send2target("Packages",$odir."-".$over."-".$oarch,$vmexist,$vmpid);
    946942        if ((! $vmexist) && ($cmt eq "vm")) {
     
    10561052                pb_system("sleep $vmtmout->{$ENV{'PBPROJ'}}","Waiting for VM $v to come up");
    10571053                $vmpid = pb_check_ps($tmpcmd,$vmm);
     1054                pb_log(0,"VM $vmm launched (pid $vmpid)\n");
    10581055            }
    10591056        } else {
     
    11481145    if ($vtype eq "vm") {
    11491146        # Launch the VM
    1150         my ($vmexist,$vmpid) = pb_launchv($vtype,$v,0);
     1147        ($vmexist,$vmpid) = pb_launchv($vtype,$v,0);
    11511148
    11521149        # Skip that VM if it something went wrong
     
    11551152    # Gather all required files to send them to the VM/VE
    11561153    # and launch the build through pbscript
     1154    pb_log(2,"Calling send2target $vtype,$v,$vmexist,$vmpid\n");
    11571155    pb_send2target($vtype,"$v",$vmexist,$vmpid);
    11581156}
     
    12351233    my ($pbac) = pb_conf_get($vtype."login");
    12361234    my ($key,$zero0,$zero1,$zero2);
     1235    my ($vmexist,$vmpid);
    12371236
    12381237    if ($vtype eq "vm") {
     
    12451244   
    12461245        # Launch the VM
    1247         my ($vmexist,$vmpid) = pb_launchv($vtype,$v,0);
     1246        ($vmexist,$vmpid) = pb_launchv($vtype,$v,0);
    12481247
    12491248        # Skip that VM if something went wrong
     
    13921391
    13931392system "rm -rf project-builder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/project-builder-latest.tar.gz ; tar xvfz project-builder-latest.tar.gz ; cd project-builder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf project-builder-*";
     1393EOF
     1394    if ((! $vmexist) && ($vtype eq "vm")) {
     1395        print SCRIPT << 'EOF';
    13941396system "sudo /sbin/halt -p";
    13951397EOF
     1398    }
    13961399   
    13971400    # Adds pb_distro_init from ProjectBuilder::Distribution
     
    14311434
    14321435# Get and install pb
     1436my $insdm = "rm -rf Date-Manip* ; wget http://search.cpan.org/CPAN/authors/id/S/SB/SBECK/Date-Manip-5.48.tar.gz ; tar xvfz Date-Manip-5.48.tar.gz ; cd Date-Manip* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf Date-Manip*";
     1437my $insmb = "rm -rf Module-Build* ; wget http://search.cpan.org/CPAN/authors/id/K/KW/KWILLIAMS/Module-Build-0.2808.tar.gz ; tar xvfz Module-Build-0.2808.tar.gz ; cd Module-Build* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf Module-Build*";
     1438my $insfm = "rm -rf File-MimeInfo* ; wget http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-MimeInfo/File-MimeInfo-0.15.tar.gz ; tar xvfz File-MimeInfo-0.15.tar.gz ; cd File-MimeInfo* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf File-MimeInfo*";
     1439my $insfb = "rm -rf File-Basedir* ; wget http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-BaseDir-0.03.tar.gz ; tar xvfz File-BaseDir-0.03.tar.gz ; cd File-BaseDir* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf File-BaseDir*";
     1440
    14331441if ( $ddir eq "fedora" ) {
    14341442    system "yum clean all";
     
    14421450
    14431451    system "yum -y $opt install rpm-build wget patch ntp sudo perl-DateManip perl-File-MimeInfo perl-ExtUtils-MakeMaker";
    1444 } 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")) || ($ddir eq "slackware")) {
     1452    if ($dver eq 4) {
     1453        system "$insmb";
     1454        system "$insfm";
     1455        system "$insfb";
     1456    }
     1457} elsif (( $dfam eq "rh" ) || ($ddir eq "sles") || (($ddir eq "suse") && (($dver eq "10.1") || ($dver eq "10.0"))) || ($ddir eq "slackware")) {
    14451458    # Suppose pkg are installed already
    14461459    system "rpm -e lsb 2>&1 > /dev/null";
    1447     system "rm -rf Date-Manip* ; wget http://search.cpan.org/CPAN/authors/id/S/SB/SBECK/Date-Manip-5.48.tar.gz ; tar xvfz Date-Manip-5.48.tar.gz ; cd Date-Manip* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf Date-Manip*";
     1460    system "$insdm";
    14481461    if ($ddir eq "slackware") {
    1449         system "rm -rf Module-Build* ; wget http://search.cpan.org/CPAN/authors/id/K/KW/KWILLIAMS/Module-Build-0.2808.tar.gz ; tar xvfz Module-Build-0.2808.tar.gz ; cd Module-Build* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf Module-Build*";
    1450         system "rm -rf File-MimeInfo* ; wget http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-MimeInfo/File-MimeInfo-0.15.tar.gz ; tar xvfz File-MimeInfo-0.15.tar.gz ; cd File-MimeInfo* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf File-MimeInfo*";
    1451         system "rm -rf File-Basedir* ; wget http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-BaseDir-0.03.tar.gz ; tar xvfz File-BaseDir-0.03.tar.gz ; cd File-BaseDir* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf File-BaseDir*";
     1462        system "$insmb";
     1463        system "$insfm";
     1464        system "$insfb";
    14521465    }
    14531466} elsif ($ddir eq "suse") {
     
    14551468    system "export TERM=linux ; liste=\"\" ; for i in make wget patch sudo perl-DateManip 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";
    14561469} elsif ( $dfam eq "md" ) {
    1457         system "urpmi.update -a ; urpmi --auto rpm-build wget sudo patch ntp-client perl-File-MimeInfo perl-DateManip";
     1470        system "urpmi.update -a ; urpmi --auto rpm-build wget sudo patch ntp-client perl-File-MimeInfo";
     1471        if (($ddir eq "mandrake") && ($dver eq "10.1")) {
     1472            system "$insdm";
     1473        } else {
     1474            system "urpmi --auto perl-DateManip";
     1475        }
    14581476} elsif ( $dfam eq "du" ) {
    14591477    if (( $dver eq "3.1" ) && ($ddir eq "debian")) {
Note: See TracChangeset for help on using the changeset viewer.