C.66 PearPackage2Task

With the PearPackage2Task, you can create a version 2 package.xml which can be installed using the PEAR installer. Use this in conjunction with the TarTask to completely script the building of a PEAR package.

This task uses the PEAR_PackageFileManager2 class. In order to be maximally flexible, the majority of options are set generically (using <option> tag) and are set using PEAR_PackageFileManager::setOptions(). Use the <mapping> tag to represent complex values.

Note that Travis Swicegood has created a more complete implementation of this functionality which can be found here: pear.domain51.com.

Table C.79: Attributes

nameStringThe name of the PEAR package.n/aYes
dirStringThe base directory of files to add to package.n/aYes

C.66.1 Example

<pearpkg2 name="phing" dir="${build.src.dir}">
   <option name="outputdirectory" value="./build"/>
   <option name="packagefile" value="package2.xml"/>
   <option name="packagedirectory" value="./${build.dist.dir}"/>
   <option name="baseinstalldir" value="${pkg.prefix}"/>
   <option name="channel" value="my.pear-channel.com"/>
   <option name="summary" value="${pkg.summary}"/>
   <option name="description" value="${pkg.description}"/>
   <option name="apiversion" value="${pkg.version}"/>
   <option name="apistability" value="beta"/>
   <option name="releaseversion" value="${pkg.version}"/>
   <option name="releasestability" value="beta"/>
   <option name="license" value="none"/>
   <option name="phpdep" value="5.0.0"/>
   <option name="pearinstallerdep" value="1.4.6"/>
   <option name="packagetype" value="php"/>
   <option name="notes" value="${pkg.relnotes}"/>
   <mapping name="maintainers">
     <element key="handle" value="hlellelid"/>
     <element key="name" value="Hans"/>
     <element key="email" value="[email protected]"/>
     <element key="role" value="lead"/>

C.66.2 Supported Nested Tags

  • fileset

  • option

    Table C.80: Available options

    summaryString n/aYes
    descriptionString n/aYes
    licenseString n/aYes
    channelStringChannel name (not alias!). Must be registered (pear channel-discover channel) on the machine, where the build will be.n/aYes
    apiversionString n/aYes
    releaseversionString n/aYes
    releasestabilityStringOne from: snapshot, devel, alpha, beta or stable.n/aYes
    apistabilityStringOne from: devel, alpha, beta or stable.n/aYes
    noteString n/aYes
    packagetypeString n/aYes
    phpdepString n/aYes
    pearinstallerdepString n/aYes

  • mapping

    The <mapping> tag represents a complex data type. You can use nested <mapping> (and nested <element> with <element> tags) to represent the full complexity of the structure. Bear in mind that what you are creating will be mapped to an associative array that will be passed in via PEAR_PackageFileMaintainer::setOptions() .

    <mapping name="option_name">
        <element key="key_name" value="key_val"/>
        <element key="key_name" value="key_val"/>

    Available mappings and they structures:

    • deps (optional) see PEAR_PackageFileManager::addDependency() for more info

      Table C.81: Parameters

      channelStringChannel name, from package is.n/aYes
      nameStringPackage name in channel.n/aYes
      versionStringMinimal version.n/aYes
      maxStringMaximum version.Same as version.No
      recommendedStringRecommended version.Same as version.No

    • extdeps (optional) see PEAR_PackageFileManager::addDependency() for more info

      Table C.82: Parameters

      nameStringPackage name.n/aYes
      versionStringMinimal version.n/aYes
      maxStringMaximum version.Same as version.No
      recommendedStringRecommended version.Same as version.No

    • maintainers (required at least one) see PEAR_PackageFileManager::addMaintainer() for more info

      Table C.83: Parameters

      handleStringUser identifier in channel.n/aYes
      nameStringReal name.n/aYes
      emailString n/aYes
      roleStringOne from: lead, developer, contributor or helper.n/aYes

    • replacements (optional) see PEAR_PackageFileManager::addReplacement() for more info

      Table C.84: Parameters

      pathStringRelative path of file.n/aYes
      typeStringVariable type, either php-const, pear-config or package-info.n/aYes
      fromStringText to replace in the source file.n/aYes
      toStringVariable name to use for replacement.n/aYes

  • role See PEAR_PackageFileManager::addRole for more information.

    Available options:

    Table C.85: Parameters

    extensionStringThe file extensionn/aYes
    roleStringThe file extensionn/aYes