makerelease.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/bin/sh
  2. srcdir="$(dirname "$0")"
  3. [ "$(echo "$srcdir" | cut -c1)" = '/' ] || srcdir="$PWD/$srcdir"
  4. srcdir="$srcdir/.."
  5. die() { echo "$*"; exit 1; }
  6. # Import the makerelease.lib
  7. # http://bues.ch/gitweb?p=misc.git;a=blob_plain;f=makerelease.lib;hb=HEAD
  8. for path in $(echo "$PATH" | tr ':' ' '); do
  9. [ -f "$MAKERELEASE_LIB" ] && break
  10. MAKERELEASE_LIB="$path/makerelease.lib"
  11. done
  12. [ -f "$MAKERELEASE_LIB" ] && . "$MAKERELEASE_LIB" || die "makerelease.lib not found."
  13. hook_get_version()
  14. {
  15. local file="$1/awlsim/common/version.py"
  16. local maj="$(cat "$file" | grep -Ee '^VERSION_MAJOR\s+=\s+' | head -n1 | awk '{print $3;}')"
  17. local min="$(cat "$file" | grep -Ee '^VERSION_MINOR\s+=\s+' | head -n1 | awk '{print $3;}')"
  18. local bug="$(cat "$file" | grep -Ee '^VERSION_BUGFIX\s+=\s+' | head -n1 | awk '{print $3;}')"
  19. local ext="$(cat "$file" | grep -Ee '^VERSION_EXTRA\s+=\s+' | head -n1 | awk '{print $3;}' | cut -d'"' -f2)"
  20. version="${maj}.${min}.${bug}${ext}"
  21. }
  22. hook_post_checkout()
  23. {
  24. info "Pulling in git submodules"
  25. git submodule update --init --recursive
  26. info "Removing version control files"
  27. default_hook_post_checkout "$@"
  28. rm "$1"/maintenance/update-submodules
  29. info "Checking signatures"
  30. for f in "$1"/progs/putty/*/*.gpg; do
  31. gpg --verify "$f" "$(dirname "$f")/$(basename "$f" .gpg)" ||\
  32. die "Signature check failed."
  33. done
  34. info "Unpacking PuTTY"
  35. for f in "$1"/progs/putty/*/*.zip; do
  36. "$SEVENZIP" x -o"$(dirname "$f")/$(basename "$f" .zip)" "$f" ||\
  37. die "Unzip failed"
  38. rm "$f" "$f".gpg ||\
  39. die "Failed to remove archives"
  40. done
  41. }
  42. hook_testbuild()
  43. {
  44. CFLAGS=-O0 CPPFLAGS= CXXFLAGS=-O0 LDFLAGS= \
  45. default_hook_testbuild "$@"
  46. }
  47. hook_regression_tests()
  48. {
  49. default_hook_regression_tests "$@"
  50. # Run selftests
  51. sh "$1/tests/run.sh" -j 0
  52. }
  53. hook_doc_archives()
  54. {
  55. local archive_dir="$1"
  56. local checkout_dir="$2"
  57. local doc_name="$project-doc-$version"
  58. local doc_dir="$tmpdir/$doc_name"
  59. mkdir "$doc_dir" ||\
  60. die "Failed to create directory '$doc_dir'"
  61. (
  62. cd "$checkout_dir" || die "Failed to cd '$checkout_dir'"
  63. rsync --recursive --prune-empty-dirs \
  64. --include='/doc/' \
  65. --include='/doc/**/' \
  66. --include='/doc/**.png' \
  67. --include='/doc/**.jpg' \
  68. --include='/doc/**.jpeg' \
  69. --include='/doc/**.1' \
  70. --include='/doc/**.html' \
  71. --include='/doc/**.htm' \
  72. --include='/doc/**.txt' \
  73. --include='/doc/**/README' \
  74. --include='/*.html' \
  75. --include='/*.htm' \
  76. --include='/*.txt' \
  77. --exclude='*' \
  78. . "$doc_dir" ||\
  79. die "Failed to copy documentation."
  80. cd "$tmpdir" || die "Failed to cd '$tmpdir'"
  81. tar cJf "$archive_dir"/$doc_name.tar.xz \
  82. "$doc_name" ||\
  83. die "Failed to create doc archive."
  84. ) || die
  85. }
  86. export AWLSIM_FULL_BUILD=1
  87. export AWLSIM_CYTHON_BUILD=1
  88. export AWLSIM_CYTHON_PARALLEL=1
  89. project=awlsim
  90. default_archives=py-sdist-xz
  91. makerelease "$@"