NP-VERSION-GEN 915 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. #
  3. # This is from the Git repository (GIT-VERSION-GEN with modifications)
  4. #
  5. SRC_ROOT=`dirname $0`
  6. NPVF=NP-VERSION-FILE
  7. DEF_VER=1.4.13.git
  8. LF='
  9. '
  10. # First see if there is a version file (included in release tarballs),
  11. # then try git-describe, then default.
  12. if test -f $SRC_ROOT/version
  13. then
  14. VN=`cat $SRC_ROOT/version` || VN="$DEF_VER"
  15. elif test -d $SRC_ROOT/.git -o -f $SRC_ROOT/.git &&
  16. VN=`cd $SRC_ROOT; git describe --abbrev=4 HEAD 2>/dev/null` &&
  17. case "$VN" in
  18. *$LF*) (exit 1) ;;
  19. release-[0-9]*)
  20. git update-index -q --refresh
  21. test -z "`git diff-index --name-only HEAD --`" ||
  22. VN="$VN-dirty" ;;
  23. esac
  24. then
  25. VN=`echo "$VN" | sed -e 's/^release-//' | sed -e 's/-/./g'`;
  26. else
  27. VN="$DEF_VER"
  28. fi
  29. VN=`expr "$VN" : v*'\(.*\)'`
  30. if test -r $NPVF
  31. then
  32. VC=`sed -e 's/^NP_VERSION = //' <$NPVF`
  33. else
  34. VC=unset
  35. fi
  36. test "$VN" = "$VC" || {
  37. echo >&2 "NP_VERSION = $VN"
  38. echo "NP_VERSION = $VN" >$NPVF
  39. }