X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm.git;a=blobdiff_plain;f=rpm-find-spec-bcond;h=200e1b407d3b3b68c047817b916ff24bd8ee652a;hp=56466e9ad4636cee73a1674886a5080244f24940;hb=595ba5b7643e1b6e00c71c91c9e9492ba078737f;hpb=867baf24ff8dd55ee3742ffe9952362f074e5326 diff --git a/rpm-find-spec-bcond b/rpm-find-spec-bcond index 56466e9..200e1b4 100644 --- a/rpm-find-spec-bcond +++ b/rpm-find-spec-bcond @@ -1,5 +1,5 @@ #!/bin/sh -# Display bcond_* macros from given spec +# Display bcond (_with_*, _without_*) macros from given spec # $Id$ if [ "$#" = 0 ]; then @@ -21,10 +21,18 @@ if [ ! -f $SPEC ]; then exit 1 fi -bconds=`awk -F"\n" '/bcond_[_a-z0-9]+/ { - match($0, /bcond_[_a-z0-9]+/); - print substr($0, RSTART, RLENGTH) - }' $SPEC | sort -u` +bconds=`awk -F"\n" 'BEGIN { chlog=0 } + /^%changelog/ { chlog=1 } + /_with(out)?_[_a-zA-Z0-9]+/ && chlog == 0 { + match($0, /_with(out)?_[_a-zA-Z0-9]+/); + print substr($0, RSTART, RLENGTH) + } + /^%bcond_with/ && chlog == 0 { + match($0, /bcond_with(out)?[ \t]+[_a-zA-Z0-9]+/); + bcond = substr($0, RSTART +5 , RLENGTH -5); + gsub(/[ \t]+/,"_",bcond); + print bcond + }' $SPEC | sort -u` for c in $bconds; do echo -n "$c" @@ -45,11 +53,11 @@ for bcond in $bconds; do } else if (match(\\$0, /$bcond[\t ]+1[\t ]*$/)) { val = 1 } else { - print \"could determine $bcond value from \", \\$0 + print \"couldn't determine $bcond value from \", \\$0 } } END { print val }" $SPEC`; - if [ $isset -eq 1 ]; then + if [ x"$isset" = x"1" ]; then echo "WARN: $bcond defined in spec"; fi done