svn: /pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/ PEAR2SVN.php

[email protected] (Brett Bieber) Tue, 11 Jan 2011 10:05:03 +0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
saltybeagle                              Tue, 11 Jan 2011 10:05:03 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=307369

Log:
Fix Bug #18123 Exception when using pyrus.phar make -n. Do not set the compatible package.xml details if -n is used

Bug: http://pear.php.net/bugs/18123 (unknown) 
      
Changed paths:
    U   pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/PEAR2SVN.php

Modified: pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/PEAR2SVN.php
===================================================================
--- pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/PEAR2SVN.php	2011-01-11 09:23:17 UTC (rev 307368)
+++ pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/PEAR2SVN.php	2011-01-11 10:05:03 UTC (rev 307369)
@@ -136,8 +136,7 @@
             $base_install_dirs = array_merge($base_install_dirs, $scanoptions['baseinstalldirs']);
         }

-        $this->pxml->setBaseInstallDirs($base_install_dirs);
-        $this->pxml_compatible->setBaseInstallDirs($base_install_dirs);
+        $this->setBaseInstallDirs($base_install_dirs);

         $rolemap = array(
             'src'           => 'php',
@@ -217,32 +216,36 @@
                             'attribs' => array('role' => $role)
                         );

-                    $roleobject = \PEAR2\Pyrus\Installer\Role::factory($this->pxml->type, $role);
-                    if ($role == 'customcommand' || $role == 'customrole' || $role == 'customtask') {
-                        $compatiblerole = 'data';
-                    } else {
-                        $compatiblerole = $role;
+                    if ($this->doCompatible) {
+                        $roleobject = \PEAR2\Pyrus\Installer\Role::factory($this->pxml->type, $role);
+                        if ($role == 'customcommand' || $role == 'customrole' || $role == 'customtask') {
+                            $compatiblerole = 'data';
+                        } else {
+                            $compatiblerole = $role;
+                        }
+
+                        $attribs = array('name' => $curpath, 'role' => $compatiblerole);
+                        $baseinstalldir = $this->pxml_compatible->getBaseinstallDir($curpath);
+                        if ($baseinstalldir && $baseinstalldir != '/') {
+                            $attribs['baseinstalldir'] = $baseinstalldir;
+                        }
+
+                        $curpath = $roleobject->getPackagingLocation($this->pxml_compatible,
+                                                                     $attribs);
+                        $packagepath = $roleobject->getCompatibleInstallAs($this->pxml_compatible,
+                                                                           $attribs);
+                        $this->pxml_compatible->files[$curpath] =
+                            array(
+                                'attribs' => array('role' => $compatiblerole)
+                            );
+                        $this->pxml_compatible->release[0]->installAs($curpath, $packagepath);
                     }
-
-                    $attribs = array('name' => $curpath, 'role' => $compatiblerole);
-                    $baseinstalldir = $this->pxml_compatible->getBaseinstallDir($curpath);
-                    if ($baseinstalldir && $baseinstalldir != '/') {
-                        $attribs['baseinstalldir'] = $baseinstalldir;
-                    }
-
-                    $curpath = $roleobject->getPackagingLocation($this->pxml_compatible,
-                                                                 $attribs);
-                    $packagepath = $roleobject->getCompatibleInstallAs($this->pxml_compatible,
-                                                                       $attribs);
-                    $this->pxml_compatible->files[$curpath] =
-                        array(
-                            'attribs' => array('role' => $compatiblerole)
-                        );
-                    $this->pxml_compatible->release[0]->installAs($curpath, $packagepath);
                 }
             }
         }
-        $this->pxml_compatible->dependencies['required']->pearinstaller->min = '1.4.8';
+        if ($this->doCompatible) {
+            $this->pxml_compatible->dependencies['required']->pearinstaller->min = '1.4.8';
+        }
     }

     /**
@@ -256,18 +259,12 @@
             $a = new \SplFileInfo($this->path . DIRECTORY_SEPARATOR . 'README');
             foreach ($a->openFile('r') as $num => $line) {
                 if (!$num) {
-                    $this->pxml->summary = $line;
-                    if ($this->doCompatible) {
-                        $this->pxml_compatible->summary = $line;
-                    }
+                    $this->summary = $line;
                     continue;
                 }
                 $description .= $line;
             }
-            $this->pxml->description = $description;
-            if ($this->doCompatible) {
-                $this->pxml_compatible->description = $description;
-            }
+            $this->description = $description;
         }
     }

@@ -318,12 +315,12 @@
             list($releasenotesfile, $releaseversion) = array_pop($files);
             $stability = $this->guessStabilityFromVersion($releaseversion);

-            $this->pxml->version['release']   = $releaseversion;
-            $this->pxml->stability['release'] = $stability;
-            $this->pxml->notes                = file_get_contents($this->path . DIRECTORY_SEPARATOR . $releasenotesfile);
+            $this->version['release']   = $releaseversion;
+            $this->stability['release'] = $stability;
+            $this->notes                = file_get_contents($this->path . DIRECTORY_SEPARATOR . $releasenotesfile);

             $apistability = $stability;
-            $apiversion   = $this->pxml->version['api'];
+            $apiversion   = $this->version['api'];

             if ($stability == 'beta') {
                 if ($apiversion == '0.1.0') {
@@ -332,16 +329,9 @@
                 $apistability = 'stable';
             }

-            $this->pxml->version['api']   = $apiversion;
-            $this->pxml->stability['api'] = $apistability;
+            $this->version['api']   = $apiversion;
+            $this->stability['api'] = $apistability;

-            if ($this->doCompatible) {
-                $this->pxml_compatible->version['release']   = $releaseversion;
-                $this->pxml_compatible->stability['release'] = $stability;
-                $this->pxml_compatible->version['api']       = $apiversion;
-                $this->pxml_compatible->stability['api']     = $apistability;
-                $this->pxml_compatible->notes                = $this->pxml->notes;
-            }
         }
     }

@@ -362,17 +352,12 @@
             list($apinotesfile, $apiversion) = array_pop($files);
             $stability = $this->guessStabilityFromVersion($apiversion);

-            $this->pxml->version['api']   = $apiversion;
-            $this->pxml->stability['api'] = $stability;
+            $this->version['api']   = $apiversion;
+            $this->stability['api'] = $stability;

-            $this->pxml->notes = $this->pxml->notes .
+            $this->notes = $this->notes .
                 "\n\n" . file_get_contents($this->path . DIRECTORY_SEPARATOR . $apinotesfile);

-            if ($this->doCompatible) {
-                $this->pxml_compatible->version['api']   = $apiversion;
-                $this->pxml_compatible->stability['api'] = $stability;
-                $this->pxml_compatible->notes            = $this->pxml->notes;
-            }
         }
     }

@@ -463,4 +448,13 @@
         }
         return $this->pxml->$var;
     }
+
+    function __call($method, $args)
+    {
+        $ret = call_user_func_array(array($this->pxml, $method), $args);
+        if ($this->doCompatible) {
+            call_user_func_array(array($this->pxml_compatible, $method), $args);
+        }
+        return $ret;
+    }
 }
\ No newline at end of file