anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone
e0018b
From 55f36387ee8a88c489863103347ae275b1bc9191 Mon Sep 17 00:00:00 2001
e0018b
From: Dan Williams <dan.j.williams@intel.com>
e0018b
Date: Wed, 23 Feb 2022 18:41:45 -0800
e0018b
Subject: [PATCH 141/217] build: Automate rpmbuild.sh
e0018b
e0018b
Prior to the meson conversion rpmbuild.sh with no arguments would find a
e0018b
pre-created ndctl.spec file relative to the script. Restore that
e0018b
behavior by looking for the script in the build/ directory, and try to
e0018b
create it if not there.
e0018b
e0018b
Yes, this fails if someone picks a directory other than build/ for the
e0018b
output directory, but build/ is conventional.
e0018b
e0018b
Another regression from autotools is the loss of support for building
e0018b
"dirty" rpms i.e. rpms from git source trees with uncommitted changes.
e0018b
At least provide a coherent error message for that case.
e0018b
e0018b
Link: https://lore.kernel.org/r/164567050589.2266739.68846452427328787.stgit@dwillia2-desk3.amr.corp.intel.com
e0018b
Reported-by: Jane Chu <jane.chu@oracle.com>
e0018b
Reported-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
e0018b
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
---
e0018b
 rpmbuild.sh | 9 +++++++++
e0018b
 1 file changed, 9 insertions(+)
e0018b
e0018b
diff --git a/rpmbuild.sh b/rpmbuild.sh
e0018b
index b1f4d9e..d9823e5 100755
e0018b
--- a/rpmbuild.sh
e0018b
+++ b/rpmbuild.sh
e0018b
@@ -4,6 +4,15 @@ spec=${1:-$(dirname $0)/rhel/ndctl.spec)}
e0018b
 
e0018b
 pushd $(dirname $0) >/dev/null
e0018b
 [ ! -d ~/rpmbuild/SOURCES ] && echo "rpmdev tree not found" && exit 1
e0018b
+if ./git-version | grep -q dirty; then
e0018b
+	echo "Uncommitted changes detected, commit or undo them to proceed"
e0018b
+	git status -uno --short
e0018b
+	exit 1
e0018b
+fi
e0018b
+if [ ! -f $spec ]; then
e0018b
+	meson compile -C build rhel/ndctl.spec
e0018b
+	spec=$(dirname $0)/build/rhel/ndctl.spec
e0018b
+fi
e0018b
 ./make-git-snapshot.sh
e0018b
 popd > /dev/null
e0018b
 rpmbuild --nocheck -ba $spec
e0018b
-- 
e0018b
2.27.0
e0018b