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