コード例 #1
0
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $this->checkPluginExists($arguments['plugin']);
     $this->pluginDir = sfApplicationConfiguration::getActive()->getPluginConfiguration($arguments['plugin'])->getRootDir();
     $this->interactive = !$options['non-interactive'];
     $cleanup = array();
     if (!file_exists($this->pluginDir . '/package.xml')) {
         $cleanup['temp_files'] = array();
         foreach (sfFinder::type('dir')->in($this->pluginDir) as $dir) {
             if (!sfFinder::type('any')->maxdepth(0)->in($dir)) {
                 $this->getFilesystem()->touch($file = $dir . '/.sf');
                 $cleanup['temp_files'][] = $file;
             }
         }
         $cleanup['package_file'] = true;
         $this->generatePackageFile($arguments, $options);
     }
     $cwd = getcwd();
     chdir($this->pluginDir);
     $this->getPluginManager()->configure();
     require_once 'PEAR/Packager.php';
     $packager = new PEAR_Packager();
     $package = $packager->package($this->pluginDir . '/package.xml', !$options['nocompress']);
     chdir($cwd);
     if (PEAR::isError($package)) {
         if (isset($cleanup['package_file'])) {
             $cleanup['package_file'] = '.error';
         }
         $this->cleanup($cleanup);
         throw new sfCommandException($package->getMessage());
     }
     $this->cleanup($cleanup);
 }
コード例 #2
0
ファイル: pakePearTask.class.php プロジェクト: piotras/pake
 public static function package_pear_package($package_xml_path, $target_dir)
 {
     if (!file_exists($package_xml_path)) {
         throw new pakeException('"' . $package_xml_path . '" file does not exist');
     }
     pake_mkdirs($target_dir);
     $current = getcwd();
     chdir($target_dir);
     if (!class_exists('PEAR_Packager')) {
         @(include 'PEAR/Packager.php');
         if (!class_exists('PEAR_Packager')) {
             // falling back to cli-call
             $results = pake_sh('pear package ' . escapeshellarg($package_xml_path));
             if ($task->is_verbose()) {
                 echo $results;
             }
             chdir($current);
             return;
         }
     }
     $packager = new PEAR_Packager();
     $packager->debug = 0;
     // silence output
     $archive = $packager->package($package_xml_path, true);
     pake_echo_action('file+', $target_dir . '/' . $archive);
     chdir($current);
 }
コード例 #3
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);
 }
コード例 #4
0
ファイル: pantr.php プロジェクト: pago/pantr
 public static function create_pear_package($packageXml = 'package.xml', $dest = null)
 {
     if (!class_exists('PEAR_Packager')) {
         @(include 'PEAR/Packager.php');
         if (!class_exists('PEAR_Packager')) {
             // falling back to cli-call
             pantr::sh('pear package', $return);
             return;
         }
     }
     $packager = new \PEAR_Packager();
     $packager->debug = 0;
     // silence output
     $archive = $packager->package($packageXml, true);
     pantr::writeAction('pear-package', $archive);
     if (!is_null($dest)) {
         pantr::beginSilent();
         pantr::move($archive, $dest . DIRECTORY_SEPARATOR . $archive);
         pantr::endSilent();
     }
     return $archive;
 }
コード例 #5
0
ファイル: make-pkg.php プロジェクト: phpontrax/trax
$packagexml->addInstallAs('pear-trax.bat', 'trax');
$packagexml->addIgnoreToRelease('pear-trax');
$packagexml->addRelease();
// add another release section for all other OSes
$packagexml->addInstallAs('pear-trax', 'trax');
$packagexml->addIgnoreToRelease('pear-trax.bat');
// create the <contents> tag
$packagexml->generateContents();
// Study the Subversion .svn directories to see what goes in the
// package, then write package.xml
$e = $packagexml->writePackageFile();
if (PEAR::isError($e)) {
    die($e->getMessage());
}
// Make a tarball of the files listed in package.xml
$packager = new PEAR_Packager();
$e = $packager->package();
if (PEAR::isError($e)) {
    die($e->getMessage());
}
// Move files into a build folder and clean up files
chdir("..");
if (!is_dir("build")) {
    mkdir("build");
}
rename("./trax/PHPonTrax-" . $trax_version . ".tgz", "build/PHPonTrax-" . $trax_version . ".tgz");
unlink("./trax/package.xml");
// -- set Emacs parameters --
// Local variables:
// tab-width: 4
// c-basic-offset: 4
コード例 #6
0
ファイル: Package.php プロジェクト: radicaldesigns/amp
 function doPackage($command, $options, $params)
 {
     $this->output = '';
     include_once 'PEAR/Packager.php';
     if (sizeof($params) < 1) {
         $params[0] = "package.xml";
     }
     $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml';
     $packager = new PEAR_Packager();
     $err = $warn = array();
     $dir = dirname($pkginfofile);
     $compress = empty($options['nocompress']) ? true : false;
     $result = $packager->package($pkginfofile, $compress);
     if (PEAR::isError($result)) {
         $this->ui->outputData($this->output, $command);
         return $this->raiseError($result);
     }
     // Don't want output, only the package file name just created
     if (isset($options['showname'])) {
         $this->output = $result;
     }
     if (PEAR::isError($result)) {
         $this->output .= "Package failed: " . $result->getMessage();
     }
     $this->ui->outputData($this->output, $command);
     return true;
 }