Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.04 KB | None | 0 0
  1. diff --git a/tools/.gitattributes b/tools/.gitattributes
  2. new file mode 100644
  3. index 0000000..0196216
  4. --- /dev/null
  5. +++ b/tools/.gitattributes
  6. @@ -0,0 +1 @@
  7. +create_version_h.sh export-subst
  8. diff --git a/tools/create_version_h.sh b/tools/create_version_h.sh
  9. index 83b33d6..548715e 100755
  10. --- a/tools/create_version_h.sh
  11. +++ b/tools/create_version_h.sh
  12. @@ -6,7 +6,12 @@ H_FILE=$1
  13.  
  14.  VERSION_H_NEEDS_UPDATE=1
  15.  
  16. -NEW_VERSION=`git describe --tags HEAD | sed 's,^release-,,;s,-,+,;s,-,~,;'`
  17. +NEW_VERSION=`git describe --tags --dirty | sed 's,^release-,,;s,-,+,;s,-,~,;'`
  18. +
  19. +# if we are not in a git checkout, NEW_VERSION is empty
  20. +if [ -z "${NEW_VERSION}" ]; then
  21. +   NEW_VERSION="a $NEW_VERSION a archive-$Format:%H"
  22. +fi
  23.  
  24.  # version.h exists => check if it containts the up-to-date version
  25.  if [ -f ${H_FILE} ]; then
  26. @@ -17,5 +22,5 @@ if [ -f ${H_FILE} ]; then
  27.  fi
  28.  
  29.  if [ $VERSION_H_NEEDS_UPDATE -eq 1 ]; then
  30. -  echo "#define PACKAGE_VERSION \"${NEW_VERSION}\"" > ${H_FILE}
  31. +  echo "#define PACKAGE_VERSION \"${NEW_VERSION}\"" >> ${H_FILE}
  32.  fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement