日記/2010/01/18/PEAR_PackageProjectorでディレクトリに対してroleを設定できない・・・
で愚痴った、PEAR_PackageProjectorでdir_rolesが使えない点を修正するpatchを作ってみました。
修正行数自体はほんの数行程度なんだけど、この数行を特定するのに随分手間取ってしまった・・・。
あとはこれを作者に送って、OKならSVNに反映→packageリリースしてもらって、openpearの方にも反映して貰って・・・ようやくAcme_BrainPhackがリリース出来ます。testコードをパッケージングしたいばかりに随分遠回りになっちゃった・・・。゚(゚´Д`゚)゚。
Index: PEAR/PackageProjector/Package.php
===================================================================
--- PEAR/PackageProjector/Package.php (リビジョン 1535)
+++ PEAR/PackageProjector/Package.php (作業コピー)
@@ -89,6 +89,14 @@
$this->Installgroups[$groupname] = $groupname;
}
+ public function addDirectoryRole($path, $role)
+ {
+ if (isset($this->options['dir_roles'])) {
+ $this->options['dir_roles'] = array();
+ }
+ $this->options['dir_roles'][$path] = $role;
+ }
+
public function addExceptions($path, $role)
{
if (isset($this->options['exceptions'])) {
@@ -159,6 +167,8 @@
$this->pkg->addRelease();
$this->pkg->generateContents();
+ // for debug dump:
+ //$result = $this->pkg->debugPackageFile();
$result = $this->pkg->writePackageFile();
if (PEAR::isError($result)) {
throw new PEAR_Exception($result->getMessage(), $result->getCode());
Index: PEAR/PackageProjector/ProjectInfo/Attribute.php
===================================================================
--- PEAR/PackageProjector/ProjectInfo/Attribute.php (リビジョン 1535)
+++ PEAR/PackageProjector/ProjectInfo/Attribute.php (作業コピー)
@@ -192,7 +192,11 @@
$role = $this->_getAttr('role');
if (!is_null($role)) {
$handler->buildMessage(5, "Add attribute 'role' of [{$this->path}]... {$role}", true);
- $package->addExceptions($this->path, $role);
+ if (is_dir($fullpath)) {
+ $package->addDirectoryRole($this->path, $role);
+ } else {
+ $package->addExceptions($this->path, $role);
+ }
}
//
$platform = $this->_getAttr('platform');