CHAPTER 12 – Building the Tarball

With these two files (HelloWorld.php and package.xml), you can create a pack- age tarball with the pear package command: $ pear package Analyzing HelloWorld.php Package .../HelloWorld-1.0.tgz done Tag the released code with 'pear cvstag package.xml' (or set the CVS tag RELEASE_1_0 by hand) The message about tagging the released code reminds package maintain- ers who work on the php.net CVS server to just ignore it for now. HelloWorld-1.0.tgz is your package tarball. This file may be installed with the pear install command on any machine that has a PEAR installer. If you do not have zlib support in your PHP build, the created package tarball will not be compressed, and the file name would be "HelloWorld- 1.0.tar." Compressing it with an external gzip program will work in this case.

Verification Use the pear package-validate (or pear pv) command to validate that your tar- ball is good:

$ pear pv HelloWorld-1.0.tgz Validation: 0 error(s), 0 warning(s) Validation fails if You have defined symbols that are outside your package's namespace. Required elements are missing in package.xml. Dependencies are bad. The file list is bad or missing. Another way to verify that your package tarball works as you intend is to use the pear info and pear list commands: $ pear info HelloWorld-1.0.tgz ABOUT HELLOWORLD-1.0 ==================== Provides Classes: Package HelloWorld Summary Simple Hello World Package Description This package contains a class that simply prints "Hello, World!". Maintainers Stig S. Bakken <stig@php.net> (lead) Version 1.0 Release Date 2004-04-24 Release License PHP License Release State stable Release Notes First production release. The info output quickly reveals if something went wrong with the tarball creation: $ pear list HelloWorld-1.0.tgz CONTENTS OF HELLOWORLD-1.0.TGZ ============================== PACKAGE FILE INSTALL PATH HelloWorld.php /usr/local/lib/php/HelloWorld.php hello /usr/local/lib/php/hello tests/01-HelloWorld.phpt -- will not be installed -- Check the install path of each file and make sure it is what you intended. If a file ended up in the wrong location, go back to your package.xml file and set the baseinstalldir attribute in the <file> element for that file. You should also install and uninstall it for a final verification and to ensure that the install/uninstall scripts are working. If your package uses the platform attribute in one or more <file> elements, you should repeat the same procedure for at least one platform that the "platform" rule matches, and for at least one that it does not match.

Post Comment
Login to post comments