本文整理汇总了PHP中PEAR_PackageFileManager2::writePackageFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFileManager2::writePackageFile方法的具体用法?PHP PEAR_PackageFileManager2::writePackageFile怎么用?PHP PEAR_PackageFileManager2::writePackageFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_PackageFileManager2
的用法示例。
在下文中一共展示了PEAR_PackageFileManager2::writePackageFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute($arguments = array(), $options = array())
{
// Remove E_STRICT and E_DEPRECATED from error_reporting
error_reporting(error_reporting() & ~(E_STRICT | E_DEPRECATED));
require_once 'PEAR/PackageFileManager2.php';
$pluginName = $arguments['name'];
$info = $this->getPluginManager()->getPluginInfo($pluginName);
if (!$info) {
$info = array('n' => $pluginName, 'c' => opPluginManager::OPENPNE_PLUGIN_CHANNEL, 'l' => 'Apache', 's' => $pluginName, 'd' => $pluginName);
}
$packageXml = new PEAR_PackageFileManager2();
$options = array('packagedirectory' => sfConfig::get('sf_plugins_dir') . '/' . $pluginName . '/', 'filelistgenerator' => 'file', 'baseinstalldir' => '/');
$e = $packageXml->setOptions($options);
if (PEAR::isError($e)) {
echo $e->getMessage();
exit;
}
$packageXml->_options['roles'] = array('*' => 'data');
$maintainers = $this->getPluginManager()->getPluginMaintainer($pluginName);
foreach ($maintainers as $maintainer) {
$packageXml->addMaintainer($maintainer['r'], $maintainer['h'], $maintainer['n'], '');
}
$packageXml->setPackage($pluginName);
$packageXml->setChannel(opPluginManager::OPENPNE_PLUGIN_CHANNEL);
$packageXml->setReleaseVersion($arguments['version']);
$packageXml->setReleaseStability($arguments['stability']);
$packageXml->setApiVersion($arguments['version']);
$packageXml->setApiStability($arguments['stability']);
$packageXml->setNotes($arguments['note']);
$packageXml->setPhpDep('5.2.3');
$packageXml->setPearinstallerDep('1.4.0');
$packageXml->addPackageDepWithChannel('package', 'symfony', 'pear.symfony-project.com', '1.2.0');
$packageXml->generateContents();
$packageXml->setPackageType('php');
if (isset($info['l'])) {
$packageXml->setLicense($info['l']);
}
if (isset($info['s'])) {
$packageXml->setSummary($info['s']);
}
if (isset($info['d'])) {
$packageXml->setDescription($info['d']);
}
$e = $packageXml->writePackageFile();
if (PEAR::isError($e)) {
echo $e->getMessage();
exit;
}
}
示例2:
$pack->setAPIStability($config['phrozn']['stability']);
$pack->setNotes('
* The first public release of Phrozn
');
$pack->setLicense('Apache License, Version 2.0', 'http://www.apache.org/licenses/LICENSE-2.0');
$pack->addMaintainer('lead', 'victor', 'Victor Farazdagi', 'simple.square@gmail.com');
$pack->addRelease();
$pack->addInstallAs('bin/phr.php', 'phr');
$pack->addInstallAs('bin/phrozn.php', 'phrozn');
// core dependencies
$pack->setPhpDep('5.3.0');
$pack->setPearinstallerDep('1.4.6');
// package dependencies
$pack->addPackageDepWithChannel('required', 'Console_CommandLine', 'pear.php.net', '1.1.3');
$pack->addPackageDepWithChannel('required', 'Console_Color', 'pear.php.net', '1.0.3');
$pack->addPackageDepWithChannel('required', 'Console_Table', 'pear.php.net', '1.1.4');
$pack->addPackageDepWithChannel('required', 'Archive_Tar', 'pear.php.net', '1.3.7');
$pack->addReplacement('bin/phrozn.php', 'pear-config', '/usr/bin/env php', 'php_bin');
$pack->addReplacement('bin/phrozn.php', 'pear-config', '@PHP-BIN@', 'php_bin');
$pack->addReplacement('bin/phrozn.php', 'pear-config', '@DATA-DIR@', 'data_dir');
$pack->addReplacement('bin/phrozn.php', 'pear-config', '@PEAR-DIR@', 'php_dir');
$pack->addReplacement('bin/phr.php', 'pear-config', '/usr/bin/env php', 'php_bin');
$pack->addReplacement('bin/phr.php', 'pear-config', '@PHP-BIN@', 'php_bin');
$pack->addReplacement('bin/phr.php', 'pear-config', '@DATA-DIR@', 'data_dir');
$pack->addReplacement('bin/phr.php', 'pear-config', '@PEAR-DIR@', 'php_dir');
$pack->addReplacement('Phrozn/Autoloader.php', 'pear-config', '@PHP-BIN@', 'php_bin');
$pack->addReplacement('Phrozn/Autoloader.php', 'pear-config', '@DATA-DIR@', 'data_dir');
$pack->addReplacement('Phrozn/Autoloader.php', 'pear-config', '@PEAR-DIR@', 'php_dir');
$pack->generateContents();
$pack->writePackageFile();
echo 'Package file created: ' . $outputDir . 'package.xml' . "\n";
示例3: array
$packagexml->setOptions(array('baseinstalldir' => '/', 'simpleoutput' => true, 'packagedirectory' => './', 'filelistgenerator' => 'file', 'ignore' => array('runTests.php', 'generatePackage.php', 'phpunit-bootstrap.php', 'phpunit.xml', 'README', 'coverage*'), 'dir_roles' => array('tests' => 'test', 'examples' => 'doc')));
$packagexml->setPackage('HTTP_OAuth');
$packagexml->setSummary('PEAR implementation of the OAuth 1.0a specification');
$packagexml->setDescription('Allows the use of the consumer and provider angles of the OAuth 1.0a specification');
$packagexml->setChannel('pear.php.net');
$packagexml->setAPIVersion('0.2.0');
$packagexml->setReleaseVersion('0.2.3');
$packagexml->setReleaseStability('alpha');
$packagexml->setAPIStability('alpha');
$packagexml->setNotes('* Fixed GH issue #10. don\'t use reset() to get the first array value
* Disabled E_DEPRECTED error logging when creating packages
');
$packagexml->setPackageType('php');
$packagexml->addRelease();
$packagexml->detectDependencies();
$packagexml->addMaintainer('lead', 'jeffhodsdon', 'Jeff Hodsdon', 'jeffhodsdon@gmail.com');
$packagexml->addMaintainer('lead', 'shupp', 'Bill Shupp', 'shupp@php.net');
$packagexml->setLicense('New BSD License', 'http://www.opensource.org/licenses/bsd-license.php');
$packagexml->setPhpDep('5.1.2');
$packagexml->setPearinstallerDep('1.4.0');
$packagexml->addPackageDepWithChannel('required', 'PEAR', 'pear.php.net', '1.4.0');
$packagexml->addPackageDepWithChannel('required', 'HTTP_Request2', 'pear.php.net', '0.5.1');
$packagexml->addPackageDepWithChannel('optional', 'Log', 'pear.php.net');
$packagexml->addPackageDepWithChannel('optional', 'Cache_Lite', 'pear.php.net');
$packagexml->addExtensionDep('required', 'date');
$packagexml->addExtensionDep('required', 'SPL');
$packagexml->addExtensionDep('required', 'hash');
$packagexml->addExtensionDep('optional', 'pecl_http', '1.6.0');
$packagexml->generateContents();
$packagexml->writePackageFile();
示例4: main
/**
* Main entrypoint of the task
*/
function main()
{
$pkg = new PEAR_PackageFileManager2();
$e = $pkg->setOptions(array('baseinstalldir' => 'yii', 'packagedirectory' => $this->pkgdir, 'filelistgenerator' => 'file', 'simpleoutput' => true, 'ignore' => array(), 'roles' => array('*' => 'php')));
// PEAR error checking
if (PEAR::isError($e)) {
die($e->getMessage());
}
$pkg->setPackage($this->package);
$pkg->setSummary($this->summary);
$pkg->setDescription($this->pkgdescription);
$pkg->setChannel($this->channel);
$pkg->setReleaseStability($this->state);
$pkg->setAPIStability($this->state);
$pkg->setReleaseVersion($this->version);
$pkg->setAPIVersion($this->version);
$pkg->setLicense($this->license);
$pkg->setNotes($this->notes);
$pkg->setPackageType('php');
$pkg->setPhpDep('5.1.0');
$pkg->setPearinstallerDep('1.4.2');
$pkg->addRelease();
$pkg->addMaintainer('lead', 'qxue', 'Qiang Xue', 'qiang.xue@gmail.com');
$test = $pkg->generateContents();
$e = $pkg->writePackageFile();
if (PEAR::isError($e)) {
echo $e->getMessage();
}
}
示例5: list
}
$package->setPackage($name);
$package->setSummary($summary);
$package->setDescription($description);
$package->setChannel('pear.limb-project.com');
$package->setAPIVersion($apiVersion);
$package->setReleaseVersion($version);
$package->setReleaseStability($state);
$package->setAPIStability($apiStability);
$package->setNotes($changelog);
$package->setPackageType('php');
$package->setLicense('LGPL', 'http://www.gnu.org/copyleft/lesser.txt');
foreach ($maintainers as $line) {
list($role, $nick, $name, $email, $active) = explode(',', $line);
$package->addMaintainer($role, $nick, $name, $email, $active);
}
$package->setPhpDep('5.1.4');
$package->setPearinstallerDep('1.4.99');
$package->addPackageDepWithChannel('required', 'core', 'pear.limb-project.com', '0.1.3');
$package->addPackageDepWithChannel('required', 'config', 'pear.limb-project.com', '0.2.0');
$package->addPackageDepWithChannel('required', 'datetime', 'pear.limb-project.com', '0.1.0');
$package->addPackageDepWithChannel('required', 'toolkit', 'pear.limb-project.com', '0.2.0');
$package->addPackageDepWithChannel('required', 'fs', 'pear.limb-project.com', '0.1.0');
$package->addPackageDepWithChannel('optional', 'cli', 'pear.limb-project.com', '0.2.0');
$package->addPackageDepWithChannel('optional', 'view', 'pear.limb-project.com', '0.1.0');
$package->generateContents();
$result = $package->writePackageFile();
if (PEAR::isError($result)) {
echo $result->getMessage();
exit(1);
}
示例6: array
$post_install_script = $pfm->initPostinstallScript($postinstall_file);
$post_install_script->addParamGroup('setup',
array($post_install_script->getParam('db_user', 'User', 'string', 'root'),
$post_install_script->getParam('db_password', 'Password', 'string', ''),
$post_install_script->getParam('db_host', 'Host', 'string', 'localhost'),
$post_install_script->getParam('db_name', 'Database', 'string', 'intraface'),
$post_install_script->getParam('path_root', 'Root path', 'string', '/home/intraface/'),
$post_install_script->getParam('path_www', 'WWW Path', 'string', '/'),
$post_install_script->getParam('path_template', 'template path', 'string', '/'),
$post_install_script->getParam('path_template_kundelogin', 'kundelogin template', 'string', '/'),
$post_install_script->getParam('intraface_private_key', 'Intraface key', 'string', '/'),
$post_install_script->getParam('quickpay_merchant_id', 'Quickpay merchant', 'string', '/'),
$post_install_script->getParam('quickpay_md5_secret', 'Quickpay secret', 'string', '/'),
),
'');
$pfm->addPostInstallTask($post_install_script, $postinstall_file);
*/
$pfm->addInstallAs('www/.htaccess', 'elevforeningen.vih.dk/.htaccess');
$pfm->addInstallAs('www/index.php', 'elevforeningen.vih.dk/index.php');
$pfm->addInstallAs('www/gfx/images/vih75x151.gif', 'elevforeningen.vih.dk/gfx/images/vih75x151.gif');
$pfm->addInstallAs('www/gfx/images/widepics/hangingout1.jpg', 'elevforeningen.vih.dk/gfx/images/widepics/hangingout1.jpg');
$pfm->generateContents();
if (isset($_GET['make']) || isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make') {
if ($pfm->writePackageFile()) {
exit('package file written');
}
} else {
$pfm->debugPackageFile();
}
示例7: main
public function main()
{
require_once 'PEAR/PackageFileManager2.php';
require_once 'PEAR/Exception.php';
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'PEAR_ErrorToPEAR_Exception');
if (!$this->baseDir || !file_exists($this->baseDir)) {
throw new BuildException('Base directory is not defined or does not exist.');
}
if (!$this->buildDir || !file_exists($this->buildDir)) {
throw new BuildException('Build directory is not defined or does not exist.');
}
set_time_limit(0);
$this->log("Adding .keep files to empty directories", PROJECT_MSG_INFO);
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath('samples')), RecursiveIteratorIterator::CHILD_FIRST) as $dir) {
if ($dir->isDir()) {
foreach (new DirectoryIterator($dir->getPathname()) as $d) {
if (!in_array($d->getFilename(), array('.', '..'))) {
continue 2;
}
}
touch($dir->getPathname() . '/.keep');
}
}
$this->log("Building package contents in: {$this->dir}", PROJECT_MSG_INFO);
$version = $this->project->getProperty('agavi.pear.version');
$status = $this->project->getProperty('agavi.status');
// Modify short description. Try to keep under 80 chars width
$shortDesc = <<<EOD
PHP5 MVC Application Framework
EOD;
// Modify long description. Try to keep under 80 chars width
$longDesc = <<<EOD
Agavi is a full-featured MVC-style framework for PHP5 with a strong focus on structure, code reusability and flexibility.
EOD;
$p2 = new PEAR_PackageFileManager2();
$p2->setOptions(array('filelistgenerator' => 'file', 'outputdirectory' => $this->baseDir, 'packagedirectory' => $this->buildDir, 'baseinstalldir' => 'agavi', 'ignore' => array('.svn/'), 'addhiddenfiles' => true, 'dir_roles' => array('/' => 'php', 'bin' => 'script', 'samples' => 'data'), 'installexceptions' => array('bin/agavi-dist' => '/', 'bin/agavi.bat-dist' => '/'), 'exceptions' => array('API_CHANGELOG' => 'doc', 'CHANGELOG' => 'doc', 'COPYRIGHT' => 'doc', 'INSTALL' => 'doc', 'LICENSE' => 'doc', 'LICENSE-AGAVI' => 'doc', 'LICENSE-ICU' => 'doc', 'LICENSE-SCHEMATRON' => 'doc', 'LICENSE-UNICODE_CLDR' => 'doc', 'RELEASE_NOTES' => 'doc', 'UPGRADING' => 'doc')));
$p2->setPackageType('php');
$p2->setPackage('agavi');
$p2->addMaintainer('lead', 'david', 'David Zülke', 'david.zuelke@bitextender.com');
$p2->addMaintainer('developer', 'dominik', 'Dominik del Bondio', 'dominik.del.bondio@bitextender.com');
$p2->addMaintainer('developer', 'felix', 'Felix Gilcher', 'felix.gilcher@bitextender.com');
$p2->addMaintainer('developer', 'impl', 'Noah Fontes', 'nfontes@cynigram.com');
$p2->addMaintainer('developer', 'v-dogg', 'Veikko Mäkinen', 'mail@veikkomakinen.com');
$p2->setChannel('pear.agavi.org');
$p2->setReleaseVersion($version);
$p2->setAPIVersion($version);
$p2->setReleaseStability($status);
$p2->setAPIStability($status);
$p2->setSummary($shortDesc);
$p2->setDescription($longDesc);
$p2->setNotes("To see what's new, please refer to the RELEASE_NOTES. Also, the CHANGELOG contains a full list of changes.\n\nFor installation instructions, consult INSTALL. Information on how to migrate applications written using previous releases can be found in UPGRADING.");
// this must be the most stupid syntax I've ever seen.
$p2->addRelease();
$p2->setOSInstallCondition('windows');
$p2->addInstallAs('bin/agavi.bat-dist', 'agavi.bat');
$p2->addIgnoreToRelease('bin/agavi-dist');
// and the next release... very cool, eh? how utterly stupid is that
$p2->addRelease();
$p2->addInstallAs('bin/agavi-dist', 'agavi');
$p2->addIgnoreToRelease('bin/agavi.bat-dist');
$p2->addPackageDepWithChannel('required', 'phing', 'pear.phing.info', '2.4.0');
$p2->addPackageDepWithChannel('optional', 'PHPUnit', 'pear.phpunit.de', '3.7.0');
$p2->addConflictingPackageDepWithChannel('phing', 'pear.php.net');
$p2->setPhpDep('5.2.0');
$p2->addExtensionDep('required', 'dom');
$p2->addExtensionDep('required', 'libxml');
$p2->addExtensionDep('required', 'SPL');
$p2->addExtensionDep('required', 'Reflection');
$p2->addExtensionDep('required', 'pcre');
$p2->addExtensionDep('optional', 'xsl');
$p2->addExtensionDep('optional', 'tokenizer');
$p2->addExtensionDep('optional', 'session');
$p2->addExtensionDep('optional', 'xmlrpc');
$p2->addExtensionDep('optional', 'PDO');
$p2->addExtensionDep('optional', 'iconv');
$p2->addExtensionDep('optional', 'gettext');
$p2->setPearinstallerDep('1.4.0');
$p2->setLicense('LGPL', 'http://www.gnu.org/copyleft/lesser.html');
$p2->addReplacement('bin/agavi-dist', 'pear-config', '@PEAR-DIR@', 'php_dir');
$p2->addReplacement('bin/agavi-dist', 'pear-config', '@PHP-BIN@', 'php_bin');
$p2->addReplacement('bin/agavi.bat-dist', 'pear-config', '@PEAR-DIR@', 'php_dir');
$p2->addReplacement('bin/agavi.bat-dist', 'pear-config', '@PHP-BIN@', 'php_bin');
$p2->addReplacement('src/build/build.xml', 'pear-config', '@PEAR-DIR@', 'php_dir');
$p2->generateContents();
try {
$p2->writePackageFile();
} catch (PEAR_Exception $e) {
$this->log("Oops! Caught PEAR Exception: " . $e->getMessage());
}
}
示例8: main
//.........这里部分代码省略.........
}
if ($this->_dependencies->pear !== false) {
$package->setPearinstallerDep($this->_dependencies->pear->minimum_version, $this->_dependencies->pear->maximum_version, $this->_dependencies->pear->recommended_version, $this->_dependencies->pear->exclude_version);
} else {
$package->setPearinstallerDep(PEAR_Config::singleton()->getRegistry()->packageInfo('PEAR', 'version'));
}
foreach ($this->_maintainers as $maintainer) {
$package->addMaintainer($maintainer->role, $maintainer->user, $maintainer->name, $maintainer->email, $maintainer->active);
}
// handle dependencies
if (!empty($this->_dependencies)) {
$this->log('adding dependencies');
if (count($this->_dependencies->groups) > 0) {
$this->log('found dependency groups');
foreach ($this->_dependencies->groups as $group) {
$this->log("adding [{$group->name}] :: [{$group->hint}]");
$package->addDependencyGroup($group->name, $group->hint);
foreach ($group->packages as $sub_package) {
$package->addGroupPackageDepWithChannel('subpackage', $group->name, $sub_package->name, $sub_package->channel, '0.0.1');
}
}
}
if (count($this->_dependencies->packages) > 0) {
$this->log('found dependencies');
foreach ($this->_dependencies->packages as $dependency) {
$this->log("adding following dependency: {$dependency->channel}/{$dependency->name}");
$package->addPackageDepWithChannel($dependency->type, $dependency->name, $dependency->channel, $dependency->minimum_version, $dependency->maximum_version, $dependency->recommended_version, $dependency->exclude_version, $dependency->providesextension, $dependency->nodefault);
}
}
if (count($this->_dependencies->extensions) > 0) {
$this->log('adding extension dependencies');
foreach ($this->_dependencies->extensions as $extension) {
$this->log("adding ext dependency for: {$extension->name}");
$package->addExtensionDep($extension->type, $extension->name, $extension->minimum_version, $extension->maximum_version, $extension->recommended_version, $extension->extension);
}
}
}
foreach ($this->_changelogs as $changelog) {
$this->log("adding changelog for prior release [{$changelog->version}]");
$changelog->package = $package;
$package->setChangelogEntry($changelog->version, $changelog->toArray());
if (is_null($this->_notes) && $package->getVersion() == $changelog->version) {
$this->log("no package notes specified, using changelog entry");
$this->_notes = $changelog->contents;
}
}
foreach ($this->_replacements as $replacement) {
$replacement->isValid();
$package->addReplacement($replacement->path, $replacement->type, $replacement->from, $replacement->to);
}
foreach ($this->_globalreplacements as $replacement) {
$replacement->isValid();
$this->log("adding global repalcement: {$replacement->from}");
$package->addGlobalReplacement($replacement->type, $replacement->from, $replacement->to);
}
foreach ($this->_releases as $release) {
$this->log('adding new release');
$package->addRelease();
foreach ($release->install as $install) {
$this->log("installing [{$install->name}] as [{$install->as}]");
$package->addInstallAs($install->name, $install->as);
}
}
$notes = preg_replace("/^( {4}|\t)+/m", '', $this->_notes->__toString());
$package->setNotes($notes);
$package->setLicense($this->_license->license, $this->_license->uri);
// handle PostInstallation
if (!empty($this->_postinstalls)) {
foreach ($this->_postinstalls as $postInstall) {
$postInstallScript = $package->initPostinstallScript($postInstall->script);
$this->log('adding post installation for script : ' . $postInstall->script);
foreach ($postInstall->paramgroups as $paramGroup) {
$this->log('adding parameter group' . $paramGroup->name);
$instructions = $paramGroup->instructions;
if (empty($instructions)) {
$instructions = false;
}
$params = array();
foreach ($paramGroup->params as $param) {
$this->log('adding parameter ' . $param->name);
$params[] = $postInstallScript->getParam($param->name, $param->prompt, $param->type, $param->default);
}
if (empty($params)) {
$params = false;
}
$postInstallScript->addParamGroup($paramGroup->name, $params, $instructions);
}
$e = $package->addPostInstallTask($postInstallScript, $postInstall->script);
if (PEAR::isError($e)) {
throw new d51PearPkg2Task_Exception('unable to add post install task: ' . $e->getMessage());
}
$this->log('Added POSTINSTALL for ' . $postInstall->script);
}
}
$package->generateContents();
$e = $package->writePackageFile();
if (PEAR::isError($e)) {
throw new d51PearPkg2Task_Exception('unable to write package.xml file: ' . $e->getMessage());
}
}
示例9:
$pfm->addIgnoreToRelease('bin/xref-lint.bat');
$pfm->addIgnoreToRelease('bin/xref-doc.bat');
$pfm->addInstallAs('bin/xref-lint', 'xref-lint');
$pfm->addInstallAs('bin/xref-doc', 'xref-doc');
$pfm->addInstallAs('bin/xref-ci', 'xref-ci');
$pfm->addInstallAs('bin/git-xref-lint', 'git-xref-lint');
$pfm->setPhpDep('5.2.0');
$pfm->setPearinstallerDep('1.4.0a12');
$pfm->addMaintainer('lead', 'gariev', 'Igor Gariev', 'gariev@hotmail.com');
$pfm->setLicense('PHP License', 'http://www.php.net/license');
$pfm->addGlobalReplacement('package-info', '@version@', 'version');
$pfm->addGlobalReplacement('pear-config', '@php_bin@', 'php_bin');
// path to php executable
$pfm->addGlobalReplacement('pear-config', '@bin_dir@', 'bin_dir');
// bin dir
$pfm->addGlobalReplacement('pear-config', '@php_dir@', 'php_dir');
// lib dir
$pfm->addGlobalReplacement('pear-config', '@data_dir@', 'data_dir');
// data dir ()
$pfm->addGlobalReplacement('pear-config', '@doc_dir@', 'doc_dir');
// data dir ()
$pfm->generateContents();
// remove 'baseinstalldir' from scripts
$filelist = $pfm->getFilelist();
foreach ($filelist as $filename => $attrs) {
if ($attrs['role'] == 'script') {
$pfm->setFileAttribute($filename, 'baseinstalldir', '');
}
}
$pfm->writePackageFile();
// vim: tabstop=4 expandtab
示例10: buildSubPackage
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', 'mtdowling@gmail.com', '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);
}
示例11: realpath
set_time_limit(0);
require_once 'PEAR/PackageFileManager2.php';
PEAR::setErrorHandling(PEAR_ERROR_PRINT);
$pkg = new PEAR_PackageFileManager2();
$pkg->setOptions(array('baseinstalldir' => '/', 'packagefile' => 'package2.xml', 'packagedirectory' => realpath(dirname(__FILE__) . '/library'), 'filelistgenerator' => 'file', 'include' => array('*'), 'dir_roles' => array('/' => 'php'), 'ignore' => array('HTMLPurifier.standalone.php', 'HTMLPurifier.path.php', 'standalone/')));
$pkg->setPackage('HTMLPurifier');
$pkg->setLicense('LGPL', 'http://www.gnu.org/licenses/lgpl.html');
$pkg->setSummary('Standards-compliant HTML filter');
$pkg->setDescription('HTML Purifier is an HTML filter that will remove all malicious code
(better known as XSS) with a thoroughly audited, secure yet permissive
whitelist and will also make sure your documents are standards
compliant.');
$pkg->addMaintainer('lead', 'ezyang', 'Edward Z. Yang', 'admin@htmlpurifier.org', 'yes');
$version = trim(file_get_contents('VERSION'));
$api_version = substr($version, 0, strrpos($version, '.'));
$pkg->setChannel('htmlpurifier.org');
$pkg->setAPIVersion($api_version);
$pkg->setAPIStability('stable');
$pkg->setReleaseVersion($version);
$pkg->setReleaseStability('stable');
$pkg->addRelease();
$pkg->setNotes(file_get_contents('WHATSNEW'));
$pkg->setPackageType('php');
$pkg->setPhpDep('5.0.0');
$pkg->setPearinstallerDep('1.4.3');
$pkg->generateContents();
$compat =& $pkg->exportCompatiblePackageFile1();
$compat->writePackageFile();
$pkg->writePackageFile();
// vim: et sw=4 sts=4
示例12:
$p2->setSummary($summary);
$p2->setDescription($description);
$p2->setChannel('pear.php.net');
$p2->setPackageType('php');
$p2->addGlobalReplacement('package-info', '@package_version@', 'version');
$p2->generateContents();
$p2->setReleaseVersion($current_version);
$p2->setAPIVersion('1.4.0');
$p2->setReleaseStability($current_stability);
$p2->setAPIStability('stable');
$p2->setNotes($current_notes);
$p2->addGlobalReplacement('package-info', '@package_version@', 'version');
$p2->addInstallAs('tests/AllTests.php', 'AllTests.php');
$p2->addInstallAs('tests/Net_FTPTest.php', 'Net_FTPTest.php');
$p2->addInstallAs('tests/config.php.dist', 'config.php.dist');
$p2->addInstallAs('tests/testfile.dat', 'testfile.dat');
$p2->addInstallAs('tests/extensions.ini', 'extensions.ini');
$p2->addRelease();
$p2->addMaintainer('lead', 'jorrit', 'Jorrit Schippers', 'jschippers@php.net', 'yes');
$p2->addMaintainer('lead', 'toby', 'Tobias Schlitt', 'toby@php.net', 'no');
$p2->setPhpDep('4.3.0');
$p2->setPearinstallerDep('1.3.0');
$p2->setLicense('BSD License', 'http://www.opensource.org/licenses/bsd-license.html');
$p2->addExtensionDep('required', 'ftp');
if (isset($_GET['make']) || isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make') {
echo "Writing package file\n";
$p2->writePackageFile();
} else {
echo "Debugging package file\n";
$p2->debugPackageFile();
}
示例13: main
/**
* Main entry point for d51pearpkg2 task
*/
public function main()
{
PEAR_Frontend::setFrontendObject(new d51PearPkg2Task_Frontend($this));
$package = new PEAR_PackageFileManager2();
$this->_initOptions();
$a = $package->setOptions($this->_options);
if (PEAR::isError($a)) {
$this->log($a->getMessage(), Project::MSG_ERR);
exit(-1);
}
$package->setPackage((string) $this->_name);
$package->setSummary((string) $this->_summary);
$desc = preg_replace("/^({$this->_description->indention_type}{{$this->_description->indentions_to_remove}}|\t)+/m", '', (string) $this->_description);
$package->setDescription($desc);
$package->setChannel((string) $this->_channel);
$package->setAPIVersion($this->_version->api);
$package->setReleaseVersion($this->_version->release);
$package->setAPIStability($this->_stability->api);
$package->setReleaseStability($this->_stability->release);
// TODO: allow different types
$package->setPackageType($this->_type);
$package->addRelease();
if (!is_null($this->_dependencies->php)) {
$this->log('Using explicit PHP minimum version: ' . $this->_dependencies->php->minimum_version);
$package->setPhpDep($this->_dependencies->php->minimum_version);
} else {
$this->log('Using current PHP version as minimum: ' . phpversion());
$package->setPhpDep(phpversion());
}
if (!is_null($this->_dependencies->pear)) {
$this->log('setting minimum PEAR version: ' . $this->_dependencies->pear->minimum_version);
$package->setPearinstallerDep($this->_dependencies->pear->minimum_version, $this->_dependencies->pear->maximum_version, $this->_dependencies->pear->recommended_version, $this->_dependencies->pear->exclude_version);
} else {
$this->log('setting minimum PEAR version to currently installed version');
$pear_version = PEAR_Config::singleton()->getRegistry()->packageInfo('PEAR', 'version');
$this->log('minimum PEAR version: ' . $pear_version);
$package->setPearinstallerDep(PEAR_Config::singleton()->getRegistry()->packageInfo('PEAR', 'version'));
}
foreach ($this->_maintainers as $maintainer) {
$this->log("adding maintainer [{$maintainer->user}/{$maintainer->name}] with role [{$maintainer->role}]");
$package->addMaintainer($maintainer->role, $maintainer->user, $maintainer->name, $maintainer->email, $maintainer->active);
}
// handle dependencies
if (!empty($this->_dependencies)) {
$this->log('adding dependencies');
if (count($this->_dependencies->groups) > 0) {
$this->log('found dependency groups');
foreach ($this->_dependencies->groups as $group) {
$this->log("adding [{$group->name}] :: [{$group->hint}]");
$package->addDependencyGroup($group->name, $group->hint);
foreach ($group->packages as $sub_package) {
$package->addGroupPackageDepWithChannel('subpackage', $group->name, $sub_package->name, $sub_package->channel, '0.0.1');
}
}
}
if (count($this->_dependencies->packages) > 0) {
$this->log('found dependencies');
foreach ($this->_dependencies->packages as $dependency) {
$this->log("adding following dependency: {$dependency->channel}/{$dependency->name}");
$package->addPackageDepWithChannel($dependency->type, $dependency->name, $dependency->channel, $dependency->minimum_version, $dependency->maximum_version, $dependency->recommended_version, $dependency->exclude_version, $dependency->providesextension, $dependency->nodefault);
}
}
if (count($this->_dependencies->extensions) > 0) {
$this->log('adding extension dependencies');
foreach ($this->_dependencies->extensions as $extension) {
$this->log("adding ext dependency for: {$extension->name}");
$package->addExtensionDep($extension->type, $extension->name, $extension->minimum_version, $extension->maximum_version, $extension->recommended_version, $extension->extension);
}
}
}
foreach ($this->_changelogs as $changelog) {
$this->log("adding changelog for prior release [{$changelog->version}]");
$changelog->package = $package;
$package->setChangelogEntry($changelog->version, $changelog->toArray());
if (is_null($this->_notes) && $package->getVersion() == $changelog->version) {
$this->log("no package notes specified, using changelog entry");
$this->_notes = $changelog->contents;
}
}
foreach ($this->_replacements as $replacement) {
$replacement->isValid();
$this->log("adding replace from [{$replacement->from}] to [{$replacement->to}]");
$package->addReplacement($replacement->path, $replacement->type, $replacement->from, $replacement->to);
}
foreach ($this->_releases as $release) {
$this->log('adding new release');
$package->addRelease();
foreach ($release->install as $install) {
$this->log("installing [{$install->name}] as [{$install->as}]");
$package->addInstallAs($install->name, $install->as);
}
}
$notes = preg_replace("/^( {4}|\t)+/m", '', (string) $this->_notes);
$package->setNotes($notes);
$package->setLicense($this->_license->license, $this->_license->uri);
$package->generateContents();
$e = $package->writePackageFile();
//.........这里部分代码省略.........
示例14: handleError
$pkg->setNotes($notes);
$pkg->setPackageType('php');
$pkg->setPhpDep('5.0.0');
$pkg->setPearinstallerDep('1.4.9');
// Require custom file role for our web installation
// $pkg->addPackageDepWithChannel('required', 'Role_Web', 'pearified.com');
// Define that we will use our custom file role in this script
// $pkg->addUsesRole('web', 'Webfiles');
// Create the current release and add it to the package definition
$pkg->addRelease();
handleError($pkg->generateContents());
// Package release needs a maintainer
foreach ($maintainers as $m) {
handleError($pkg->addMaintainer($m[0], $m[1], $m[2], $m[3]));
}
if ($argv[1] === 'write') {
handleError($pkg->writePackageFile());
exit(1);
}
handleError($pkg->debugPackageFile());
/**
* Simple error handler
*
* @param Exception $e
*/
function handleError($e)
{
if (PEAR::isError($e)) {
die($e->getMessage());
}
}
示例15: array
/**
* @access private
*/
function &_makePackage($setting, $workdir)
{
// package.xml を作る
$pkgconfig = array('packagedirectory' => $workdir, 'outputdirectory' => $workdir, 'ignore' => array('CVS/', '.cvsignore', '.svn/', 'package.xml', '*.ini', $setting['pkgname'] . '-*.tgz'), 'filelistgenerator' => 'file', 'changelogoldtonew' => false);
$packagexml = new PEAR_PackageFileManager2();
$pkgconfig = array_merge($pkgconfig, $setting['config']);
$packagexml->setOptions($pkgconfig);
$packagexml->setPackage($setting['pkgname']);
$packagexml->setSummary($setting['summary']);
$packagexml->setNotes($setting['notes']);
$packagexml->setDescription($setting['description']);
$packagexml->setChannel($setting['channel']);
$packagexml->setAPIVersion($setting['version']);
$packagexml->setReleaseVersion($setting['version']);
$packagexml->setReleaseStability($setting['state']);
$packagexml->setAPIStability($setting['state']);
$packagexml->setPackageType('php');
foreach ($setting['maintainers'] as $m) {
$packagexml->addMaintainer($m['role'], $m['user'], $m['name'], $m['email'], $m['active']);
}
$packagexml->setLicense($setting['license']['name'], $setting['license']['uri']);
$packagexml->addRole('css', 'php');
$packagexml->addRole('tpl', 'php');
$packagexml->addRole('ethna', 'php');
$packagexml->addRole('sh', 'script');
$packagexml->addRole('bat', 'script');
$packagexml->setPhpDep('4.3.0');
$packagexml->setPearinstallerDep('1.3.5');
$packagexml->generateContents();
foreach ($setting['callback'] as $method => $params) {
$r = call_user_func_array(array(&$packagexml, $method), $params);
}
$r = $packagexml->writePackageFile();
if (PEAR::isError($r)) {
return Ethna::raiseError($r->getMessage, $r->getCode());
}
// finally make package
PEAR_Command::setFrontendType('CLI');
$ui = PEAR_Command::getFrontendObject();
$config = PEAR_Config::singleton();
$ui->setConfig($config);
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$ui, 'displayFatalError'));
$cmd = PEAR_Command::factory('package', $config);
if (PEAR::isError($cmd)) {
return Ethna::raiseError($cmd->getMessage, $cmd->getCode());
}
$r = $cmd->run('package', array(), array("{$workdir}/package.xml"));
if (PEAR::isError($r)) {
return Ethna::raiseError($r->getMessage, $r->getCode());
}
}