Changeset 500 in ProjectBuilder for devel/pb/lib/ProjectBuilder/Filter.pm


Ignore:
Timestamp:
Aug 3, 2008, 1:20:30 PM (16 years ago)
Author:
Bruno Cornec
Message:
  • Working patch support added to pb (tested with buffer)
  • Filtering functions now handle also pointer on hashes (such as the new pb hash)
  • Filtering functions support new macro for patch support (PBPATCHSRC and PBPATCHCMD)
  • Env.pm now generates correct templates for patch support and uses the new pb hash
  • pb_cms_export extended to support file:// URI, and also supports an undef second param (no local export available)
  • In pb, hashes now include also the arch (for better patch support)
  • pb supports local CMS based patches, as well as external references (not tested yet)
  • New pb_get_arch function provided
  • New parameters for pb_system (mayfail and quiet)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/Filter.pm

    r499 r500  
    139139my $destfile=shift;
    140140my $pb=shift;
    141 my %pb = %$pb;
    142141
    143142pb_log(2,"DEBUG: From $f to $destfile\n");
     
    149148    foreach my $s (keys %filter) {
    150149        # Process single variables
    151         pb_log(2,"DEBUG filter{$s}: $filter{$s}\n");
    152150        my $tmp = $filter{$s};
    153151        next if (not defined $tmp);
     152        pb_log(3,"DEBUG filter{$s}: $filter{$s}\n");
    154153        # Expand variables if any single one found
    155         pb_log(2,"DEBUG tmp: $tmp\n");
    156154        if ($tmp =~ /\$/) {
     155            # Order is important as we need to handle hashes refs before simple vars
     156            eval { $tmp =~ s/(\$\w+-\>\{\'\w+\'\})/$1/eeg };
    157157            eval { $tmp =~ s/(\$\w+)/$1/eeg };
    158158            eval { $tmp =~ s/(\$\/)/$1/eeg };
    159159        # special case for ChangeLog only for pb
    160160        } elsif (($s =~ /^PBLOG$/) && ($line =~ /^PBLOG$/)) {
    161             my $p = $pb{'defpkgdir'}->{$pbpkg};
    162             $p = $pb{'extpkgdir'}->{$pbpkg} if (not defined $p);
    163             pb_changelog($pb{'dtype'}, $pb{'pkg'}, $pb{'ver'}, $pb{'tag'}, $pb{'suf'}, $p, \*DEST, $tmp, $pb{'chglog'});
     161            pb_log(3,"DEBUG filtering PBLOG\n");
     162            my $p = $pb->{'defpkgdir'}->{$pb->{'pkg'}};
     163            $p = $pb->{'extpkgdir'}->{$pb->{'pkg'}} if (not defined $p);
     164            pb_changelog($pb->{'dtype'}, $pb->{'pkg'}, $pb->{'ver'}, $pb->{'tag'}, $pb->{'suf'}, $p, \*DEST, $tmp, $pb->{'chglog'});
    164165            $tmp = "";
    165166        } elsif (($s =~ /^PBPATCHSRC$/) && ($line =~ /^PBPATCHSRC$/)) {
     167            pb_log(3,"DEBUG filtering PBPATCHSRC\n");
    166168            my $i = 0;
    167             foreach my $p (sort @$pb{'patches'}) {
    168                 print DEST "Patch$i: $p\n";
     169            foreach my $p (split(/,/,$pb->{'patches'}->{$pb->{'tuple'}})) {
     170                print DEST "Patch$i:         ".basename($p).".gz\n";
     171                $i++;
    169172            }
    170173            $tmp = "";
    171174        } elsif (($s =~ /^PBPATCHCMD$/) && ($line =~ /^PBPATCHCMD$/)) {
     175            pb_log(3,"DEBUG filtering PBPATCHCMD\n");
    172176            my $i = 0;
    173             foreach my $p (sort @$pb{'patches'}) {
    174                 print DEST "%patch$i\n";
     177            foreach my $p (split(/,/,$pb->{'patches'}->{$pb->{'tuple'}})) {
     178                print DEST "%patch$i -p1\n";
     179                $i++;
    175180            }
    176181            print DEST "\n";
     
    204209my $destfile=shift;
    205210my $pb=shift;
    206 my %pb = %$pb;
    207211
    208212my $cp = "$ENV{'PBTMP'}/".basename($destfile);
    209 copy($destfile,$cp) || die "Unable to create $cp";
     213copy($destfile,$cp) || die "Unable to copy $destfile to $cp";
    210214
    211215pb_filter_file($cp,$ptr,$destfile,$pb);
Note: See TracChangeset for help on using the changeset viewer.