Changeset 1282 in ProjectBuilder


Ignore:
Timestamp:
Mar 25, 2011, 2:42:28 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Fix partially #96. Still needs to deal with pkg name vs real pkg names
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1281 r1282  
    844844        # except if a target was given, in which case we only build for it
    845845        my $pbos = pb_distro_get_context($pbtarget);
    846         my $tmpl = "$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'},";
    847 
    848         # Get list of distributions for which we need to generate build files if no target
    849         if (not defined ($pbtarget)) {
    850             my @pt = pb_conf_get_if("vmlist","velist","rmlist");
    851             if (defined $pt[0]->{$ENV{'PBPROJ'}}) {
    852                 $tmpl .= $pt[0]->{$ENV{'PBPROJ'}};
    853             }
    854             if (defined $pt[1]->{$ENV{'PBPROJ'}}) {
    855                 # The 2 lists needs to be grouped with a ',' separating them
    856                 if ($tmpl ne "") {
    857                     $tmpl .= ",";
    858                 }
    859                 $tmpl .= $pt[1]->{$ENV{'PBPROJ'}}
    860             }
    861             if (defined $pt[2]->{$ENV{'PBPROJ'}}) {
    862                 # The lists needs to be grouped with a ',' separating them
    863                 if ($tmpl ne "") {
    864                     $tmpl .= ",";
    865                 }
    866                 $tmpl .= $pt[2]->{$ENV{'PBPROJ'}}
    867             }
    868         }
    869    
     846        my $tmpl = pb_get_distros($pbos,$pbtarget);
     847
    870848        # Setup $pb structure to allow filtering later on, on files using that structure
    871849        $pb->{'tag'} = $pbtag;
     
    32543232    # Get all required parameters
    32553233    my ($pbpackager,$pbrepo,$pbml,$pbsmtp) = pb_conf_get("pbpackager","pbrepo","pbml","pbsmtp");
    3256     my ($pkgv, $pkgt, $testver) = pb_conf_get_if("pkgver","pkgtag","testver");
     3234    my ($pkgv, $pkgt) = pb_conf_get_if("pkgver","pkgtag");
    32573235    my $pkg = pb_cms_get_pkg($defpkgdir,$extpkgdir);
    32583236    my @pkgs = @$pkg;
     
    32603238    my $first = 0;
    32613239
     3240    # Get all distros concerned
     3241    my $pbos = pb_distro_get_context();
     3242    my $distrolist = pb_get_distros($pbos,undef);
     3243    my %dl;
     3244    foreach my $d (split(/,/,$distrolist)) {
     3245        my ($d1,$d2, $d3) = split(/-/,$d);
     3246        $dl{$d1}++;
     3247    }
     3248
    32623249    # Command to find packages on repo
    3263     my $findstr = "find . ";
     3250    my $findstr = "find ".join(" ",keys %dl)." ";
    32643251    # Generated announce files
    32653252    my @files;
     
    32823269
    32833270        # TODO: use virtual/real names here now
    3284         $findstr .= "-name \'$pbpkg-$pbver-$pbtag\.*.rpm\' -o -name \'$pbpkg"."_$pbver*\.deb\' -o -name \'$pbpkg-$pbver*\.ebuild\' -o -name \'$pbpkg-$pbver*\.pkg\' -o -name \'$pbpkg-$pbver*\.sd\'";
     3271        $findstr .= "-name \'$pbpkg-$pbver-$pbtag\.*.rpm\' -o -name \'$pbpkg"."_$pbver*\.deb\' -o -name \'$pbpkg-$pbver*\.ebuild\' -o -name \'$pbpkg-$pbver*\.pkg\' -o -name \'$pbpkg-$pbver*\.sd\' ";
    32853272
    32863273        my $chglog;
     
    33123299    # Prepare the command to run and execute it
    33133300    open(PBS,"> $ENV{'PBTMP'}/pbscript") || die "Unable to create $ENV{'PBTMP'}/pbscript";
     3301    print PBS "set -x\n" if ($pbdebug gt 1);
    33143302    print PBS "$findstr\n";
    33153303    close(PBS);
     
    38543842}
    38553843
     3844# return list of all distributins supported, coma separated
     3845sub pb_get_distros {
     3846
     3847my $pbos = shift;
     3848my $pbtarget = shift;
     3849
     3850my $tmpl = "$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'},";
     3851
     3852# Get list of distributions for which we need to generate build files if no target
     3853if (not defined ($pbtarget)) {
     3854    my @pt = pb_conf_get_if("vmlist","velist","rmlist");
     3855    if (defined $pt[0]->{$ENV{'PBPROJ'}}) {
     3856        $tmpl .= $pt[0]->{$ENV{'PBPROJ'}};
     3857    }
     3858    if (defined $pt[1]->{$ENV{'PBPROJ'}}) {
     3859        # The 2 lists needs to be grouped with a ',' separating them
     3860        if ($tmpl ne "") {
     3861            $tmpl .= ",";
     3862        }
     3863        $tmpl .= $pt[1]->{$ENV{'PBPROJ'}}
     3864    }
     3865    if (defined $pt[2]->{$ENV{'PBPROJ'}}) {
     3866        # The lists needs to be grouped with a ',' separating them
     3867        if ($tmpl ne "") {
     3868            $tmpl .= ",";
     3869        }
     3870    $tmpl .= $pt[2]->{$ENV{'PBPROJ'}}
     3871    }
     3872}
     3873return($tmpl);
     3874}   
     3875
    385638761;
Note: See TracChangeset for help on using the changeset viewer.