Search code examples
phpsvnpear

Add PEAR packages to Subversion repository?


I'm working on a project that'll use PEAR packages. Because you never know what version of the PEAR package will be installed on your hosting provider (and especially because I require a patch to have been applied to one of the packages), I'd like to put the PEAR source for my project right into SVN, so other developers can immediately have the dependencies.

But everything related to PEAR seems to have absolute directories! Running "pear config-create . pear.conf" to set up a new PEAR directory even fails with the error message:

Root directory must be an absolute path

I checked out the pear config files on some other servers and they, too, seem to have absolute paths.

Whenever a developer checks this out to his own machine, or we export it all to a server, we don't know what the absolute path will be.

Is there any way to set this up?


Solution

  • If you have PHP 5.3.1 use Pyrus, the PEAR2 installer. The pyrus managed installations can be moved where ever you like.

    Download pyrus -

    $> wget http://pear2.php.net/pyrus.phar
    

    Create a directory to store your pyrus-installed packages:

    $> mkdir mylibs
    

    Install packages -

    $> php pyrus.phar mylibs install pear/Net_URL
    

    Your installed package is now at mylibs/php/Net/URL.php

    Note that we passed the mylibs directory to indicate what directory to install to, as well as the channel name 'pear' (the default in pyrus is pear2.php.net). For convenience, the pyrus.phar file can be executed from cli if you chmod +x it.

    You can move the mylibs directory wherever you'd like. Even commit it to your repository.

    Lots of docs on the PEAR website.