2 # Display bcond_* macros from given spec
11 if [ $SPEC = "--" ]; then
12 if [ "$#" -lt 2 ]; then
13 echo "Usage: rpm --bcond SPEC"
19 if [ ! -f $SPEC ]; then
20 echo "rpm: $SPEC: no such file"
24 bconds=`awk -F"\n" 'BEGIN { chlog=0 }
25 /^%changelog/ { chlog=1 }
26 /bcond_[_a-z0-9]+/ && chlog == 0 {
27 match($0, /bcond_[_a-z0-9]+/);
28 print substr($0, RSTART, RLENGTH)
34 if ! echo `rpm --eval "%$c"` | grep $c >/dev/null; then
42 for bcond in $bconds; do
43 isset=`awk -F"\n" "BEGIN { val=0 }
44 /^%define[\t ]+$bcond/ {
45 if (match(\\$0, /$bcond[\t ]+0[\t ]*$/)) {
47 } else if (match(\\$0, /$bcond[\t ]+1[\t ]*$/)) {
50 print \"couldn't determine $bcond value from \", \\$0
52 } END { print val }" $SPEC`;
54 if [ $isset -eq 1 ]; then
55 echo "WARN: $bcond defined in spec";