/**
 * Generates the package.xml for sample application
 *
 */

/* don't modify this */
$packagedir  = dirname(__FILE__);

// Name of the channel, this package will be distributed through
$channel     = 'pear.example.com';

// Category and name of the package
$category    = 'Applications';
$package     = 'app';

// Version
$version     = '1.2.1' ;

// Summary description
$summary     = <<setOptions(
    array(
        // Where are our package files.
        'packagedirectory'  => $packagedir,
        // Where will package files be installed in
        // the local PEAR repository?
        'baseinstalldir'    => 'customer/app',
        // Where should the package file be generated
        'pathtopackagefile' => dirname(__FILE__),
        // Just simple output, no MD5 sums and  tags
        'simpleoutput'      => true,
        // Use standard file list generator, choose CVS, if you
        // have your code in CVS
        'filelistgenerator' => 'CVS',

        // List of files to ignore and put not explicitly into the package
        'ignore'            => $arignores,

        // Global mapping of directories to file roles.
        // @see http://pear.php.net/manual/en/guide.migrating.customroles.defining.php
        'dir_roles'         => array(
            'commands'                 => 'web',
            'models'                   => 'web',
            'public_html'              => 'web',
            'sql'                      => 'web',
            'system'                   => 'web',
            'templates'                => 'web',
            'views'                     => 'web'
        ),
        'roles' => array('*' => 'web'),
    )
);

// PEAR error checking
if (PEAR::isError($e)) {
    die($e->getMessage());
}

// Set misc package information
$pkg->setPackage($package);
$pkg->setSummary($summary);
$pkg->setDescription($description);
$pkg->setChannel($channel);

$pkg->setReleaseStability('stable');
$pkg->setAPIStability('stable');
$pkg->setReleaseVersion($version);
$pkg->setAPIVersion($version);

$pkg->setLicense($license);
$pkg->setNotes($notes);

// Our package contains PHP files (not C extension files)
$pkg->setPackageType('php');

// Must be available in new package.xml format
$pkg->setPhpDep('5.2.0');
$pkg->setPearinstallerDep('1.4.11');

// Require custom file role for our web installation
$pkg->addPackageDepWithChannel('required', 'Role_Web', 'pearified.com');

// Define that we will use our custom file role in this script
$pkg->addUsesRole('web', 'Webfiles');

// Mapping misc roles to file name extensions
$pkg->addRole('', 'web');
$pkg->addRole('png', 'web');
$pkg->addRole('gif', 'web');
$pkg->addRole('jpeg', 'web');

// Create the current release and add it to the package definition
$pkg->addRelease();

// Package release needs a maintainer
$pkg->addMaintainer('lead', 'tony.bibbs@example.com', 'Tony Bibbs', 'tony.bibbs@example.com');

// Internally generate the XML for our package.xml (does not perform output!)
$test = $pkg->generateContents();

// If called without "make" parameter, we just want to debug the generated
// package.xml file and want to receive additional information on error.
if (isset($argv[1]) && $argv[1] === 'make') {
    $pkg->writePackageFile();
} else {
    $pkg->debugPackageFile();
}

|