opscode-cookbooks/php — pull request #13 by cassianoleal (2012-11-26 22:39:26+00:00)
Title: [COOK-1803] php_pear: Search for exact match on the services, raise exception if not found

I need to install "gearman" from PECL.

The way that the cookbook currently works, it first searches PEAR, which returns this:

vagrant@gearman:~$ pear search gearman
Retrieving data...0%
Matched packages, channel pear.php.net:
=======================================
Package Stable/(Latest) Local
Net_Gearman 0.2.3 (alpha) A PHP interface to Gearman

Now, since the "pecl?" method returns false when the output matches /\.?Matched packages/i [ http://bit.ly/UonVa0 ], then the provider assumes that "gearman" was found in PEAR (which it wasn't), and goes on to try to install from there.

It then fails to install (since "gearman" is not a package that exists in PEAR), but the chef run goes on as though everything was fine.

Now, I'm pointing out two different problems here, and my ideal solution would be to raise an exception if an exact match was not found in either service: https://github.com/cassianoleal/php/commit/052ad923412c020eeabe164782827b31fb40cffc

I'm not sure if that won't break some other desired behaviour (such as not raising an exception if PEAR or PECL is offline, for example). If you want, go ahead and merge this pull request. :)