From d996007f000aeba863fed7b6a719a0c98d3e5c44 Mon Sep 17 00:00:00 2001
From: Mathieu Parent <math.parent@gmail.com>
Date: Thu, 16 May 2013 16:29:36 +0200
Subject: [PATCH 3/7] phppear: Check for binary dependencies

---
 checks/phppear      |   16 ++++++++++++++++
 checks/phppear.desc |   13 ++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/checks/phppear b/checks/phppear
index 392cd55..da6ec57 100644
--- a/checks/phppear
+++ b/checks/phppear
@@ -37,6 +37,22 @@ sub run {
     my $bdepends = $info->relation('build-depends');
     if (!$bdepends->implies('pkg-php-tools')) {
       tag 'pear-package-without-pkg-php-tools-builddep';
+    } else {
+      # 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';
+      }
     }
   }
   # PEAR channel
diff --git a/checks/phppear.desc b/checks/phppear.desc
index f99552f..289ec06 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,14 @@ 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}.
+
+
+Tag: pear-package-feature-requires-newer-pkg-php-tools
+Severity: normal
+Certainty: possible
+Info: The package requires a newer pkg-php-tools for a specific feature.
-- 
1.7.10.4

