cvs: php4 /pear/PEAR Dependency.php

From: Date: Sun, 12 May 2002 14:53:54 +0000
Subject: cvs: php4 /pear/PEAR Dependency.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-3780@lists.php.net to get a copy of this message
ssb Sun May 12 10:53:54 2002 EDT Modified files: /php4/pear/PEAR Dependency.php Log: * fix up package dependency check Index: php4/pear/PEAR/Dependency.php diff -u php4/pear/PEAR/Dependency.php:1.7 php4/pear/PEAR/Dependency.php:1.8 --- php4/pear/PEAR/Dependency.php:1.7 Sun May 12 10:42:03 2002 +++ php4/pear/PEAR/Dependency.php Sun May 12 10:53:54 2002 @@ -17,7 +17,7 @@ // | Stig Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // -// $Id: Dependency.php,v 1.7 2002/05/12 14:42:03 cox Exp $ +// $Id: Dependency.php,v 1.8 2002/05/12 14:53:54 ssb Exp $ /** * Methods for dependencies check. Based on Stig's dependencies RFC @@ -75,7 +75,7 @@ return $this->checkSAPI($name); break; default: - return "'{$opts['type']}' dependencie type not supported"; + return "'{$opts['type']}' dependency type not supported"; } } @@ -90,21 +90,30 @@ */ function checkPackage($name, $req = null, $relation = 'has') { - if (!$this->registry->packageExists($name)) { - return "'$name' PEAR package is not installed"; + switch ($relation) { + case 'has': + if (!$this->registry->packageExists($name)) { + return "requires package `$name'"; + } + return false; + case 'not': + if (!$this->registry->packageExists($name)) { + return "conflicts with package `$name'"; + } + return false; + case 'lt': + case 'le': + case 'eq': + case 'ne': + case 'ge': + case 'gt': + $version = $this->registry->packageInfo($name, 'version'); + if (!version_compare($version, $req, $relation)) { + return "requires package `$name' " . + $this->signOperator($relation) . " $req"; + } } - if (substr($relation, 0, 2) == 'v.') { - $pkg_ver = $this->registry->packageInfo($name, 'version'); - $operator = substr($relation, 2); - if (!version_compare($pkg_ver, $req, $operator)) { - return "'$name' PEAR package version " . - $this->signOperator($operator) . " $req is required"; - } - return false; - } elseif ($relation == 'has') { - return false; - } - return "Relation '$relation' with requirement '$req' is not supported"; + return "Relation '$relation' with requirement '$req' is not supported (name=$name)"; } /**

« previous php.pear.cvs (#3780) next »