PageRenderTime 50ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/scripts/bump_version.sh

https://github.com/leg0/polarssl
Shell | 81 lines | 67 code | 7 blank | 7 comment | 7 complexity | 8c83d917f6ec1e4d2a32fbdcb6ca9bcd MD5 | raw file
Possible License(s): GPL-2.0
  1. #!/bin/bash
  2. VERSION=""
  3. SOVERSION=""
  4. # Parse arguments
  5. #
  6. until [ -z "$1" ]
  7. do
  8. case "$1" in
  9. --version)
  10. # Version to use
  11. shift
  12. VERSION=$1
  13. ;;
  14. --soversion)
  15. shift
  16. SOVERSION=$1
  17. ;;
  18. -v|--verbose)
  19. # Be verbose
  20. VERBOSE="1"
  21. ;;
  22. -h|--help)
  23. # print help
  24. echo "Usage: $0"
  25. echo -e " -h|--help\t\t\tPrint this help."
  26. echo -e " --version <version>\tVersion to bump to."
  27. echo -e " -v|--verbose\t\tVerbose."
  28. exit 1
  29. ;;
  30. *)
  31. # print error
  32. echo "Unknown argument: '$1'"
  33. exit 1
  34. ;;
  35. esac
  36. shift
  37. done
  38. if [ "X" = "X$VERSION" ];
  39. then
  40. echo "No version specified. Unable to continue."
  41. exit 1
  42. fi
  43. [ $VERBOSE ] && echo "Bumping VERSION in library/CMakeLists.txt"
  44. sed -e "s/ VERSION [0-9.]\+/ VERSION $VERSION/g" < library/CMakeLists.txt > tmp
  45. mv tmp library/CMakeLists.txt
  46. if [ "X" != "X$SOVERSION" ];
  47. then
  48. [ $VERBOSE ] && echo "Bumping SOVERSION in library/CMakeLists.txt"
  49. sed -e "s/ SOVERSION [0-9]\+/ SOVERSION $SOVERSION/g" < library/CMakeLists.txt > tmp
  50. mv tmp library/CMakeLists.txt
  51. fi
  52. [ $VERBOSE ] && echo "Bumping VERSION in include/polarssl/version.h"
  53. read MAJOR MINOR PATCH <<<$(IFS="."; echo $VERSION)
  54. VERSION_NR="$( printf "0x%02X%02X%02X00" $MAJOR $MINOR $PATCH )"
  55. cat include/polarssl/version.h | \
  56. sed -e "s/_VERSION_MAJOR .\+/_VERSION_MAJOR $MAJOR/" | \
  57. sed -e "s/_VERSION_MINOR .\+/_VERSION_MINOR $MINOR/" | \
  58. sed -e "s/_VERSION_PATCH .\+/_VERSION_PATCH $PATCH/" | \
  59. sed -e "s/_VERSION_NUMBER .\+/_VERSION_NUMBER $VERSION_NR/" | \
  60. sed -e "s/_VERSION_STRING .\+/_VERSION_STRING \"$VERSION\"/" | \
  61. sed -e "s/_VERSION_STRING_FULL .\+/_VERSION_STRING_FULL \"PolarSSL $VERSION\"/" \
  62. > tmp
  63. mv tmp include/polarssl/version.h
  64. [ $VERBOSE ] && echo "Bumping version in tests/suites/test_suite_version.data"
  65. sed -e "s/version:\".\+/version:\"$VERSION\"/g" < tests/suites/test_suite_version.data > tmp
  66. mv tmp tests/suites/test_suite_version.data
  67. [ $VERBOSE ] && echo "Bumping PROJECT_NAME in doxygen/polarssl.doxyfile and doxygen/input/doc_mainpage.h"
  68. for i in doxygen/polarssl.doxyfile doxygen/input/doc_mainpage.h;
  69. do
  70. sed -e "s/PolarSSL v[0-9\.]\+/PolarSSL v$VERSION/g" < $i > tmp
  71. mv tmp $i
  72. done