summaryrefslogtreecommitdiff
path: root/scripts/gversion.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gversion.in')
-rw-r--r--scripts/gversion.in21
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/gversion.in b/scripts/gversion.in
index 8609f54..c60a024 100644
--- a/scripts/gversion.in
+++ b/scripts/gversion.in
@@ -36,14 +36,22 @@ if [ "$#" -gt 3 ] ; then
fi
root="@PKGROOT@"
-gutenprint_version=@VERSION@
+gutenprint_version=gutenprint-@VERSION@
+gutenprint_base=gutenprint-@GUTENPRINT_BASE_VERSION@
+gutenprint_release=gutenprint-@GUTENPRINT_RELEASE_VERSION@
if [ -z "$3" ] ; then
if [ -d "$root/.git" ] ; then
- git describe --dirty --always --first-parent 2>/dev/null | sed 's/^[^0-9]*-//' > "$root/git-version-stamp"
+ tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "${gutenprint_version//./_}*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "${gutenprint_base//./_}*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "${gutenprint_release//./_}*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "gutenprint*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --always --first-parent 2>/dev/null)
+ echo $tag | sed 's/^[^0-9]*-//' > "$root/git-version-stamp"
fi
if [ -f "$root/git-version-stamp" ] ; then
+ # shellcheck disable=SC2006
description=`cat "$root/git-version-stamp"`
else
description='(unknown)'
@@ -59,7 +67,8 @@ if [ -z "$description" ] ; then
fi
xed() {
- if [[ -n "$PREFIX" ]] ; then
+ if [ -n "$PREFIX" ] ; then
+ # shellcheck disable=SC1117
sed -e h -e "s/$/ $PREFIX => /" -e x -e 's/^[^0-9]*-//' "$@" -e H -e x -e "s/\n//"
else
sed -e 's/^[^0-9]*-//' "$@"
@@ -164,9 +173,9 @@ doit() {
}
case "$description" in
- -) doit $1 ;;
- --) PREFIX="$1" doit $1 ;;
- *) doit $1 <<< $description
+ -) doit "$1" ;;
+ --) PREFIX="$1" doit "$1" ;;
+ *) echo "$description" | doit "$1" ;;
esac
exit 0