Source for file Packager.php
Documentation is available at Packager.php
* PEAR_Packager for generating releases
* @author Stig Bakken <ssb@php.net>
* @author Tomas V. V. Cox <cox@idecnet.com>
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: Packager.php 313023 2011-07-06 19:17:11Z dufuz $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1
require_once 'PEAR/Common.php';
require_once 'PEAR/PackageFile.php';
require_once 'System.php';
* Administration class used to make a PEAR release tarball.
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.9.4
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 0.1
function package($pkgfile = null , $compress = true , $pkg2 = null )
// {{{ validate supplied package.xml file
$pkgfile = 'package.xml';
foreach ($pf->getUserInfo () as $error) {
$this->log(0 , 'Error: ' . $error['message']);
$this->log(0 , $pf->getMessage ());
return $this->raiseError("Cannot package, errors in package file");
foreach ($pf->getValidationWarnings () as $warning) {
$this->log(1 , 'Warning: ' . $warning['message']);
$this->log(0 , 'Attempting to process the second package file');
foreach ($pf2->getUserInfo () as $error) {
$this->log(0 , 'Error: ' . $error['message']);
$this->log(0 , $pf2->getMessage ());
return $this->raiseError("Cannot package, errors in second package file");
foreach ($pf2->getValidationWarnings () as $warning) {
$this->log(1 , 'Warning: ' . $warning['message']);
if ($pf2->getPackagexmlVersion () == '2.0' ||
$pf2->getPackagexmlVersion () == '2.1'
if ($main->getPackagexmlVersion () != '2.0' &&
$main->getPackagexmlVersion () != '2.1') {
return PEAR::raiseError('Error: cannot package two package.xml version 1.0, can ' .
'only package together a package.xml 1.0 and package.xml 2.0');
if ($other->getPackagexmlVersion () != '1.0') {
return PEAR::raiseError('Error: cannot package two package.xml version 2.0, can ' .
'only package together a package.xml 1.0 and package.xml 2.0');
foreach ($main->getValidationWarnings () as $warning) {
$this->log(0 , 'Error: ' . $warning['message']);
return $this->raiseError("Cannot package, errors in package");
foreach ($main->getValidationWarnings () as $warning) {
$this->log(1 , 'Warning: ' . $warning['message']);
$other->setLogger ($this);
foreach ($other->getValidationWarnings () as $warning) {
$this->log(0 , 'Error: ' . $warning['message']);
foreach ($main->getValidationWarnings () as $warning) {
$this->log(0 , 'Error: ' . $warning['message']);
return $this->raiseError('The two package.xml files are not equivalent!');
return $this->raiseError("Cannot package, errors in package");
foreach ($other->getValidationWarnings () as $warning) {
$this->log(1 , 'Warning: ' . $warning['message']);
$gen = &$main->getDefaultGenerator ();
$tgzfile = $gen->toTgz2 ($this, $other, $compress);
// TAR the Package -------------------------------------------
$this->log(1 , " Package $dest_package done" );
$cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion ());
$cvstag = " RELEASE_$cvsversion";
$this->log(1 , 'Tag the released code with "pear cvstag ' .
$main->getPackageFile () . '"');
$this->log(1 , " (or set the CVS tag $cvstag by hand)" );
$svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion ());
$svntag = $pf->getName () . " -$svnversion";
$this->log(1 , 'Tag the released code with "pear svntag ' .
$main->getPackageFile () . '"');
$this->log(1 , " (or set the SVN tag $svntag by hand)" );
} else { // this branch is executed for single packagefile packaging
$gen = &$pf->getDefaultGenerator ();
$tgzfile = $gen->toTgz ($this, $compress);
$this->log(0 , $tgzfile->getMessage ());
return $this->raiseError("Cannot package, errors in package");
// TAR the Package -------------------------------------------
$this->log(1 , " Package $dest_package done" );
$cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion ());
$cvstag = " RELEASE_$cvsversion";
$this->log(1 , " Tag the released code with `pear cvstag $pkgfile'" );
$this->log(1 , " (or set the CVS tag $cvstag by hand)" );
$svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion ());
$svntag = $pf->getName () . " -$svnversion";
$this->log(1 , " Tag the released code with `pear svntag $pkgfile'" );
$this->log(1 , " (or set the SVN tag $svntag by hand)" );
Documentation generated on Wed, 06 Jul 2011 23:31:03 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.
|