From bb45b81f91fb443f1984159d59d04ed3f4711b1f Mon Sep 17 00:00:00 2001
From: Mathieu Parent <mathieu.parent@nantesmetropole.fr>
Date: Thu, 16 May 2013 16:29:36 +0200
Subject: [PATCH 3/6] phppear: Check for binary dependencies

---
 checks/phppear      |   15 +++++++++++++++
 checks/phppear.desc |    7 ++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/checks/phppear b/checks/phppear
index 58738ab..eba46c6 100644
--- a/checks/phppear
+++ b/checks/phppear
@@ -39,6 +39,21 @@ sub run {
     if (!$bdepends->implies('pkg-php-tools')) {
       tag 'pear-package-without-pkg-php-tools-builddep';
     }
+    # Checking first binary relations
+    my @binaries = $info->binaries;
+    my $binary = $binaries[0];
+    my $depends = $info->binary_relation($binary, 'depends');
+    if (!$depends->implies('${phppear:Debian-Depends}')) {
+      tag 'pear-package-but-missing-dependency', 'Depends';
+    }
+    my $recommends = $info->binary_relation($binary, 'recommends');
+    if (!$recommends->implies('${phppear:Debian-Recommends}')) {
+      tag 'pear-package-but-missing-dependency', 'Recommends';
+    }
+    my $breaks = $info->binary_relation($binary, 'breaks');
+    if (!$breaks->implies('${phppear:Debian-Breaks}')) {
+      tag 'pear-package-but-missing-dependency', 'Breaks';
+    }
   }
   if (defined($channel_xml)) {
     my $bdepends = $info->binary_relation('build-depends');
diff --git a/checks/phppear.desc b/checks/phppear.desc
index f99552f..7e249b6 100644
--- a/checks/phppear.desc
+++ b/checks/phppear.desc
@@ -2,7 +2,7 @@ Check-Script: phppear
 Author: Mathieu Parent <sathieu@debian.org>
 Abbrev: phppear
 Type: source
-Needs-Info: index
+Needs-Info: index, debfiles
 Info: This script checks if the packages comply with various aspects of the
  debian PHP policy.
 
@@ -24,3 +24,8 @@ Info: The package contains an channel.xml file but doesn't build-depend on
  pkg-php-tools is the recommended tool for building PEAR and PECL packages. For
  more information, install it and read the included README.Debian.
 
+Tag: pear-package-but-missing-dependency
+Severity: normal
+Certainty: possible
+Info: The package is a PEAR package but its control file doesn't have
+ ${phppear:Debian-Depends} in Depends or ${phppear:Debian-Recommends}.
-- 
1.7.10.4

