[OS-BUILD PATCHv5 8/18] redhat/Makefile: add dist-assert-tree-clean target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat/Makefile: add dist-assert-tree-clean target

Add dist-assert-tree-clean target that fails whenever staged/unstaged
changes or untracked files are present in the git tree.

Manual invocation of this target is not expected, thus left out of
dist-help. It's intended to act as a guard against any temporary changes
prior to running tooling that could change or revert them.

No checks are performed whenever $FORCE is non-empty.

Signed-off-by: Čestmír Kalina <ckalina@xxxxxxxxxx>
Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -331,6 +331,25 @@ dist-kabi-dup: dist-python-check
 		fi \
 	done;
 
+dist-assert-tree-clean:
+ifeq ($(FORCE),)
+	@if ! git diff-index --quiet --cached HEAD -- &> /dev/null; then \
+		echo "ERROR: staged changes found. Please clean the git tree."; >&2 \
+		git status; \
+		exit 1; \
+	fi
+	@if ! git diff-files --quiet &> /dev/null; then \
+		echo "ERROR: unstaged changes found. Please clean the git tree." >&2; \
+		git status; \
+		exit 1; \
+	fi
+	@if [ $$(git ls-files --exclude-standard --others | wc -l) -gt 0 ]; then \
+		echo "ERROR: untracked files found. Please clean the git tree." >&2; \
+		git status; \
+		exit 1; \
+	fi
+endif
+
 dist-check-kabi: dist-kabi
 	@if [ ! -e $(_OUTPUT)/Module.symvers ]; then \
 		echo "ERROR: You must compile the kernel and modules first";\

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2021
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux