cvs: pear-core /PEAR/Command Package.php

From: Date: Fri, 11 Jul 2008 20:17:38 +0000
Subject: cvs: pear-core /PEAR/Command Package.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7630@lists.php.net to get a copy of this message
dufuz Fri Jul 11 20:17:38 2008 UTC Modified files: /pear-core/PEAR/Command Package.php Log: Cosmetics, use realpath http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Command/Package.php?r1=1.128&r2=1.129&diff_format=u Index: pear-core/PEAR/Command/Package.php diff -u pear-core/PEAR/Command/Package.php:1.128 pear-core/PEAR/Command/Package.php:1.129 --- pear-core/PEAR/Command/Package.php:1.128 Sat Mar 29 21:06:58 2008 +++ pear-core/PEAR/Command/Package.php Fri Jul 11 20:17:38 2008 @@ -18,7 +18,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: Package.php,v 1.128 2008/03/29 21:06:58 dufuz Exp $ + * @version CVS: $Id: Package.php,v 1.129 2008/07/11 20:17:38 dufuz Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -400,11 +400,14 @@ $help = $this->getHelp($command); return $this->raiseError("$command: missing parameter: $help[0]"); } - $obj = &$this->getPackageFile($this->config, $this->_debug); - $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL); + + $file = realpath($params[0]); + $obj = &$this->getPackageFile($this->config, $this->_debug); + $info = $obj->fromAnyFile($file, PEAR_VALIDATE_NORMAL); if (PEAR::isError($info)) { return $this->raiseError($info); } + $err = $warn = array(); if (!$info->validate()) { foreach ($info->getValidationWarnings() as $error) { @@ -415,40 +418,49 @@ } } } + if (!$this->_displayValidationResults($err, $warn, true)) { $this->ui->outputData($this->output, $command); return $this->raiseError('CVS tag failed'); } - $version = $info->getVersion(); + + $version = $info->getVersion(); $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version); - $cvstag = "RELEASE_$cvsversion"; - $files = array_keys($info->getFilelist()); - $command = "cvs"; + $cvstag = "RELEASE_$cvsversion"; + $files = array_keys($info->getFilelist()); + $command = 'cvs'; if (isset($options['quiet'])) { $command .= ' -q'; } + if (isset($options['reallyquiet'])) { $command .= ' -Q'; } + $command .= ' tag'; if (isset($options['slide'])) { $command .= ' -F'; } + if (isset($options['delete'])) { $command .= ' -d'; } + $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]); array_shift($params); if (count($params)) { // add in additional files to be tagged $files = array_merge($files, $params); } + foreach ($files as $file) { $command .= ' ' . escapeshellarg($file); } + if ($this->config->get('verbose') > 1) { $this->output .= "+ $command\n"; } + $this->output .= "+ $command\n"; if (empty($options['dry-run'])) { $fp = popen($command, "r"); @@ -457,6 +469,7 @@ } pclose($fp); } + $this->ui->outputData($this->output, $_cmd); return true; } @@ -471,11 +484,14 @@ $help = $this->getHelp($command); return $this->raiseError("$command: missing parameter: $help[0]"); } - $obj = &$this->getPackageFile($this->config, $this->_debug); - $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL); + + $file = realpath($params[0]); + $obj = &$this->getPackageFile($this->config, $this->_debug); + $info = $obj->fromAnyFile($file, PEAR_VALIDATE_NORMAL); if (PEAR::isError($info)) { return $this->raiseError($info); } + $err = $warn = array(); if (!$info->validate()) { foreach ($info->getValidationWarnings() as $error) { @@ -486,10 +502,12 @@ } } } + if (!$this->_displayValidationResults($err, $warn, true)) { $this->ui->outputData($this->output, $command); return $this->raiseError('CVS diff failed'); } + $info1 = $info->getFilelist(); $files = $info1; $cmd = "cvs"; @@ -497,21 +515,25 @@ $cmd .= ' -q'; unset($options['quiet']); } + if (isset($options['reallyquiet'])) { $cmd .= ' -Q'; unset($options['reallyquiet']); } + if (isset($options['release'])) { $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $options['release']); $cvstag = "RELEASE_$cvsversion"; $options['revision'] = $cvstag; unset($options['release']); } + $execute = true; if (isset($options['dry-run'])) { $execute = false; unset($options['dry-run']); } + $cmd .= ' diff'; // the rest of the options are passed right on to "cvs diff" foreach ($options as $option => $optarg) { @@ -525,12 +547,15 @@ $cmd .= ($short ? '' : '=') . escapeshellarg($optarg); } } + foreach ($files as $file) { $cmd .= ' ' . escapeshellarg($file['name']); } + if ($this->config->get('verbose') > 1) { $this->output .= "+ $cmd\n"; } + if ($execute) { $fp = popen($cmd, "r"); while ($line = fgets($fp, 1024)) { @@ -538,6 +563,7 @@ } pclose($fp); } + $this->ui->outputData($this->output, $command); return true; }

« previous php.pear.core (#7630) next »