Changeset 96
- Timestamp:
- 05/03/07 15:45:34 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/debbuild
r95 r96 266 266 # Needs to handle "other files" 267 267 sub load_userconfig { 268 my (undef,undef,undef,undef,undef,undef,undef,$homedir,undef) = getpwuid($<);268 my $homedir = (getpwuid($<))[7]; 269 269 if (-e "$homedir/.debmacros") { 270 270 open USERMACROS,"<$homedir/.debmacros"; … … 274 274 my (undef,$tmp) = split /\s+/, $_; 275 275 $topdir = $tmp; 276 } 277 next if /^\%_/; 278 # Allow arbitrary definitions. Note that we're only doing simple defs here for now. 279 if (/^\%([a-z0-9]+)\s+(.+)$/) { 280 $specglobals{$1} = $2; 276 281 } 277 282 } … … 497 502 } 498 503 504 ##fixme: need to allow %if contructs to work in subsections like %prep 499 505 if (/^\%prep/) { 500 506 # %prep section. May have %setup macro; may include %patch tags, … … 1318 1324 if ($section =~ /g/) { 1319 1325 1320 # special %define's. Handle the general case where we eval anything.1321 # Even more general: %(...) is a spec-parse-time shell code wrapper.1322 # Prime example:1323 #%define perl_vendorlib %(eval "`perl -V:installvendorlib`"; echo $installvendorlib)1324 if ($macrostring =~ /^\%\(.+\)$/) {1325 $macrostring =~ s/^\%\(//;1326 $macrostring =~ s/\)$//;1327 # Oy vey this gets silly for the perl bits. Executing a shell to1328 # call Perl to get the vendorlib/sitelib/whatever "core" globals.1329 # This can do more, but... eww.1330 # Next line is non-optimal - what if $macrostring contains ' characters?1331 $macrostring = qx { /bin/sh -c '$macrostring' };1332 }1333 1334 1326 $macrostring =~ s|%{_builddir}|%{_topdir}/BUILD|g; 1335 1327 $macrostring =~ s|%{_topdir}|$topdir|g; … … 1352 1344 foreach my $key (keys %specglobals) { 1353 1345 $macrostring =~ s|%{$key}|$specglobals{$key}|g; 1346 } 1347 1348 # special %define's. Handle the general case where we eval anything. 1349 # Even more general: %(...) is a spec-parse-time shell code wrapper. 1350 # Prime example: 1351 #%define perl_vendorlib %(eval "`perl -V:installvendorlib`"; echo $installvendorlib) 1352 if ($macrostring =~ /\%\((.+)\)/) { 1353 my $shellstr = $1; 1354 # Oy vey this gets silly for the perl bits. Executing a shell to 1355 # call Perl to get the vendorlib/sitelib/whatever "core" globals. 1356 # This can do more, but... eww. 1357 $shellstr = qx { /bin/sh -c '$shellstr' }; # Yay! ' characters apparently get properly exscapededed. 1358 $macrostring =~ s/\%\(.+\)/$shellstr/; 1354 1359 } 1355 1360
Note:
See TracChangeset
for help on using the changeset viewer.