File: 1002-Check-for-META-and-DCH-consistency-in-autoconf.patch

package info (click to toggle)
zfs-linux 2.3.2-2
  • links: PTS, VCS
  • area: contrib
  • in suites: sid, trixie
  • size: 71,496 kB
  • sloc: ansic: 392,648; sh: 67,208; asm: 47,693; python: 8,160; makefile: 5,100; perl: 839; sed: 41
file content (59 lines) | stat: -rw-r--r-- 2,504 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Description: check for META and dch consistency in autoconf
Forwarded: not-needed
--- 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 @@
 	_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
@@ -69,8 +71,30 @@
 			AC_SUBST([ZFS_META_VERSION])
 		fi
 
+		if test -n "${_dpkg_parsechangelog}"; then
+			_dpkg_full_version=$(echo "${_dpkg_parsechangelog}" \
+				| $AWK '$[]1 == "Version:" { print $[]2; }')
+			_dpkg_version=${_dpkg_full_version%-*}
+			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_full_version=$(echo "${_dpkg_parsechangelog}" \
+				| $AWK '$[]1 == "Version:" { print $[]2; }')
+			_dpkg_release=${_dpkg_full_version##*-}
+			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}|sed "s/${ZFS_META_NAME}//"|cut -f3- -d'-'|tr - _)