0001-Check-for-META-and-DCH-consistency-in-autoconf.patch 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Debian ZFS on Linux maintainers
  3. <[email protected]>
  4. Date: Wed, 30 Jan 2019 15:12:04 +0100
  5. Subject: [PATCH] Check-for-META-and-DCH-consistency-in-autoconf
  6. Signed-off-by: Thomas Lamprecht <[email protected]>
  7. ---
  8. config/zfs-meta.m4 | 34 +++++++++++++++++++++++++++++-----
  9. 1 file changed, 29 insertions(+), 5 deletions(-)
  10. diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4
  11. index 20064a0fb..4d5f545ad 100644
  12. --- a/config/zfs-meta.m4
  13. +++ b/config/zfs-meta.m4
  14. @@ -1,9 +1,10 @@
  15. dnl #
  16. dnl # DESCRIPTION:
  17. -dnl # Read meta data from the META file. When building from a git repository
  18. -dnl # the ZFS_META_RELEASE field will be overwritten if there is an annotated
  19. -dnl # tag matching the form ZFS_META_NAME-ZFS_META_VERSION-*. This allows
  20. -dnl # for working builds to be uniquely identified using the git commit hash.
  21. +dnl # Read meta data from the META file or the debian/changelog file if it
  22. +dnl # exists. When building from a git repository the ZFS_META_RELEASE field
  23. +dnl # will be overwritten if there is an annotated tag matching the form
  24. +dnl # ZFS_META_NAME-ZFS_META_VERSION-*. This allows for working builds to be
  25. +dnl # uniquely identified using the git commit hash.
  26. dnl #
  27. dnl # The META file format is as follows:
  28. dnl # ^[ ]*KEY:[ \t]+VALUE$
  29. @@ -49,6 +50,7 @@ AC_DEFUN([ZFS_AC_META], [
  30. _zfs_ac_meta_type="none"
  31. if test -f "$META"; then
  32. _zfs_ac_meta_type="META file"
  33. + _dpkg_parsechangelog=$(dpkg-parsechangelog 2>/dev/null)
  34. ZFS_META_NAME=_ZFS_AC_META_GETVAL([(Name|Project|Package)]);
  35. if test -n "$ZFS_META_NAME"; then
  36. @@ -69,8 +71,30 @@ AC_DEFUN([ZFS_AC_META], [
  37. AC_SUBST([ZFS_META_VERSION])
  38. fi
  39. + if test -n "${_dpkg_parsechangelog}"; then
  40. + _dpkg_version=$(echo "${_dpkg_parsechangelog}" \
  41. + | $AWK '$[]1 == "Version:" { print $[]2; }' \
  42. + | cut -d- -f1)
  43. + if test "${_dpkg_version}" != "$ZFS_META_VERSION"; then
  44. + AC_MSG_ERROR([
  45. + *** Version $ZFS_META_VERSION in the META file is different than
  46. + *** version $_dpkg_version in the debian/changelog file. DKMS and DEB
  47. + *** packaging require that these files have the same version.
  48. + ])
  49. + fi
  50. + fi
  51. +
  52. ZFS_META_RELEASE=_ZFS_AC_META_GETVAL([Release]);
  53. - if test ! -f ".nogitrelease" && git rev-parse --git-dir > /dev/null 2>&1; then
  54. +
  55. + if test -n "${_dpkg_parsechangelog}"; then
  56. + _dpkg_release=$(echo "${_dpkg_parsechangelog}" \
  57. + | $AWK '$[]1 == "Version:" { print $[]2; }' \
  58. + | cut -d- -f2-)
  59. + if test -n "${_dpkg_release}"; then
  60. + ZFS_META_RELEASE=${_dpkg_release}
  61. + _zfs_ac_meta_type="dpkg-parsechangelog"
  62. + fi
  63. + elif test ! -f ".nogitrelease" && git rev-parse --git-dir > /dev/null 2>&1; then
  64. _match="${ZFS_META_NAME}-${ZFS_META_VERSION}"
  65. _alias=$(git describe --match=${_match} 2>/dev/null)
  66. _release=$(echo ${_alias}|sed "s/${ZFS_META_NAME}//"|cut -f3- -d'-'|tr - _)