fpm pecl / pear to deb or rpm

Sometimes it happens. You need to convert pecl / pear package to deb or rpm.

This is What you need: fpm. This tool will solve your problem.

But if you try to do something like that:

# fpm -s pear -t deb mypearpackage

It will obviously fail. And actually it’s not a feature of fpm but rather very old bug of pear: pear bug #18666
If you read entire bug you will find workaround/patch. I will save your time and give a link on it: diff

Once you patch those two files: PEAR/Builder.php and PEAR/Command/Install.php fpm will actually works.

But you would face another issue. Since pear doesn’t know anything about php.ini it will suggest to manually add extension to php.ini.
You can simplify your life by splitting fpm into two subcommands.
First one will convert pear package to directory:

# fpm -s pear -t dir mypearpackage

And after you will manually add conf.d file (note: php –ini) to mypearpackage.dir/ you can pack it to rpm or deb as usual:

# fpm -s dir -C mypearpackage.dir/ -t deb -n mypearpackage ./

note: pecl is actually wrapper around pear. So pecl packages also can be converted by fpm using ether “–pear-channel” argument or by specifying channel in package name like that:

# fpm -s pear -t dir pecl.php.net/mypearpackage

I hope I didn’t miss anything important. 😉