home ホーム search 検索 -  login ログイン  | reload edit datainfo version cmd icon diff delete  | help ヘルプ

日記/2010/01/19/ PEAR_PackageProjector のdir_roles有効化patch

日記/2010/01/19/ PEAR_PackageProjector のdir_roles有効化patch

日記 / 2010 / 01 / 19 /  PEAR_PackageProjector のdir_roles有効化patch
id: 559 所有者: msakamoto-sf    作成日: 2010-01-19 15:27:46
カテゴリ: PHP 

日記/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');

プレーンテキスト形式でダウンロード
現在のバージョン : 1
更新者: msakamoto-sf
更新日: 2010-01-19 15:31:47
md5:011a60d2518c59c1db5b9e33986bf48b
sha1:b6aa12054d2afde40a7272c163817fd52a0cb6ab
コメント
コメントを投稿するにはログインして下さい。