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