zfsonlinux/zfs-debian-pve/patches/0002-Check-for-META-and-DCH-consistency-in-autoconf.patch

71 lines
2.9 KiB
Diff
Raw Normal View History

2015-01-10 17:51:28 +03:00
From: Darik Horn <dajhorn@vanadac.com>
Date: Sat, 18 Oct 2014 14:23:11 -0500
Subject: Check for META and DCH consistency in autoconf.
If a debian/ packaging overlay exists, then the software versions defined in
the META and debian/changelog files must be the same to ensure that DKMS uses
correct paths and that users see the same version everywhere.
---
config/zfs-meta.m4 | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4
index 7c92dd5..d174ccc 100644
--- a/config/zfs-meta.m4
+++ b/config/zfs-meta.m4
@@ -1,9 +1,10 @@
dnl #
dnl # DESCRIPTION:
-dnl # Read meta data from the META file. When building from a git repository
-dnl # the ZFS_META_RELEASE field will be overwritten if there is an annotated
-dnl # tag matching the form ZFS_META_NAME-ZFS_META_VERSION-*. This allows
-dnl # for working builds to be uniquely identified using the git commit hash.
+dnl # Read meta data from the META file or the debian/changelog file if it
+dnl # exists. When building from a git repository the ZFS_META_RELEASE field
+dnl # will be overwritten if there is an annotated tag matching the form
+dnl # ZFS_META_NAME-ZFS_META_VERSION-*. This allows for working builds to be
+dnl # uniquely identified using the git commit hash.
dnl #
dnl # The META file format is as follows:
dnl # ^[ ]*KEY:[ \t]+VALUE$
@@ -49,6 +50,7 @@ AC_DEFUN([ZFS_AC_META], [
_zfs_ac_meta_type="none"
if test -f "$META"; then
_zfs_ac_meta_type="META file"
+ _dpkg_parsechangelog=$(dpkg-parsechangelog 2>/dev/null)
ZFS_META_NAME=_ZFS_AC_META_GETVAL([(Name|Project|Package)]);
if test -n "$ZFS_META_NAME"; then
@@ -66,8 +68,30 @@ AC_DEFUN([ZFS_AC_META], [
AC_SUBST([ZFS_META_VERSION])
fi
+ if test -n "${_dpkg_parsechangelog}"; then
+ _dpkg_version=$(echo "${_dpkg_parsechangelog}" \
+ | $AWK '$[]1 == "Version:" { print $[]2; }' \
+ | cut -d- -f1)
+ if test "${_dpkg_version}" != "$ZFS_META_VERSION"; then
+ AC_MSG_ERROR([
+ *** Version $ZFS_META_VERSION in the META file is different than
+ *** version $_dpkg_version in the debian/changelog file. DKMS and DEB
+ *** packaging require that these files have the same version.
+ ])
+ fi
+ fi
+
ZFS_META_RELEASE=_ZFS_AC_META_GETVAL([Release]);
- if test ! -f ".nogitrelease" && git rev-parse --git-dir > /dev/null 2>&1; then
+
+ if test -n "${_dpkg_parsechangelog}"; then
+ _dpkg_release=$(echo "${_dpkg_parsechangelog}" \
+ | $AWK '$[]1 == "Version:" { print $[]2; }' \
+ | cut -d- -f2-)
+ if test -n "${_dpkg_release}"; then
+ ZFS_META_RELEASE=${_dpkg_release}
+ _zfs_ac_meta_type="dpkg-parsechangelog"
+ fi
+ elif test ! -f ".nogitrelease" && git rev-parse --git-dir > /dev/null 2>&1; then
_match="${ZFS_META_NAME}-${ZFS_META_VERSION}"
_alias=$(git describe --match=${_match} 2>/dev/null)
_release=$(echo ${_alias}|cut -f3- -d'-'|sed 's/-/_/g')