set -e
+skip_dep_generators() {
+ local dep
+ for dep in \
+ font \
+ gstreamer \
+ java \
+ kernel \
+ libtool \
+ mimetype \
+ mono \
+ perl \
+ php \
+ pkgconfig \
+ python \
+ ruby \
+ ; do
+ printf "--define __%s_provides%%{nil}\n" $dep
+ printf "--define __%s_requires%%{nil}\n" $dep
+ done
+}
+
rpmbuild() {
# preprocess args, we must have --target as first arg to rpmbuild
# we need to grab also dir where spec resides
--define '_binary_payload w5.gzdio' \
--define '__spec_install_pre %___build_pre' \
--define '__spec_clean_body %{nil}' \
+ --define '_enable_debug_packages 0' \
+ ${bb+$(skip_dep_generators)} \
+ ${bb+--define '%py_postclean(-x:) %{nil}'} \
$a || exit
}
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
+
tmp=$(specdump "$@" | awk '$2 == "_target_cpu" {print $3}')
if [ "$tmp" ]; then
TARGET="$tmp"
fi
-# just create the rpm's if -bb is somewhere in the args
-if [[ *$@* != *-bb* ]]; then
- rpmbuild -bi "$@"
+# skip -bi if -bb is somewhere in the args
+if [[ *$@* = *-bb* ]]; then
+ bb=
+else
+ bb= rpmbuild -bi "$@"
+ unset bb
fi
rpmbuild -bb "$@"