Changeset 1189


Ignore:
Timestamp:
02/15/11 03:48:55 (2 years ago)
Author:
bruno
Message:
  • Fix a parallelism issue when building in VMs. This change forces again to update VMs in order to have compatible pb exchnaging info between themselves with a new name of exchange file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1186 r1189  
    847847        # Get list of distributions for which we need to generate build files if no target 
    848848        if (not defined ($pbtarget)) { 
    849             my @pt = pb_conf_get_if("vmlist","velist"); 
     849            my @pt = pb_conf_get_if("vmlist","velist","rmlist"); 
    850850            if (defined $pt[0]->{$ENV{'PBPROJ'}}) { 
    851851                $tmpl .= $pt[0]->{$ENV{'PBPROJ'}}; 
     
    857857                } 
    858858                $tmpl .= $pt[1]->{$ENV{'PBPROJ'}}  
     859            } 
     860            if (defined $pt[2]->{$ENV{'PBPROJ'}}) { 
     861                # The lists needs to be grouped with a ',' separating them 
     862                if ($tmpl ne "") { 
     863                    $tmpl .= ","; 
     864                } 
     865                $tmpl .= $pt[2]->{$ENV{'PBPROJ'}}  
    859866            } 
    860867        } 
     
    905912            $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel); 
    906913 
     914            pb_log(0,"Preparing delivery ...\n"); 
    907915            foreach my $v (keys %virt) { 
    908916                $pm->start and next if (defined $pbparallel); 
     
    911919                my $pbos = pb_distro_get_context($v); 
    912920                $pb->{'pbos'} = $pbos; 
     921                $pb->{'suf'} = $pbos->{'suffix'}; 
    913922                pb_log(3,"DEBUG: pb: ".Dumper($pb)."\n"); 
    914923 
     
    14521461 
    14531462    # Keep track of what is generated so that we can get them back from VMs/RMs 
    1454     open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}"; 
     1463    open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}"; 
    14551464    print KEEP "$made\n"; 
    14561465    close(KEEP); 
     
    15801589    } elsif ($cmt eq "Packages") { 
    15811590        # Get package list from file made during build2pkg 
    1582         open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}"; 
     1591        open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}"; 
    15831592        $src = <KEEP>; 
    15841593        chomp($src); 
    15851594        close(KEEP); 
    1586         $src="$src $ENV{'PBBUILDDIR'}/pbscript"; 
     1595        $src="$src $ENV{'PBBUILDDIR'}/pbscript.$$"; 
    15871596    } 
    15881597    # Remove potential leading spaces (cause problem with basename) 
     
    16491658 
    16501659        # Repository management 
    1651         open(PBS,"> $ENV{'PBBUILDDIR'}/pbscript") || die "Unable to create $ENV{'PBBUILDDIR'}/pbscript"; 
     1660        open(PBS,"> $ENV{'PBBUILDDIR'}/pbscript.$$") || die "Unable to create $ENV{'PBBUILDDIR'}/pbscript.$$"; 
    16521661        if ($pbos->{'type'} eq "rpm") { 
    16531662            # Also make a pbscript to generate yum/urpmi bases 
     
    18131822        } 
    18141823        close(PBS); 
    1815         chmod 0755,"$ENV{'PBBUILDDIR'}/pbscript"; 
     1824        chmod 0755,"$ENV{'PBBUILDDIR'}/pbscript.$$"; 
    18161825    } else { 
    18171826        return; 
     
    18831892    # Use the right script name depending on context 
    18841893    my $pbscript; 
    1885     if ($cmt =~ /^(V[EM]|RM)/) { 
     1894    if (($cmt =~ /^(V[EM]|RM)/) || ($cmt =~ /Packages/)){ 
    18861895        $pbscript = "pbscript.$$"; 
    18871896    } else { 
     
    18921901    if ($cmt =~ /^(V[EM]|RM)build/) { 
    18931902        # Get back info on pkg produced, compute their name and get them from the VM/RM 
    1894         pb_system("$cpcmd $cp2target/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'} $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$ 2> /dev/null","Get package names in $cp2target"); 
     1903        pb_system("$cpcmd $cp2target/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'} $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$ 2> /dev/null","Get package names in $cp2target"); 
    18951904        # For VE we need to change the owner manually 
    18961905        if ($cmt eq "VEbuild") { 
     
    19181927            }    
    19191928 
    1920             open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}"; 
     1929            open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}"; 
    19211930            foreach my $p (split(/ +/,$src)) { 
    19221931                my $j = basename($p); 
     
    19441953        } 
    19451954    } 
    1946     unlink("$ENV{'PBDESTDIR'}/pbscript.$$") if ($cmt =~ /^(V[ME]|RM)/); 
     1955    unlink("$ENV{'PBDESTDIR'}/pbscript.$$") if (($cmt =~ /^(V[ME]|RM)/) || ($cmt =~ /Packages/)); 
    19471956 
    19481957    pb_log(2,"Before halt, vmexist: $vmexist, vmpid: $vmpid\n"); 
     
    29522961    # Try to restrict security to what is really needed 
    29532962    if ($vtype =~ /^vm/) { 
    2954         my $sudocmds = pb_get_sudocmds($pbos); 
     2963        my @sudocmds = pb_get_sudocmds($pbos); 
    29552964        my $hpath = "/sbin"; 
    29562965        # Solaris has halt elsewhere 
     
    29642973print PBOUT "$pbac->{$ENV{'PBPROJ'}}   localhost=NOPASSWD:$hpath/halt\n"; 
    29652974EOF 
    2966         foreach my $c ($sudocmds) { 
    2967             print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}}   localhost=NOPASSWD:$c\n\""; 
     2975        foreach my $c (@sudocmds) { 
     2976            print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}}   localhost=NOPASSWD:$c\n\";"; 
    29682977        } 
    29692978    } elsif ($vtype =~ /^rm/) { 
    2970         my $sudocmds = pb_get_sudocmds($pbos); 
     2979        my @sudocmds = pb_get_sudocmds($pbos); 
    29712980        print SCRIPT << "EOF"; 
    29722981# Build account $pbac->{$ENV{'PBPROJ'}} in RM only needs to setup date and install deps if needed each time 
    29732982EOF 
    2974         foreach my $c ($sudocmds) { 
    2975             print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}}   localhost=NOPASSWD:$c\n\""; 
     2983        foreach my $c (@sudocmds) { 
     2984            print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}}   localhost=NOPASSWD:$c\n\";"; 
    29762985        } 
    29772986    } else { 
     
    30723081    print SCRIPT << 'EOF'; 
    30733082pb_system("pb 2>&1 | head -5",undef,"verbose"); 
     3083pb_system("pbdistrocheck",undef,"verbose"); 
    30743084EOF 
    30753085    if ($vtype eq "ve") { 
Note: See TracChangeset for help on using the changeset viewer.