Changeset 114


Ignore:
Timestamp:
07/19/07 13:07:38 (17 years ago)
Author:
kdeugau
Message:

/trunk

Fix slightly broken macro expansion for %if constructs: %{?macro:value},
%{!?macro:value}, and %{?macro:value} (with and without specified values)
should all work correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debbuild

    r113 r114  
    15081508    # support for **some** %if constructs.  Note that this breaks somewhat if
    15091509    # there's no value specified...  but so does rpm.
    1510     while ($macrostring =~ /\%\{\?(\!)?([a-z0-9_.-]+)(?:\:([a-z0-9_.-]+))?\}/) {       #Whew....
    1511       my $neg = $1;
    1512       my $macro = $2;
    1513       my $value = $3;
     1510my $tmpcount = 0;
     1511    while ($macrostring =~ /(\%\{(!\?|\?!|\?)([a-z0-9_.-]+)(?:\:([a-z0-9_.-]+))?\})/g) {       #Whew....
     1512      my $wholemacro = $1;      # Just for precision when replacing content in multimacro lines...
     1513      my $qex = $2;
     1514      my $macro = $3;
     1515      my $value = $4;
     1516
     1517      my $neg = '1' if $qex =~ /\!/;
    15141518      if ($specglobals{$macro}) {
    15151519        $value = '' if $neg;
     
    15171521        $value = '' if !$neg;
    15181522      }
    1519       $macrostring =~ s/\%\{\?\!?[a-z0-9_.-]+(?:\:[a-z0-9_.-]+)?\}/$value/;
    1520     }
     1523      $macrostring =~ s/$wholemacro/$value/;
     1524
     1525# not certain about this, but I don't want to run away.  It *can* happen if planned carefully.  :/
     1526$tmpcount++;
     1527die "excessive recursive macro replacement;  dying.\n" if $tmpcount > 6;
     1528
     1529    } # while()
    15211530
    15221531    # system programs.  RPM uses a global config file for these;  we'll just
Note: See TracChangeset for help on using the changeset viewer.