- Timestamp:
- 04/27/07 17:10:19 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/debbuild
r94 r95 57 57 my $srcpkg; 58 58 my $cmdbuildroot; 59 my $tarballdir ;= '%{name}-%{version}'; # We do this in case of a spec file not using %setup...59 my $tarballdir = '%{name}-%{version}'; # We do this in case of a spec file not using %setup... 60 60 my %specglobals; # For %define's in specfile, among other things. 61 61 … … 418 418 open SPECFILE,"<$specfile" or die "specfile ($specfile) barfed: $!"; 419 419 420 my $iflevel = 0; 420 421 my $buildarch = $hostarch; 421 422 $pkgdata{main}{arch} = $hostarch; … … 430 431 if (my ($key, $def) = (/^\%define\s+([^\s]+)\s+(.+)$/) ) { 431 432 $specglobals{$key} = expandmacros($def,'g'); 433 } 434 435 if (/^\%if/) { 436 s/^\%if//; 437 my $expr = expandmacros($_, 'g'); 438 $iflevel++; 439 next LINE if $expr != 0; # This appears to be the only case we call false. 440 while (<SPECFILE>) { 441 if (/^\%endif/) { 442 $iflevel--; 443 next LINE; 444 } elsif (/^\%else/) { 445 next LINE; 446 } 447 } 448 } 449 if (/^\%else/) { 450 while (<SPECFILE>) { 451 if (/^\%endif/) { 452 $iflevel--; 453 next LINE; 454 } 455 } 456 } 457 if (/^\%endif/) { 458 $iflevel--; 459 next LINE; 432 460 } 433 461 … … 1326 1354 } 1327 1355 1356 # support for **some** %if constructs. Note that this breaks somewhat if 1357 # there's no value specified... but so does rpm. 1358 while ($macrostring =~ /\%\{\?(\!)?([a-z0-9_.-]+)(?:\:([a-z0-9_.-]+))?\}/) { #Whew.... 1359 my $neg = $1; 1360 my $macro = $2; 1361 my $value = $3; 1362 if ($specglobals{$macro}) { 1363 $value = '' if $neg; 1364 } else { 1365 $value = '' if !$neg; 1366 } 1367 $macrostring =~ s/\%\{\?\!?[a-z0-9_.-]+(?:\:[a-z0-9_.-]+)?\}/$value/; 1368 } 1369 1328 1370 # system programs. RPM uses a global config file for these; we'll just 1329 1371 # ASS-U-ME and make life a little simpler.
Note:
See TracChangeset
for help on using the changeset viewer.