makerelease.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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/crcgen/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 ext="$(cat "$file" | grep -Ee '^VERSION_EXTRA\s+=\s+' | head -n1 | awk '{print $3;}' | cut -d'"' -f2)"
  19. version="${maj}.${min}${ext}"
  20. }
  21. hook_post_checkout()
  22. {
  23. default_hook_post_checkout "$@"
  24. rm -r "$1"/maintenance
  25. }
  26. hook_regression_tests()
  27. {
  28. default_hook_regression_tests "$@"
  29. # Run selftests
  30. python3 "$1/crcgen_test.py"
  31. }
  32. project=crcgen
  33. default_archives=py-sdist-xz
  34. makerelease "$@"