--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 801-implement-dbg-checks.dpatch by Eero Häkkinen <eero.hakkinen@nokia.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Require <package>-dbg=<version> to declare dependency on
+## DP: <package>=<version>.
+
+@DPATCH@
+diff -urNad lintian~/checks/control-file lintian/checks/control-file
+--- lintian~/checks/control-file 2006-09-21 15:27:18.000000000 +0300
++++ lintian/checks/control-file 2006-09-21 15:27:18.000000000 +0300
+@@ -84,5 +84,9 @@
+ tag "build-info-in-binary-control-file-section", "Package ".$binary_control->{"package"}
+ if ($binary_control->{"build-depends"} || $binary_control->{"build-depends-indep"} ||
+ $binary_control->{"build-conflicts"} || $binary_control->{"build-conflicts-indep"});
++
++ tag "dbg-binary-control-file-section-lacks-strict-versioned-dependency", "Package ".$binary_control->{"package"}
++ if ($binary_control->{"package"} =~ /^(.*)-dbg$/ &&
++ ($binary_control->{"depends"}||'') !~ /(?:.*,\s*)?\Q$1\E\s*\(\s*=\s*\$\{(?:Source-Version|binary:Version|source:Version)\}\)/);
+ }
+
+diff -urNad lintian~/checks/control-file.desc lintian/checks/control-file.desc
+--- lintian~/checks/control-file.desc 2006-09-21 15:27:18.000000000 +0300
++++ lintian/checks/control-file.desc 2006-09-21 15:27:18.000000000 +0300
+@@ -31,6 +31,18 @@
+ The binary section is not used and should thus be removed from
+ the Debian control file.
+
++Tag: dbg-binary-control-file-section-lacks-strict-versioned-dependency
++Type: error
++Info: The dbg package section in the control file does not declare
++ dependency on the binary package of the exact same version.
++ .
++ Debugging symbols are specific to binaries from the same build configuration
++ thus dbg packages must declare dependency on the correcponding binary
++ packages of the exact same version.
++ .
++ Thus, the binary control file section of a package `util-dbg' must contain
++ a field `Depends: util (= ${Source-Version})'.
++
+ Tag: debian-control-with-duplicate-fields
+ Type: error
+ Info: One of the paragraphs of your debian/control contains the same
+diff -urNad lintian~/checks/fields lintian/checks/fields
+--- lintian~/checks/fields 2006-09-21 15:27:18.000000000 +0300
++++ lintian/checks/fields 2006-09-21 15:27:18.000000000 +0300
+@@ -555,6 +555,10 @@
+ }
+ }
+
++ tag "dbg-package-lacks-strict-versioned-dependency"
++ if ($version && $pkg =~ /^(.*)-dbg$/ &&
++ ($fields{depends}||'') !~ /(?:,\s*)?\Q$1\E\s*\(\s*=\s*\Q$version\E\)/);
++
+ tag "dbg-package-missing-depends", $debugbase
+ if ($debugpackage && !$debugfound);
+
+diff -urNad lintian~/checks/fields.desc lintian/checks/fields.desc
+--- lintian~/checks/fields.desc 2006-09-21 15:27:18.000000000 +0300
++++ lintian/checks/fields.desc 2006-09-21 15:27:18.000000000 +0300
+@@ -753,3 +753,12 @@
+ Info: This package has a name suggesting that it contains detached
+ debugging symbols. If so, it should have priority "extra" since users
+ normally do not need such packages.
++
++Tag: dbg-package-lacks-strict-versioned-dependency
++Type: error
++Info: The dbg package does not declare dependency on the binary package of
++ the exact same version.
++ .
++ Debugging symbols are specific to binaries from the same build configuration
++ thus dbg packages must declare dependency on the correcponding binary
++ packages of the exact same version.