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.58: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
name | String | The name of the PEAR package. | n/a | Yes |
dir | String | The base directory of files to add to package. | n/a | Yes |
<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> <element key="handle" value="hlellelid"/> <element key="name" value="Hans"/> <element key="email" value="hans@xmpl.org"/> <element key="role" value="lead"/> </element> </mapping> </pearpkg2>
option
Table C.59: Available options
Name | Type | Description | Default | Required |
---|---|---|---|---|
summary | String | n/a | Yes | |
description | String | n/a | Yes | |
license | String | n/a | Yes | |
channel | String | Channel name (not alias!). Must be registered
(pear channel-discover channel ) on
the machine, where the build will be. | n/a | Yes |
apiversion | String | n/a | Yes | |
releaseversion | String | n/a | Yes | |
releasestability | String | One from: snapshot, devel, alpha, beta or stable. | n/a | Yes |
apistability | String | One from: devel, alpha, beta or stable. | n/a | Yes |
note | String | n/a | Yes | |
packagetype | String | n/a | Yes | |
phpdep | String | n/a | Yes | |
pearinstallerdep | String | n/a | Yes |
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"/> </mapping>
Available mappings and they structures:
deps
(optional) see PEAR_PackageFileManager::addDependency() for more info
Table C.60: Parameters
Name | Type | Description | Default | Required |
---|---|---|---|---|
channel | String | Channel name, from package is. | n/a | Yes |
name | String | Package name in channel. | n/a | Yes |
version | String | Minimal version. | n/a | Yes |
max | String | Maximum version. | Same as version. | No |
recommended | String | Recommended version. | Same as version. | No |
extdeps
(optional) see PEAR_PackageFileManager::addDependency() for more info
Table C.61: Parameters
Name | Type | Description | Default | Required |
---|---|---|---|---|
name | String | Package name. | n/a | Yes |
version | String | Minimal version. | n/a | Yes |
max | String | Maximum version. | Same as version. | No |
recommended | String | Recommended version. | Same as version. | No |
maintainers
(required at least one) see PEAR_PackageFileManager::addMaintainer() for more info
Table C.62: Parameters
Name | Type | Description | Default | Required |
---|---|---|---|---|
handle | String | User identifier in channel. | n/a | Yes |
name | String | Real name. | n/a | Yes |
email | String | n/a | Yes | |
role | String | One from: lead, developer, contributor or helper. | n/a | Yes |
replacements
(optional) see PEAR_PackageFileManager::addReplacement() for more info
Table C.63: Parameters
Name | Type | Description | Default | Required |
---|---|---|---|---|
path | String | Relative path of file. | n/a | Yes |
type | String | Variable type, either php-const, pear-config or package-info. | n/a | Yes |
from | String | Text to replace in the source file. | n/a | Yes |
to | String | Variable name to use for replacement. | n/a | Yes |
role
See PEAR_PackageFileManager::addRole for more
information.
Available options:
Table C.64: Parameters
Name | Type | Description | Default | Required |
---|---|---|---|---|
extension | String | The file extension | n/a | Yes |
role | String | The file extension | n/a | Yes |