You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.6 KiB

  1. #!/bin/sh -e
  2. die() {
  3. echo "$@" >&2
  4. exit 1
  5. }
  6. package_info_load_name() {
  7. grep AC_INIT configure.ac | perl -ne 's/^.+\(\[([-\w]*)\],.+$/$1/ and print'
  8. }
  9. package_info_load_version() {
  10. grep AC_INIT configure.ac | perl -ne 's/^.+\[([-\w\.]*)\],$/$1/ and print'
  11. }
  12. package_info_load() {
  13. [ -f "configure.ac" ] || \
  14. die "package_info_load: configure.ac is missing"
  15. PACKAGE_NAME="$(package_info_load_name)"
  16. # todo: fix this
  17. PACKAGE_TARNAME="${PACKAGE_NAME}"
  18. PACKAGE_VERSION="$(package_info_load_version)"
  19. [ "${PACKAGE_NAME}" -a "${PACKAGE_VERSION}" ] || \
  20. die "package information is missing from configure script"
  21. PACKAGE_VERSION_TAGS=
  22. [ "${PACKAGE_VERSION/-/}" = "${PACKAGE_VERSION}" ] || \
  23. PACKAGE_VERSION_TAGS="-${PACKAGE_VERSION#*-}"
  24. PACKAGE_VERSION_BASE="${PACKAGE_VERSION%%-*}"
  25. PACKAGE_MICRO="${PACKAGE_VERSION_BASE##*.}"
  26. PACKAGE_MAJOR_AND_MINOR="${PACKAGE_VERSION_BASE%.*}"
  27. PACKAGE_MAJOR="${PACKAGE_MAJOR_AND_MINOR%.*}"
  28. PACKAGE_MINOR="${PACKAGE_MAJOR_AND_MINOR#*.}"
  29. [ "${RELEASE_FINAL}" ] \
  30. && RELEASE_VERSION="${PACKAGE_VERSION_BASE}" \
  31. || RELEASE_VERSION="${PACKAGE_VERSION/-dev/}"
  32. PACKAGE_RELEASE="${PACKAGE_TARNAME}-${RELEASE_VERSION}"
  33. PACKAGE_STRING="${PACKAGE_NAME} ${PACKAGE_VERSION}"
  34. }
  35. package_info_show() {
  36. cat <<INFO
  37. Name: ${PACKAGE_TARNAME}
  38. Version: ${PACKAGE_VERSION}
  39. Release: ${RELEASE_VERSION}
  40. Number: ${PACKAGE_VERSION_BASE}
  41. Series: ${PACKAGE_MAJOR_AND_MINOR}
  42. Major: ${PACKAGE_MAJOR}
  43. Minor: ${PACKAGE_MINOR}
  44. Micro: ${PACKAGE_MICRO}
  45. Tags: ${PACKAGE_VERSION_TAGS}
  46. Full: ${PACKAGE_TARNAME}-${PACKAGE_VERSION_BASE}${PACKAGE_VERSION_TAGS}
  47. Release: ${PACKAGE_RELEASE}
  48. Type: ${RELEASE_TYPE}
  49. INFO
  50. }