makerelease.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. srcdir="$(realpath "$0" | xargs dirname)"
  3. srcdir="$srcdir/.."
  4. die() { echo "$*"; exit 1; }
  5. # Import the makerelease.lib
  6. # https://bues.ch/cgit/misc.git/plain/makerelease.lib
  7. for path in $(echo "$PATH" | tr ':' ' '); do
  8. [ -f "$MAKERELEASE_LIB" ] && break
  9. MAKERELEASE_LIB="$path/makerelease.lib"
  10. done
  11. [ -f "$MAKERELEASE_LIB" ] && . "$MAKERELEASE_LIB" || die "makerelease.lib not found."
  12. hook_get_version()
  13. {
  14. local file="$1/libcrcgen/version.py"
  15. local maj="$(cat "$file" | grep -Ee '^VERSION_MAJOR\s+=\s+' | head -n1 | awk '{print $3;}')"
  16. local min="$(cat "$file" | grep -Ee '^VERSION_MINOR\s+=\s+' | head -n1 | awk '{print $3;}')"
  17. local ext="$(cat "$file" | grep -Ee '^VERSION_EXTRA\s+=\s+' | head -n1 | awk '{print $3;}' | cut -d'"' -f2)"
  18. version="${maj}.${min}${ext}"
  19. }
  20. hook_post_checkout()
  21. {
  22. default_hook_post_checkout "$@"
  23. rm -r "$1"/maintenance
  24. }
  25. hook_regression_tests()
  26. {
  27. default_hook_regression_tests "$@"
  28. # Run selftests
  29. python3 "$1/crcgen_test.py"
  30. }
  31. project=crcgen
  32. default_archives=py-sdist-xz
  33. makerelease "$@"