+specdump() {
+ local a
+ while [ $# -gt 0 ]; do
+ case "$1" in
+ --target|--with|--without)
+ a="$a $1 $2"
+ shift
+ ;;
+ --define)
+ a="$a $1 \"$2\""
+ shift
+ ;;
+ -*)
+ ;;
+ *)
+ a="$a $1"
+ ;;
+ esac
+ shift
+ done
+ set -x
+ eval rpm-specdump $a || echo >&2 $?
+}
+
+if [ $# = 0 ]; then
+ # if no spec name passed, glob *.spec
+ set -- *.spec
+ if [ ! -f "$1" -o $# -gt 1 ]; then
+ echo >&2 "ERROR: Too many or too few .spec files found"
+ echo >&2 "Usage: ${0##*/} PACKAGE.spec"
+ exit 1
+ fi
+else
+ # $1 must be spec, ensure it has .spec ext
+ spec=$1; shift
+ set -- ${spec%.spec}.spec "$@"
+fi