コード例 #1
0
 public function buildSubPackage($dir, $baseinstalldir, $info)
 {
     $package = str_replace('/', '_', $baseinstalldir);
     $opts = array('packagedirectory' => $dir, 'filelistgenerator' => 'file', 'ignore' => array('*composer.json', '*package.xml'), 'baseinstalldir' => '/' . $info['target-dir'], 'packagefile' => 'package.xml');
     $pfm = new PEAR_PackageFileManager2();
     $e = $pfm->setOptions($opts);
     $pfm->setPackage($package);
     $pfm->setSummary($info['description']);
     $pfm->setDescription($info['description']);
     $pfm->setPackageType('php');
     $pfm->setChannel('guzzlephp.org/pear');
     $pfm->setAPIVersion('3.0.0');
     $pfm->setReleaseVersion($this->getVersion());
     $pfm->setAPIStability('stable');
     $pfm->setReleaseStability('stable');
     $pfm->setNotes($this->changelog_notes);
     $pfm->setPackageType('php');
     $pfm->setLicense('MIT', 'http://github.com/guzzle/guzzle/blob/master/LICENSE');
     $pfm->addMaintainer('lead', 'mtdowling', 'Michael Dowling', '*****@*****.**', 'yes');
     $pfm->setDate($this->changelog_release_date);
     $pfm->generateContents();
     $phpdep = $this->guzzleinfo['require']['php'];
     $phpdep = str_replace('>=', '', $phpdep);
     $pfm->setPhpDep($phpdep);
     $pfm->setPearinstallerDep('1.4.6');
     foreach ($info['require'] as $type => $version) {
         if ($type == 'php') {
             continue;
         }
         if ($type == 'symfony/event-dispatcher') {
             $pfm->addPackageDepWithChannel('required', 'EventDispatcher', 'pear.symfony.com', '2.1.0');
         }
         if ($type == 'ext-curl') {
             $pfm->addExtensionDep('required', 'curl');
         }
         if (substr($type, 0, 6) == 'guzzle') {
             $gdep = str_replace('/', ' ', $type);
             $gdep = ucwords($gdep);
             $gdep = str_replace(' ', '_', $gdep);
             $pfm->addPackageDepWithChannel('required', $gdep, 'guzzlephp.org/pear', $this->getVersion());
         }
     }
     // can't have main Guzzle package AND sub-packages
     $pfm->addConflictingPackageDepWithChannel('Guzzle', 'guzzlephp.org/pear', false, $apiversion);
     ob_start();
     $startdir = getcwd();
     chdir((string) $this->basedir . '/build/pearwork');
     echo "DEBUGGING GENERATED PACKAGE FILE\n";
     $result = $pfm->debugPackageFile();
     if ($result) {
         $out = $pfm->writePackageFile();
         echo "\n\n\nWRITE PACKAGE FILE RESULT:\n";
         var_dump($out);
         // load up package file and build package
         $packager = new PEAR_Packager();
         echo "\n\n\nBUILDING PACKAGE FROM PACKAGE FILE:\n";
         $dest_package = $packager->package($opts['packagedirectory'] . '/package.xml');
         var_dump($dest_package);
     } else {
         echo "\n\n\nDEBUGGING RESULT:\n";
         var_dump($result);
     }
     echo "removing package.xml";
     unlink($opts['packagedirectory'] . '/package.xml');
     $log = ob_get_clean();
     file_put_contents((string) $this->basedir . '/build/artifacts/logs/pear_package_' . $package . '.log', $log);
     chdir($startdir);
 }