Changeset 60


Ignore:
Timestamp:
06/05/06 15:53:07 (18 years ago)
Author:
kdeugau
Message:

/trunk

Extend %define capability - can now use %(eval ...) as the
"value", where the stuff in brackets is eval'ed by /bin/sh (aka
/bin/{bash,ash,bsh} and a number of others). Note that it will
likely barf and break for a *csh.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debbuild

    r59 r60  
    371371      # A macro that needs further processing.
    372372
    373       if (/^\%define\s+([^\s]+)\s+([^\s]+)/) {
    374         $specglobals{$1} = expandmacros($2,'g');
     373      if (my ($key, $def) = (/^\%define\s+([^\s]+)\s+(.+)$/) ) {
     374        $specglobals{$key} = expandmacros($def,'g');
    375375      }
    376376
     
    11521152  # Globals, and not-so-globals
    11531153  if ($section =~ /g/) {
     1154
     1155    # special %define's.  Handle the general case where we eval anything.
     1156    # Prime example:
     1157    #%define perl_vendorlib %(eval "`perl -V:installvendorlib`"; echo $installvendorlib)
     1158    if ($macrostring =~ /^\%\(eval.+\)$/) {
     1159      $macrostring =~ s/^\%\(//;
     1160      $macrostring =~ s/\)$//;
     1161      # Oy vey this gets silly for the perl bits.  Executing a shell to
     1162      # call Perl to get the vendorlib/sitelib/whatever "core" globals.
     1163      # This can do more, but...  eww.
     1164      # Next line is non-optimal - what if $macrostring contains ' characters?
     1165      $macrostring = qx { /bin/sh -c '$macrostring' };
     1166    }
     1167
    11541168    $macrostring =~ s|%{_builddir}|%{_topdir}/BUILD|g;
    11551169    $macrostring =~ s|%{_topdir}|$topdir|g;
Note: See TracChangeset for help on using the changeset viewer.