cvs: pear-core /PEAR Packager.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Fri, 11 Jul 2008 20:53:30 +0000 |
| Subject: | cvs: pear-core /PEAR Packager.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7634@lists.php.net to get a copy of this message | ||
dufuz Fri Jul 11 20:53:30 2008 UTC
Modified files:
/pear-core/PEAR Packager.php
Log:
Cosmetics
http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Packager.php?r1=1.72&r2=1.73&diff_format=u
Index: pear-core/PEAR/Packager.php
diff -u pear-core/PEAR/Packager.php:1.72 pear-core/PEAR/Packager.php:1.73
--- pear-core/PEAR/Packager.php:1.72 Fri Jul 11 20:43:56 2008
+++ pear-core/PEAR/Packager.php Fri Jul 11 20:53:30 2008
@@ -17,7 +17,7 @@
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2008 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Packager.php,v 1.72 2008/07/11 20:43:56 dufuz Exp $
+ * @version CVS: $Id: Packager.php,v 1.73 2008/07/11 20:53:30 dufuz Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1
*/
@@ -55,9 +55,10 @@
if (empty($pkgfile)) {
$pkgfile = 'package.xml';
}
+
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $pkg = &new PEAR_PackageFile($this->config, $this->debug);
- $pf = &$pkg->fromPackageFile($pkgfile, PEAR_VALIDATE_NORMAL);
+ $pkg = &new PEAR_PackageFile($this->config, $this->debug);
+ $pf = &$pkg->fromPackageFile($pkgfile, PEAR_VALIDATE_NORMAL);
$main = &$pf;
PEAR::staticPopErrorHandling();
if (PEAR::isError($pf)) {
@@ -66,12 +67,13 @@
$this->log(0, 'Error: ' . $error['message']);
}
}
+
$this->log(0, $pf->getMessage());
return $this->raiseError("Cannot package, errors in package file");
- } else {
- foreach ($pf->getValidationWarnings() as $warning) {
- $this->log(1, 'Warning: ' . $warning['message']);
- }
+ }
+
+ foreach ($pf->getValidationWarnings() as $warning) {
+ $this->log(1, 'Warning: ' . $warning['message']);
}
// }}}
@@ -88,40 +90,46 @@
}
$this->log(0, $pf2->getMessage());
return $this->raiseError("Cannot package, errors in second package
file");
- } else {
- foreach ($pf2->getValidationWarnings() as $warning) {
- $this->log(1, 'Warning: ' . $warning['message']);
- }
}
+
+ foreach ($pf2->getValidationWarnings() as $warning) {
+ $this->log(1, 'Warning: ' . $warning['message']);
+ }
+
if ($pf2->getPackagexmlVersion() == '2.0' ||
- $pf2->getPackagexmlVersion() == '2.1') {
- $main = &$pf2;
+ $pf2->getPackagexmlVersion() == '2.1'
+ ) {
+ $main = &$pf2;
$other = &$pf;
} else {
- $main = &$pf;
+ $main = &$pf;
$other = &$pf2;
}
+
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');
}
}
+
$main->setLogger($this);
if (!$main->validate(PEAR_VALIDATE_PACKAGING)) {
foreach ($main->getValidationWarnings() as $warning) {
$this->log(0, 'Error: ' . $warning['message']);
}
return $this->raiseError("Cannot package, errors in package");
- } else {
- foreach ($main->getValidationWarnings() as $warning) {
- $this->log(1, 'Warning: ' . $warning['message']);
- }
}
+
+ foreach ($main->getValidationWarnings() as $warning) {
+ $this->log(1, 'Warning: ' . $warning['message']);
+ }
+
if ($pkg2) {
$other->setLogger($this);
$a = false;
@@ -129,25 +137,30 @@
foreach ($other->getValidationWarnings() as $warning) {
$this->log(0, 'Error: ' . $warning['message']);
}
+
foreach ($main->getValidationWarnings() as $warning) {
$this->log(0, 'Error: ' . $warning['message']);
}
+
if ($a) {
return $this->raiseError('The two package.xml files are not
equivalent!');
}
+
return $this->raiseError("Cannot package, errors in package");
- } else {
- foreach ($other->getValidationWarnings() as $warning) {
- $this->log(1, 'Warning: ' . $warning['message']);
- }
}
+
+ foreach ($other->getValidationWarnings() as $warning) {
+ $this->log(1, 'Warning: ' . $warning['message']);
+ }
+
$gen = &$main->getDefaultGenerator();
$tgzfile = $gen->toTgz2($this, $other, $compress);
if (PEAR::isError($tgzfile)) {
return $tgzfile;
}
+
$dest_package = basename($tgzfile);
- $pkgdir = dirname($pkgfile);
+ $pkgdir = dirname($pkgfile);
// TAR the Package -------------------------------------------
$this->log(1, "Package $dest_package done");
@@ -165,8 +178,9 @@
$this->log(0, $tgzfile->getMessage());
return $this->raiseError("Cannot package, errors in package");
}
+
$dest_package = basename($tgzfile);
- $pkgdir = dirname($pkgfile);
+ $pkgdir = dirname($pkgfile);
// TAR the Package -------------------------------------------
$this->log(1, "Package $dest_package done");
@@ -177,8 +191,8 @@
$this->log(1, "(or set the CVS tag $cvstag by hand)");
}
}
+
return $dest_package;
}
-
// }}}
}
\ No newline at end of file