cvs: pear /PEAR_Size TODO package.xml /PEAR_Size/Size Size.php Size_Factory.php Size_Output_csv.php Size_Output_html.php Size_Output_text.php
/PEAR_Size/scripts pearsize.php
| From: | Ken Guest | Date: | Mon, 31 Mar 2008 22:33:18 +0000 |
| Subject: | cvs: pear /PEAR_Size TODO package.xml /PEAR_Size/Size Size.php Size_Factory.php Size_Output_csv.php Size_Output_html.php Size_Output_text.php /PEAR_Size/scripts pearsize.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-51759@lists.php.net to get a copy of this message | ||
kguest Mon Mar 31 22:33:18 2008 UTC
Modified files:
/pear/PEAR_Size TODO package.xml
/pear/PEAR_Size/Size Size.php Size_Factory.php Size_Output_csv.php
Size_Output_html.php Size_Output_text.php
/pear/PEAR_Size/scripts pearsize.php
Log:
xml output + bug #13549 + tweaks
http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/TODO?r1=1.3&r2=1.4&diff_format=u Index: pear/PEAR_Size/TODO diff -u pear/PEAR_Size/TODO:1.3 pear/PEAR_Size/TODO:1.4 --- pear/PEAR_Size/TODO:1.3 Thu Mar 27 22:46:27 2008 +++ pear/PEAR_Size/TODO Mon Mar 31 22:33:18 2008 @@ -1,6 +1,4 @@ - include an option to account for dependencies in displayed file sizes; this option would only be available/valid if only one 'target' package. -- CSV output driver - - Right alignment of the sizes would be nice http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/package.xml?r1=1.3&r2=1.4&diff_format=u Index: pear/PEAR_Size/package.xml diff -u pear/PEAR_Size/package.xml:1.3 pear/PEAR_Size/package.xml:1.4 --- pear/PEAR_Size/package.xml:1.3 Sat Mar 29 01:03:58 2008 +++ pear/PEAR_Size/package.xml Mon Mar 31 22:33:18 2008 @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<package packagerversion="1.6.2" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> +<package packagerversion="1.7.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>PEAR_Size</name> <channel>pear.php.net</channel> <summary>Determine and list how much filespace each installed package consumes.</summary> - <description>A commandline tool modeled on 'df' that lists how much filespace each installed package consumes. A subset of packages can be specified as can channels.</description> + <description>A commandline tool modeled on 'df' that lists how much filespace each installed package consumes. A subset of packages can be specified as can channels.</description> <lead> <name>Ken Guest</name> <user>kguest</user> <email>kguest@php.net</email> <active>yes</active> </lead> - <date>2008-03-18</date> - <time>19:05:05</time> + <date>2008-03-29</date> + <time>01:20:09</time> <version> <release>0.1.1</release> <api>0.1.0</api> @@ -21,33 +21,51 @@ <api>alpha</api> </stability> <license uri="http://www.gnu.org/licenses/lgpl.html">LGPL</license> - <notes>Initial release</notes> + <notes> +* channel summary +* CSV output + </notes> <contents> <dir baseinstalldir="PEAR" name="/"> - <dir name="scripts"> - <file baseinstalldir="/" name="pearsize.bat" role="script" install-as="pearsize.bat"> - <tasks:replace from="@PHP-BIN@" to="php_bin" type="pear-config" /> - <tasks:replace from="@BIN-DIR@" to="bin_dir" type="pear-config" /> - <tasks:replace from="@PEAR-DIR@" to="php_dir" type="pear-config" /> - <tasks:replace from="@DATA-DIR@" to="data_dir" type="pear-config" /> - <tasks:windowseol /> - </file> - <file baseinstalldir="/" name="pearsize.php" role="script" install-as="pearsize"> - <tasks:replace from="@PHP-BIN@" to="php_bin" type="pear-config" /> - <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> - <tasks:unixeol /> - </file> - </dir> - <file baseinstalldir="/" name="Size/Size.php" role="php" install-as="PEAR/Size.php"/> - <file baseinstalldir="/" name="Size/Size_Factory.php" role="php" install-as="PEAR/Size/Factory.php"/> - <file baseinstalldir="/" name="Size/Size_Output_csv.php" role="php" install-as="PEAR/Size/Output_csv.php"/> - <file baseinstalldir="/" name="Size/Size_Output_text.php" role="php" install-as="PEAR/Size/Output_text.php"/> - <file baseinstalldir="/" name="Size/Size_Output_html.php" role="php" install-as="PEAR/Size/Output_html.php"/> - <file name="TODO" role="doc" /> <dir name="docs"> - <file name="script-usage.txt" role="doc" /> - </dir> - </dir> + <file baseinstalldir="PEAR" name="script-usage.txt" role="doc" /> + </dir> <!-- /docs --> + <dir name="scripts"> + <file baseinstalldir="/" install-as="pearsize.bat" name="pearsize.bat" role="script"> + <tasks:replace from="@PHP-BIN@" to="php_bin" type="pear-config" /> + <tasks:replace from="@BIN-DIR@" to="bin_dir" type="pear-config" /> + <tasks:replace from="@PEAR-DIR@" to="php_dir" type="pear-config" /> + <tasks:replace from="@DATA-DIR@" to="data_dir" type="pear-config" /> + <tasks:windowseol /> + </file> + <file baseinstalldir="/" install-as="pearsize" name="pearsize.php" role="script"> + <tasks:replace from="@PHP-BIN@" to="php_bin" type="pear-config" /> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + <tasks:unixeol /> + </file> + </dir> <!-- /scripts --> + <dir name="Size"> + <file baseinstalldir="/" install-as="PEAR/Size.php" name="Size.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + <file baseinstalldir="/" install-as="PEAR/Size/Factory.php" name="Size_Factory.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + <file baseinstalldir="/" install-as="PEAR/Size/Output_csv.php" name="Size_Output_csv.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + <file baseinstalldir="/" install-as="PEAR/Size/Output_html.php" name="Size_Output_html.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + <file baseinstalldir="/" install-as="PEAR/Size/Output_text.php" name="Size_Output_text.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + <file baseinstalldir="/" install-as="PEAR/Size/Output_xml.php" name="Size_Output_xml.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + </dir> <!-- /Size --> + <file baseinstalldir="PEAR" name="TODO" role="doc" /> + </dir> <!-- / --> </contents> <dependencies> <required> @@ -81,32 +99,35 @@ </os> </installconditions> <filelist> - <install name="scripts/pearsize.bat" as="pearsize.bat" /> + <install as="pearsize.bat" name="scripts/pearsize.bat" /> </filelist> </phprelease> <phprelease> <filelist> - <ignore name="scripts/pearsize.bat"/> + <ignore name="scripts/pearsize.bat" /> </filelist> </phprelease> <changelog> <release> <version> - <release>0.0.1</release> - <api>0.0.1</api> + <release>0.1.1</release> + <api>0.1.0</api> </version> <stability> <release>alpha</release> <api>alpha</api> </stability> - <date>2008-01-05</date> + <date>2008-03-29</date> <license uri="http://www.gnu.org/licenses/lgpl.html">LGPL</license> - <notes>Initial version</notes> + <notes> +* channel summary +* CSV output + </notes> </release> <release> <version> - <release>0.1.1</release> - <api>0.1.0</api> + <release>0.0.1</release> + <api>0.0.1</api> </version> <stability> <release>alpha</release> http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size.php?r1=1.9&r2=1.10&diff_format=u Index: pear/PEAR_Size/Size/Size.php diff -u pear/PEAR_Size/Size/Size.php:1.9 pear/PEAR_Size/Size/Size.php:1.10 --- pear/PEAR_Size/Size/Size.php:1.9 Sat Mar 29 01:03:59 2008 +++ pear/PEAR_Size/Size/Size.php Mon Mar 31 22:33:18 2008 @@ -8,7 +8,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size.php,v 1.9 2008/03/29 01:03:59 kguest Exp $ + * @version CVS: $Id: Size.php,v 1.10 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ @@ -38,7 +38,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size @@ -202,43 +202,6 @@ private $_verbose = false; /** - * Determine a more readable form of the given size. - * - * @param int $size size value - * @param string $retstring formatting string; null by default. - * @param boolean $round round to multiples of 1000? false by default. - * - * @return string - */ - static function _sizeReadable($size, $retstring = null, $round = false) - { - //adapted from Public Domain licensed code at - //http://aidanlister.com/repos/v/function.size_readable.php - $sizes = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); - $factor = 1024; - if ($round) { - $factor = 1000; - } - if ($retstring === null) { - $retstring = '%01.2f %s'; - } - $lastsizestring = end($sizes); - foreach ($sizes as $sizestring) { - if ($size < $factor) { - break; - } - if ($sizestring !== $lastsizestring) { - $size /= $factor; - } - } - if ($sizestring === $sizes[0]) { - $retstring = '%01d %s'; - } elseif ($sizestring === 'KB' && $round) { - $sizestring = 'kB'; - } - return sprintf($retstring, $size, $sizestring); - } - /** * Used for sorting stats array. * * @param array $a stats array entry @@ -282,7 +245,13 @@ if (strlen($package) > $this->_name_length) { $this->_name_length = strlen($package); } - $sizes = array('data'=>0, 'doc'=>0, 'script'=>0, 'php'=>0, 'test'=>0); + $sizes = array('data' => 0, + 'doc' => 0, + 'src' => 0, + 'script' => 0, + 'php' => 0, + 'test' => 0, + 'etc' => 0); $pkg = $this->reg->getPackage($package, $this->_channels_full[$index]); if ($pkg === null) { array_push($this->errors, "Package $package not found"); @@ -328,7 +297,7 @@ $this->_all_channels = false; $this->_verbose = false; $this->_readable = false; - $this->search_roles = '|data|doc|php|script|test|'; + $this->search_roles = '|data|doc|php|script|test|src|ext|'; $this->_sort_size = false; $this->_round = false; $this->_channel = array(); @@ -559,6 +528,10 @@ case 'summarise': case 's': $this->setSummarise(); + case 'X': + case 'xml': + $this->setOutputDriver('xml'); + break; } } $this->_options = $options; http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Factory.php?r1=1.10&r2=1.11&diff_format=u Index: pear/PEAR_Size/Size/Size_Factory.php diff -u pear/PEAR_Size/Size/Size_Factory.php:1.10 pear/PEAR_Size/Size/Size_Factory.php:1.11 --- pear/PEAR_Size/Size/Size_Factory.php:1.10 Sat Mar 29 01:35:28 2008 +++ pear/PEAR_Size/Size/Size_Factory.php Mon Mar 31 22:33:18 2008 @@ -9,7 +9,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Factory.php,v 1.10 2008/03/29 01:35:28 kguest Exp $ + * @version CVS: $Id: Size_Factory.php,v 1.11 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ @@ -21,7 +21,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Factory.php,v 1.10 2008/03/29 01:35:28 kguest Exp $ + * @version CVS: $Id: Size_Factory.php,v 1.11 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ interface PEAR_SIZE_Factory @@ -43,12 +43,49 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_Output_Driver { /** + * Determine a more readable form of the given size. + * + * @param int $size size value + * @param string $retstring formatting string; null by default. + * @param boolean $round round to multiples of 1000? false by default. + * + * @return string + */ + static function _sizeReadable($size, $retstring = null, $round = false) + { + //adapted from Public Domain licensed code at + //http://aidanlister.com/repos/v/function.size_readable.php + $sizes = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); + $factor = 1024; + if ($round) { + $factor = 1000; + } + if ($retstring === null) { + $retstring = '%01.2f %s'; + } + $lastsizestring = end($sizes); + foreach ($sizes as $sizestring) { + if ($size < $factor) { + break; + } + if ($sizestring !== $lastsizestring) { + $size /= $factor; + } + } + if ($sizestring === $sizes[0]) { + $retstring = '%01d %s'; + } elseif ($sizestring === 'KB' && $round) { + $sizestring = 'kB'; + } + return sprintf($retstring, $size, $sizestring); + } + /** * Return either given value, or it in readable form depending on criteria. * * @param integer $value value @@ -184,7 +221,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_SIZE_OutputFactory implements PEAR_SIZE_Factory http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Output_csv.php?r1=1.2&r2=1.3&diff_format=u Index: pear/PEAR_Size/Size/Size_Output_csv.php diff -u pear/PEAR_Size/Size/Size_Output_csv.php:1.2 pear/PEAR_Size/Size/Size_Output_csv.php:1.3 --- pear/PEAR_Size/Size/Size_Output_csv.php:1.2 Sat Mar 29 01:35:28 2008 +++ pear/PEAR_Size/Size/Size_Output_csv.php Mon Mar 31 22:33:18 2008 @@ -8,7 +8,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Output_csv.php,v 1.2 2008/03/29 01:35:28 kguest Exp $ + * @version CVS: $Id: Size_Output_csv.php,v 1.3 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ @@ -20,7 +20,7 @@ * @uses PEAR_Size_Output_Driver * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_Output_CSV extends PEAR_Size_Output_Driver http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Output_html.php?r1=1.8&r2=1.9&diff_format=u Index: pear/PEAR_Size/Size/Size_Output_html.php diff -u pear/PEAR_Size/Size/Size_Output_html.php:1.8 pear/PEAR_Size/Size/Size_Output_html.php:1.9 --- pear/PEAR_Size/Size/Size_Output_html.php:1.8 Sat Mar 29 01:35:28 2008 +++ pear/PEAR_Size/Size/Size_Output_html.php Mon Mar 31 22:33:18 2008 @@ -9,7 +9,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Output_html.php,v 1.8 2008/03/29 01:35:28 kguest Exp $ + * @version CVS: $Id: Size_Output_html.php,v 1.9 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ require_once "HTML/Table.php"; @@ -21,7 +21,7 @@ * @uses HTML_Table * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_HTML_Table extends HTML_Table @@ -48,7 +48,7 @@ * @uses PEAR_Size_Output_Driver * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_Output_Html extends PEAR_Size_Output_Driver http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Output_text.php?r1=1.7&r2=1.8&diff_format=u Index: pear/PEAR_Size/Size/Size_Output_text.php diff -u pear/PEAR_Size/Size/Size_Output_text.php:1.7 pear/PEAR_Size/Size/Size_Output_text.php:1.8 --- pear/PEAR_Size/Size/Size_Output_text.php:1.7 Sat Mar 29 01:35:28 2008 +++ pear/PEAR_Size/Size/Size_Output_text.php Mon Mar 31 22:33:18 2008 @@ -8,7 +8,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Output_text.php,v 1.7 2008/03/29 01:35:28 kguest Exp $ + * @version CVS: $Id: Size_Output_text.php,v 1.8 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ require_once "Console/Table.php"; @@ -20,7 +20,7 @@ * @uses PEAR_Size_Output_Driver * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_Output_Text extends PEAR_Size_Output_Driver http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/scripts/pearsize.php?r1=1.7&r2=1.8&diff_format=u Index: pear/PEAR_Size/scripts/pearsize.php diff -u pear/PEAR_Size/scripts/pearsize.php:1.7 pear/PEAR_Size/scripts/pearsize.php:1.8 --- pear/PEAR_Size/scripts/pearsize.php:1.7 Sat Mar 29 01:03:59 2008 +++ pear/PEAR_Size/scripts/pearsize.php Mon Mar 31 22:33:18 2008 @@ -11,7 +11,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: pearsize.php,v 1.7 2008/03/29 01:03:59 kguest Exp $ + * @version CVS: $Id: pearsize.php,v 1.8 2008/03/31 22:33:18 kguest Exp $ * @link pearsize.php * * $ pearsize --all @@ -97,6 +97,7 @@ fputs(STDOUT, " --help display this help and exit\n"); fputs(STDOUT, " -V, --version "); fputs(STDOUT, "output version information and exit\n"); + fputs(STDOUT, " -X, --xml output results in XML format\n"); fputs(STDOUT, "\nTypes:\n"); fputs(STDOUT, "You can specify a subset of roles/file-types to be "); @@ -145,9 +146,10 @@ 'type==', 'verbose', 'version', + 'xml', ); -$options = Console_Getopt::getopt($argv, "aAc:ChHt:SsVv", $long_options); +$options = Console_Getopt::getopt($argv, "aAc:ChHt:SsVvX", $long_options); if (PEAR::isError($options)) { usage($options);
http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/TODO?r1=1.3&r2=1.4&diff_format=u Index: pear/PEAR_Size/TODO diff -u pear/PEAR_Size/TODO:1.3 pear/PEAR_Size/TODO:1.4 --- pear/PEAR_Size/TODO:1.3 Thu Mar 27 22:46:27 2008 +++ pear/PEAR_Size/TODO Mon Mar 31 22:33:18 2008 @@ -1,6 +1,4 @@ - include an option to account for dependencies in displayed file sizes; this option would only be available/valid if only one 'target' package. -- CSV output driver - - Right alignment of the sizes would be nice http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/package.xml?r1=1.3&r2=1.4&diff_format=u Index: pear/PEAR_Size/package.xml diff -u pear/PEAR_Size/package.xml:1.3 pear/PEAR_Size/package.xml:1.4 --- pear/PEAR_Size/package.xml:1.3 Sat Mar 29 01:03:58 2008 +++ pear/PEAR_Size/package.xml Mon Mar 31 22:33:18 2008 @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<package packagerversion="1.6.2" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> +<package packagerversion="1.7.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>PEAR_Size</name> <channel>pear.php.net</channel> <summary>Determine and list how much filespace each installed package consumes.</summary> - <description>A commandline tool modeled on 'df' that lists how much filespace each installed package consumes. A subset of packages can be specified as can channels.</description> + <description>A commandline tool modeled on 'df' that lists how much filespace each installed package consumes. A subset of packages can be specified as can channels.</description> <lead> <name>Ken Guest</name> <user>kguest</user> <email>kguest@php.net</email> <active>yes</active> </lead> - <date>2008-03-18</date> - <time>19:05:05</time> + <date>2008-03-29</date> + <time>01:20:09</time> <version> <release>0.1.1</release> <api>0.1.0</api> @@ -21,33 +21,51 @@ <api>alpha</api> </stability> <license uri="http://www.gnu.org/licenses/lgpl.html">LGPL</license> - <notes>Initial release</notes> + <notes> +* channel summary +* CSV output + </notes> <contents> <dir baseinstalldir="PEAR" name="/"> - <dir name="scripts"> - <file baseinstalldir="/" name="pearsize.bat" role="script" install-as="pearsize.bat"> - <tasks:replace from="@PHP-BIN@" to="php_bin" type="pear-config" /> - <tasks:replace from="@BIN-DIR@" to="bin_dir" type="pear-config" /> - <tasks:replace from="@PEAR-DIR@" to="php_dir" type="pear-config" /> - <tasks:replace from="@DATA-DIR@" to="data_dir" type="pear-config" /> - <tasks:windowseol /> - </file> - <file baseinstalldir="/" name="pearsize.php" role="script" install-as="pearsize"> - <tasks:replace from="@PHP-BIN@" to="php_bin" type="pear-config" /> - <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> - <tasks:unixeol /> - </file> - </dir> - <file baseinstalldir="/" name="Size/Size.php" role="php" install-as="PEAR/Size.php"/> - <file baseinstalldir="/" name="Size/Size_Factory.php" role="php" install-as="PEAR/Size/Factory.php"/> - <file baseinstalldir="/" name="Size/Size_Output_csv.php" role="php" install-as="PEAR/Size/Output_csv.php"/> - <file baseinstalldir="/" name="Size/Size_Output_text.php" role="php" install-as="PEAR/Size/Output_text.php"/> - <file baseinstalldir="/" name="Size/Size_Output_html.php" role="php" install-as="PEAR/Size/Output_html.php"/> - <file name="TODO" role="doc" /> <dir name="docs"> - <file name="script-usage.txt" role="doc" /> - </dir> - </dir> + <file baseinstalldir="PEAR" name="script-usage.txt" role="doc" /> + </dir> <!-- /docs --> + <dir name="scripts"> + <file baseinstalldir="/" install-as="pearsize.bat" name="pearsize.bat" role="script"> + <tasks:replace from="@PHP-BIN@" to="php_bin" type="pear-config" /> + <tasks:replace from="@BIN-DIR@" to="bin_dir" type="pear-config" /> + <tasks:replace from="@PEAR-DIR@" to="php_dir" type="pear-config" /> + <tasks:replace from="@DATA-DIR@" to="data_dir" type="pear-config" /> + <tasks:windowseol /> + </file> + <file baseinstalldir="/" install-as="pearsize" name="pearsize.php" role="script"> + <tasks:replace from="@PHP-BIN@" to="php_bin" type="pear-config" /> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + <tasks:unixeol /> + </file> + </dir> <!-- /scripts --> + <dir name="Size"> + <file baseinstalldir="/" install-as="PEAR/Size.php" name="Size.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + <file baseinstalldir="/" install-as="PEAR/Size/Factory.php" name="Size_Factory.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + <file baseinstalldir="/" install-as="PEAR/Size/Output_csv.php" name="Size_Output_csv.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + <file baseinstalldir="/" install-as="PEAR/Size/Output_html.php" name="Size_Output_html.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + <file baseinstalldir="/" install-as="PEAR/Size/Output_text.php" name="Size_Output_text.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + <file baseinstalldir="/" install-as="PEAR/Size/Output_xml.php" name="Size_Output_xml.php" role="php"> + <tasks:replace from="@PACKAGE_VERSION@" to="version" type="package-info" /> + </file> + </dir> <!-- /Size --> + <file baseinstalldir="PEAR" name="TODO" role="doc" /> + </dir> <!-- / --> </contents> <dependencies> <required> @@ -81,32 +99,35 @@ </os> </installconditions> <filelist> - <install name="scripts/pearsize.bat" as="pearsize.bat" /> + <install as="pearsize.bat" name="scripts/pearsize.bat" /> </filelist> </phprelease> <phprelease> <filelist> - <ignore name="scripts/pearsize.bat"/> + <ignore name="scripts/pearsize.bat" /> </filelist> </phprelease> <changelog> <release> <version> - <release>0.0.1</release> - <api>0.0.1</api> + <release>0.1.1</release> + <api>0.1.0</api> </version> <stability> <release>alpha</release> <api>alpha</api> </stability> - <date>2008-01-05</date> + <date>2008-03-29</date> <license uri="http://www.gnu.org/licenses/lgpl.html">LGPL</license> - <notes>Initial version</notes> + <notes> +* channel summary +* CSV output + </notes> </release> <release> <version> - <release>0.1.1</release> - <api>0.1.0</api> + <release>0.0.1</release> + <api>0.0.1</api> </version> <stability> <release>alpha</release> http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size.php?r1=1.9&r2=1.10&diff_format=u Index: pear/PEAR_Size/Size/Size.php diff -u pear/PEAR_Size/Size/Size.php:1.9 pear/PEAR_Size/Size/Size.php:1.10 --- pear/PEAR_Size/Size/Size.php:1.9 Sat Mar 29 01:03:59 2008 +++ pear/PEAR_Size/Size/Size.php Mon Mar 31 22:33:18 2008 @@ -8,7 +8,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size.php,v 1.9 2008/03/29 01:03:59 kguest Exp $ + * @version CVS: $Id: Size.php,v 1.10 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ @@ -38,7 +38,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size @@ -202,43 +202,6 @@ private $_verbose = false; /** - * Determine a more readable form of the given size. - * - * @param int $size size value - * @param string $retstring formatting string; null by default. - * @param boolean $round round to multiples of 1000? false by default. - * - * @return string - */ - static function _sizeReadable($size, $retstring = null, $round = false) - { - //adapted from Public Domain licensed code at - //http://aidanlister.com/repos/v/function.size_readable.php - $sizes = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); - $factor = 1024; - if ($round) { - $factor = 1000; - } - if ($retstring === null) { - $retstring = '%01.2f %s'; - } - $lastsizestring = end($sizes); - foreach ($sizes as $sizestring) { - if ($size < $factor) { - break; - } - if ($sizestring !== $lastsizestring) { - $size /= $factor; - } - } - if ($sizestring === $sizes[0]) { - $retstring = '%01d %s'; - } elseif ($sizestring === 'KB' && $round) { - $sizestring = 'kB'; - } - return sprintf($retstring, $size, $sizestring); - } - /** * Used for sorting stats array. * * @param array $a stats array entry @@ -282,7 +245,13 @@ if (strlen($package) > $this->_name_length) { $this->_name_length = strlen($package); } - $sizes = array('data'=>0, 'doc'=>0, 'script'=>0, 'php'=>0, 'test'=>0); + $sizes = array('data' => 0, + 'doc' => 0, + 'src' => 0, + 'script' => 0, + 'php' => 0, + 'test' => 0, + 'etc' => 0); $pkg = $this->reg->getPackage($package, $this->_channels_full[$index]); if ($pkg === null) { array_push($this->errors, "Package $package not found"); @@ -328,7 +297,7 @@ $this->_all_channels = false; $this->_verbose = false; $this->_readable = false; - $this->search_roles = '|data|doc|php|script|test|'; + $this->search_roles = '|data|doc|php|script|test|src|ext|'; $this->_sort_size = false; $this->_round = false; $this->_channel = array(); @@ -559,6 +528,10 @@ case 'summarise': case 's': $this->setSummarise(); + case 'X': + case 'xml': + $this->setOutputDriver('xml'); + break; } } $this->_options = $options; http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Factory.php?r1=1.10&r2=1.11&diff_format=u Index: pear/PEAR_Size/Size/Size_Factory.php diff -u pear/PEAR_Size/Size/Size_Factory.php:1.10 pear/PEAR_Size/Size/Size_Factory.php:1.11 --- pear/PEAR_Size/Size/Size_Factory.php:1.10 Sat Mar 29 01:35:28 2008 +++ pear/PEAR_Size/Size/Size_Factory.php Mon Mar 31 22:33:18 2008 @@ -9,7 +9,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Factory.php,v 1.10 2008/03/29 01:35:28 kguest Exp $ + * @version CVS: $Id: Size_Factory.php,v 1.11 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ @@ -21,7 +21,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Factory.php,v 1.10 2008/03/29 01:35:28 kguest Exp $ + * @version CVS: $Id: Size_Factory.php,v 1.11 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ interface PEAR_SIZE_Factory @@ -43,12 +43,49 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_Output_Driver { /** + * Determine a more readable form of the given size. + * + * @param int $size size value + * @param string $retstring formatting string; null by default. + * @param boolean $round round to multiples of 1000? false by default. + * + * @return string + */ + static function _sizeReadable($size, $retstring = null, $round = false) + { + //adapted from Public Domain licensed code at + //http://aidanlister.com/repos/v/function.size_readable.php + $sizes = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); + $factor = 1024; + if ($round) { + $factor = 1000; + } + if ($retstring === null) { + $retstring = '%01.2f %s'; + } + $lastsizestring = end($sizes); + foreach ($sizes as $sizestring) { + if ($size < $factor) { + break; + } + if ($sizestring !== $lastsizestring) { + $size /= $factor; + } + } + if ($sizestring === $sizes[0]) { + $retstring = '%01d %s'; + } elseif ($sizestring === 'KB' && $round) { + $sizestring = 'kB'; + } + return sprintf($retstring, $size, $sizestring); + } + /** * Return either given value, or it in readable form depending on criteria. * * @param integer $value value @@ -184,7 +221,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_SIZE_OutputFactory implements PEAR_SIZE_Factory http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Output_csv.php?r1=1.2&r2=1.3&diff_format=u Index: pear/PEAR_Size/Size/Size_Output_csv.php diff -u pear/PEAR_Size/Size/Size_Output_csv.php:1.2 pear/PEAR_Size/Size/Size_Output_csv.php:1.3 --- pear/PEAR_Size/Size/Size_Output_csv.php:1.2 Sat Mar 29 01:35:28 2008 +++ pear/PEAR_Size/Size/Size_Output_csv.php Mon Mar 31 22:33:18 2008 @@ -8,7 +8,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Output_csv.php,v 1.2 2008/03/29 01:35:28 kguest Exp $ + * @version CVS: $Id: Size_Output_csv.php,v 1.3 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ @@ -20,7 +20,7 @@ * @uses PEAR_Size_Output_Driver * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_Output_CSV extends PEAR_Size_Output_Driver http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Output_html.php?r1=1.8&r2=1.9&diff_format=u Index: pear/PEAR_Size/Size/Size_Output_html.php diff -u pear/PEAR_Size/Size/Size_Output_html.php:1.8 pear/PEAR_Size/Size/Size_Output_html.php:1.9 --- pear/PEAR_Size/Size/Size_Output_html.php:1.8 Sat Mar 29 01:35:28 2008 +++ pear/PEAR_Size/Size/Size_Output_html.php Mon Mar 31 22:33:18 2008 @@ -9,7 +9,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Output_html.php,v 1.8 2008/03/29 01:35:28 kguest Exp $ + * @version CVS: $Id: Size_Output_html.php,v 1.9 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ require_once "HTML/Table.php"; @@ -21,7 +21,7 @@ * @uses HTML_Table * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_HTML_Table extends HTML_Table @@ -48,7 +48,7 @@ * @uses PEAR_Size_Output_Driver * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_Output_Html extends PEAR_Size_Output_Driver http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Output_text.php?r1=1.7&r2=1.8&diff_format=u Index: pear/PEAR_Size/Size/Size_Output_text.php diff -u pear/PEAR_Size/Size/Size_Output_text.php:1.7 pear/PEAR_Size/Size/Size_Output_text.php:1.8 --- pear/PEAR_Size/Size/Size_Output_text.php:1.7 Sat Mar 29 01:35:28 2008 +++ pear/PEAR_Size/Size/Size_Output_text.php Mon Mar 31 22:33:18 2008 @@ -8,7 +8,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Output_text.php,v 1.7 2008/03/29 01:35:28 kguest Exp $ + * @version CVS: $Id: Size_Output_text.php,v 1.8 2008/03/31 22:33:18 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ require_once "Console/Table.php"; @@ -20,7 +20,7 @@ * @uses PEAR_Size_Output_Driver * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version Release: @package_version@ + * @version Release: @PACKAGE_VERSION@ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_Output_Text extends PEAR_Size_Output_Driver http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/scripts/pearsize.php?r1=1.7&r2=1.8&diff_format=u Index: pear/PEAR_Size/scripts/pearsize.php diff -u pear/PEAR_Size/scripts/pearsize.php:1.7 pear/PEAR_Size/scripts/pearsize.php:1.8 --- pear/PEAR_Size/scripts/pearsize.php:1.7 Sat Mar 29 01:03:59 2008 +++ pear/PEAR_Size/scripts/pearsize.php Mon Mar 31 22:33:18 2008 @@ -11,7 +11,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: pearsize.php,v 1.7 2008/03/29 01:03:59 kguest Exp $ + * @version CVS: $Id: pearsize.php,v 1.8 2008/03/31 22:33:18 kguest Exp $ * @link pearsize.php * * $ pearsize --all @@ -97,6 +97,7 @@ fputs(STDOUT, " --help display this help and exit\n"); fputs(STDOUT, " -V, --version "); fputs(STDOUT, "output version information and exit\n"); + fputs(STDOUT, " -X, --xml output results in XML format\n"); fputs(STDOUT, "\nTypes:\n"); fputs(STDOUT, "You can specify a subset of roles/file-types to be "); @@ -145,9 +146,10 @@ 'type==', 'verbose', 'version', + 'xml', ); -$options = Console_Getopt::getopt($argv, "aAc:ChHt:SsVv", $long_options); +$options = Console_Getopt::getopt($argv, "aAc:ChHt:SsVvX", $long_options); if (PEAR::isError($options)) { usage($options);