diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2010-03-20 06:57:46 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2010-03-20 06:57:46 +0000 |
commit | 8601881301a321561a1ee3c89457ce0d0ede86cc (patch) | |
tree | cde16dcbf0e148aab4e2fe9ac720d17930f3d55b /contrib | |
parent | Resort conditionals for better specstrip support. (diff) | |
download | rtems-8601881301a321561a1ee3c89457ce0d0ede86cc.tar.bz2 |
Filter constant conditionals.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/crossrpms/specstrip | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/contrib/crossrpms/specstrip b/contrib/crossrpms/specstrip index 31c5ddfa0c..5bb74fe1bb 100755 --- a/contrib/crossrpms/specstrip +++ b/contrib/crossrpms/specstrip @@ -6,7 +6,7 @@ # Usage: specstrip < infile > outfile -# Copyright (C) 2005,2006 Ralf Corsépius, Ulm, Germany, +# Copyright (C) 2005,2006,2010 Ralf Corsépius, Ulm, Germany, # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -166,8 +166,27 @@ foreach (@buffer0) my @buffer3; foreach my $i ( @buffer2 ) { -# print STDERR $i->{state}, $i->{line}, "\n"; + print STDERR $i->{state}, $i->{line}, "\n" if $verbose > 1; if ( $i->{state} =~ m/($ppat)/ ) { + } elsif ( $i->{state} =~ m/.*<"([a-zA-Z_0-9\.\-]+)" (!=|==) "([a-zA-Z_0-9\.\-]+)">.*/ ) { + # Filter out constant conditionals + if ( "$2" eq "==" ) { + if ( "$1" eq "$3" ) { + if ( $i->{line} =~ m/^%(if|else|endif).*$/ ) { + } else { + push @buffer3, $i->{line}, "\n"; + } + } + } elsif ( "$2" eq "!=" ){ + if ( "$1" ne "$3" ) { + if ( $i->{line} =~ m/^%(if|else|endif).*$/ ) { + } else { + push @buffer3, $i->{line}, "\n"; + } + } + } else { + die "invalid condition: $i->{state}"; + } } else { push @buffer3, $i->{line}, "\n" } |