summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2021-05-24 11:50:15 -0700
committerAndrew G. Morgan <morgan@kernel.org>2021-05-24 11:50:15 -0700
commit91455fd109f276f6aab095c08af1cba2c1f7b47c (patch)
tree1ae0f8e67706729e298ab437697065b392e97779
parent2f9b7f484c035316dc0d77af9422aef7f2764b6c (diff)
downloadlibcap2-91455fd109f276f6aab095c08af1cba2c1f7b47c.tar.gz
Add a handy update script for the various go.mod files.
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
-rw-r--r--Makefile2
-rwxr-xr-xgomods.sh11
2 files changed, 12 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 587363a..4bdc43e 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ clean-here:
distclean: clean
$(DISTCLEAN)
@echo "CONFIRM Go package cap has right version dependency on cap/psx:"
- for x in $$(find . -name go.mod); do grep -F -v "module" $$x | fgrep "kernel.org/pub/linux/libs/security/libcap" > /dev/null || continue ; grep -F "v$(GOMAJOR).$(VERSION).$(MINOR)" $$x > /dev/null && continue ; echo "$$x is not updated to v$(GOMAJOR).$(VERSION).$(MINOR)" ; exit 1 ; done
+ for x in $$(find . -name go.mod); do grep -F -v "module" $$x | fgrep "kernel.org/pub/linux/libs/security/libcap" > /dev/null || continue ; grep -F "v$(GOMAJOR).$(VERSION).$(MINOR)" $$x > /dev/null && continue ; echo "$$x is not updated. Try running: ./gomods.sh v$(GOMAJOR).$(VERSION).$(MINOR)" ; exit 1 ; done
@echo "ALL go.mod files updated"
@echo "Now validate that everything is checked in to a clean tree.."
test -z "$$(git status --ignored -s)"
diff --git a/gomods.sh b/gomods.sh
new file mode 100755
index 0000000..890cccd
--- /dev/null
+++ b/gomods.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+version="${1}"
+if [[ -z "${version}" ]]; then
+ echo "usage: supply a cap/psx module version to target"
+ exit 1
+fi
+
+for x in $(find . -name 'go.mod'); do
+ sed -i -e 's@kernel.org/\([^ ]*\) v.*$@kernel.org/\1 '"${version}@" "${x}"
+done