anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

Blame 0141-build-Automate-rpmbuild.sh.patch

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