File setup-check-for-rpmbuild.patch of Package quilt.4649

From: Jean Delvare <jdelvare@suse.de>
Subject: setup: Check for rpmbuild availability
References: bnc#873817
Upstream: Committed (bf8bc1cfc097ab7692d2ce41a9933ea3b0d9e5e7)

Before running inspect on a spec file, verify that rpmbuild is
available. Print a user-friendly error message if not.
---
 quilt/setup.in |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -167,6 +167,14 @@ case "$1" in
 *.spec)
 	spec_file=$1
 
+	# check if rpmbuild is installed before running inspect
+	if ! type rpmbuild &> /dev/null
+	then
+		printf $"You have to install '%s' (from package %s) to use 'quilt %s'\n" \
+		       rpmbuild rpm-build setup >&2
+		exit 1
+	fi
+
 	if ! $QUILT_DIR/scripts/inspect $verbose $opt_sourcedir $opt_fuzz \
 					"$spec_file" 2>&1 > $tmpfile
 	then
openSUSE Build Service is sponsored by