diff mbox series

[ndctl] build: Automate rpmbuild.sh

Message ID 164567050589.2266739.68846452427328787.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit 55f36387ee8a88c489863103347ae275b1bc9191
Headers show
Series [ndctl] build: Automate rpmbuild.sh | expand

Commit Message

Dan Williams Feb. 24, 2022, 2:41 a.m. UTC
Prior to the meson conversion rpmbuild.sh with no arguments would find a
pre-created ndctl.spec file relative to the script. Restore that
behavior by looking for the script in the build/ directory, and try to
create it if not there.

Yes, this fails if someone picks a directory other than build/ for the
output directory, but build/ is conventional.

Another regression from autotools is the loss of support for building
"dirty" rpms i.e. rpms from git source trees with uncommitted changes.
At least provide a coherent error message for that case.

Reported-by: Jane Chu <jane.chu@oracle.com>
Reported-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 rpmbuild.sh |    9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/rpmbuild.sh b/rpmbuild.sh
index b1f4d9e5c0f3..d9823e5eda61 100755
--- a/rpmbuild.sh
+++ b/rpmbuild.sh
@@ -4,6 +4,15 @@  spec=${1:-$(dirname $0)/rhel/ndctl.spec)}
 
 pushd $(dirname $0) >/dev/null
 [ ! -d ~/rpmbuild/SOURCES ] && echo "rpmdev tree not found" && exit 1
+if ./git-version | grep -q dirty; then
+	echo "Uncommitted changes detected, commit or undo them to proceed"
+	git status -uno --short
+	exit 1
+fi
+if [ ! -f $spec ]; then
+	meson compile -C build rhel/ndctl.spec
+	spec=$(dirname $0)/build/rhel/ndctl.spec
+fi
 ./make-git-snapshot.sh
 popd > /dev/null
 rpmbuild --nocheck -ba $spec