2013-05-08 22:55:44 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# $1 - version string
|
|
|
|
# options:
|
2013-05-12 09:51:56 +00:00
|
|
|
# -c colored grep (implies -d)
|
2013-05-08 22:55:44 +00:00
|
|
|
# -d debug
|
|
|
|
# -r release (exit status error; when called from Makefile)
|
|
|
|
|
2013-05-12 09:51:56 +00:00
|
|
|
# To validate relevant files are up to date, you would run the script
|
|
|
|
# from command line before tagging:
|
|
|
|
#
|
|
|
|
# $ scripts/check-version -cr <tag>
|
|
|
|
|
2013-05-08 22:55:44 +00:00
|
|
|
set -eu
|
|
|
|
#set -x
|
|
|
|
|
2013-05-12 09:51:56 +00:00
|
|
|
# You would typically add/remove files to/from the list
|
2013-05-08 22:55:44 +00:00
|
|
|
files="Documentation/user-manual.txt Makefile README ReleaseNotes.txt"
|
|
|
|
|
|
|
|
whine() {
|
|
|
|
echo "$0: $*" >&2
|
|
|
|
}
|
|
|
|
|
|
|
|
croak() {
|
|
|
|
whine "$*"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
color=n
|
|
|
|
debug=n
|
|
|
|
release=n
|
|
|
|
while getopts cdr opt; do
|
|
|
|
case $opt in
|
|
|
|
c)
|
|
|
|
color=y
|
2013-05-12 09:49:21 +00:00
|
|
|
debug=y
|
2013-05-08 22:55:44 +00:00
|
|
|
;;
|
|
|
|
d)
|
|
|
|
debug=y
|
|
|
|
;;
|
|
|
|
r)
|
|
|
|
release=y
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
croak "invalid option"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
|
|
|
if [ $debug = y ]; then
|
|
|
|
opts=-n
|
|
|
|
else
|
|
|
|
opts=-q
|
|
|
|
fi
|
2013-05-12 09:47:47 +00:00
|
|
|
[ $color = n ] || opts="${opts:+$opts }--color"
|
2013-05-08 22:55:44 +00:00
|
|
|
|
|
|
|
v=${1:-}
|
2013-05-12 09:51:56 +00:00
|
|
|
v=${v#v}
|
2013-05-08 22:55:44 +00:00
|
|
|
case $v in
|
|
|
|
*-*)
|
|
|
|
# Ignore development versions
|
|
|
|
if [ $release = y ]; then
|
|
|
|
croak "'$v' not a release tag"
|
|
|
|
else
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
''|*[!.0-9]*)
|
|
|
|
croak "invalid version string '$v'"
|
|
|
|
;;
|
|
|
|
esac
|
2013-05-12 09:51:56 +00:00
|
|
|
whine "checking for version $v"
|
2013-05-08 22:55:44 +00:00
|
|
|
|
2013-05-12 09:50:00 +00:00
|
|
|
saveIFS=$IFS
|
|
|
|
IFS=.
|
|
|
|
set -- $v
|
|
|
|
IFS=$saveIFS
|
|
|
|
v=
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
v=${v:+$v\\.}$1
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2013-05-08 22:55:44 +00:00
|
|
|
sts=0
|
|
|
|
for f in $files; do
|
2013-05-12 09:51:14 +00:00
|
|
|
grep -EH $opts \
|
|
|
|
-e "(VERSION=|[Ss]ubsurface[[:blank:]]+)?\<v?$v[.0-9]*\>" \
|
|
|
|
$f || {
|
2013-05-12 09:48:35 +00:00
|
|
|
[ $release != y ] || sts=1
|
|
|
|
whine "'$f' may need updating"
|
2013-05-08 22:55:44 +00:00
|
|
|
}
|
|
|
|
done
|
2013-05-12 09:48:35 +00:00
|
|
|
|
|
|
|
exit $sts
|