Tito Miguel Costa
Refactoring ideas

Manage package.xml for pear packages

Using the pfm command to the rescue

When creating pear packages, it is a pain to generate the package.xml file if you do it by hand.

To the rescue there is a package called PackageFileManager_Cli available in the pear repository.

At the moment, the package is in alpha and not not maintained anymore, but works as expected. So far, no bugs.

Deployment

As root:

$ sudo bash
# pear config-set preferred_state alpha
# pear install -a PEAR_PackageFileManager_Cli
# exit

After running the previous commands, a new command called pfm will be available, just execute it at the root of your project.

Follow the instructions and at the end you will get the package.xml file. An extra step will be needed before generating the final tgz package.

Open the file package.xml and replace all the occurences of role=”php” with role=”data", otherwise those files won't be included in the package.

With vim, execute

:%s/role=”php/role=”data
:x

To generate the tgz file run

$ pear package

When you need to update the package.xml file, just execute again the pfm command, no need to edit the file by hand unless you add new php files.

4 March, 2011
Tutorial
Symfony2, Doctrine, Cache

Comments