summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Console_CommandLine-bug18682.patch243
-rw-r--r--Console_CommandLine-bug19683.patch25
-rw-r--r--Console_CommandLine-pr8.patch149
-rw-r--r--php-pear-Console-CommandLine.spec51
4 files changed, 180 insertions, 288 deletions
diff --git a/Console_CommandLine-bug18682.patch b/Console_CommandLine-bug18682.patch
deleted file mode 100644
index 81537be..0000000
--- a/Console_CommandLine-bug18682.patch
+++ /dev/null
@@ -1,243 +0,0 @@
-From 987dd5793550a1cb8930bb06cf8f384bdbbbf2a4 Mon Sep 17 00:00:00 2001
-From: David Jean Louis <izimobil@gmail.com>
-Date: Thu, 25 Oct 2012 10:13:42 +0200
-Subject: [PATCH] * Fixed bug #18682 (columnWrap() in Default Renderer eats up
- lines with only a EOL) [izi, thanks Helgi] * Fixed bug
- #18703 (No way to override reading of stdin with -) [izi,
- thanks Gwynne Raskind] * Fixed unit tests [izi]
-
----
- Console/CommandLine.php | 18 +++++--
- Console/CommandLine/Renderer/Default.php | 10 +++-
- package.xml | 30 ++++++++---
- tests/console_commandline_addargument.phpt | 20 +++++--
- tests/console_commandline_bug18682.phpt | 79 ++++++++++++++++++++++++++++
- 5 files changed, 142 insertions(+), 15 deletions(-)
- create mode 100644 tests/console_commandline_bug18682.phpt
-
-diff --git a/Console/CommandLine.php b/Console/CommandLine.php
-index c1b01e1..0ccfb7c 100644
---- a/Console/CommandLine.php
-+++ b/Console/CommandLine.php
-@@ -176,6 +176,15 @@ class Console_CommandLine
- */
- public $force_options_defaults = false;
-
-+
-+ /**
-+ * Boolean that tells the parser to treat a single - option as an argument
-+ * instead of trying to read STDIN.
-+ *
-+ * @var bool $avoid_reading_stdin Whether to treat - as an argument
-+ */
-+ public $avoid_reading_stdin = false;
-+
- /**
- * An array of Console_CommandLine_Option objects.
- *
-@@ -999,7 +1008,8 @@ protected function parseToken($token, $result, &$args, $argc)
- static $stopflag = false;
- $last = $argc === 0;
- if (!$stopflag && $lastopt) {
-- if (substr($token, 0, 1) == '-') {
-+ if (strlen($token) > ($this->avoid_reading_stdin ? 1 : 0) &&
-+ substr($token, 0, 1) == '-') {
- if ($lastopt->argument_optional) {
- $this->_dispatchAction($lastopt, '', $result);
- if ($lastopt->action != 'StoreArray') {
-@@ -1085,10 +1095,12 @@ protected function parseToken($token, $result, &$args, $argc)
- $lastopt = $opt;
- }
- $this->_dispatchAction($opt, $value, $result);
-- } else if (!$stopflag && substr($token, 0, 1) == '-') {
-+ } else if (!$stopflag &&
-+ strlen($token) > ($this->avoid_reading_stdin ? 1 : 0) &&
-+ substr($token, 0, 1) == '-') {
- // a short option
- $optname = substr($token, 0, 2);
-- if ($optname == '-') {
-+ if ($optname == '-' && !$this->avoid_reading_stdin) {
- // special case of "-": try to read stdin
- $args[] = file_get_contents('php://stdin');
- return;
-diff --git a/Console/CommandLine/Renderer/Default.php b/Console/CommandLine/Renderer/Default.php
-index 59ce33e..8f34b26 100644
---- a/Console/CommandLine/Renderer/Default.php
-+++ b/Console/CommandLine/Renderer/Default.php
-@@ -409,12 +409,18 @@ protected function columnWrap($text, $cw)
- {
- $tokens = explode("\n", $this->wrap($text));
- $ret = $tokens[0];
-- $chunks = $this->wrap(trim(substr($text, strlen($ret))),
-- $this->line_width - $cw);
-+ $text = trim(substr($text, strlen($ret)));
-+ if (empty($text)) {
-+ return $ret;
-+ }
-+
-+ $chunks = $this->wrap($text, $this->line_width - $cw);
- $tokens = explode("\n", $chunks);
- foreach ($tokens as $token) {
- if (!empty($token)) {
- $ret .= "\n" . str_repeat(' ', $cw) . $token;
-+ } else {
-+ $ret .= "\n";
- }
- }
- return $ret;
-diff --git a/tests/console_commandline_addargument.phpt b/tests/console_commandline_addargument.phpt
-index ca87c65..eb2e3af 100644
---- a/tests/console_commandline_addargument.phpt
-+++ b/tests/console_commandline_addargument.phpt
-@@ -27,11 +27,14 @@ $parser->addArgument('Some invalid name');
- --EXPECTF--
- array(4) {
- ["arg1"]=>
-- object(Console_CommandLine_Argument)#5 (7) {
-+ object(Console_CommandLine_Argument)#5 (8) {
- ["multiple"]=>
- bool(false)
- ["optional"]=>
- bool(false)
-+ ["choices"]=>
-+ array(0) {
-+ }
- ["name"]=>
- string(4) "arg1"
- ["help_name"]=>
-@@ -45,11 +48,14 @@ array(4) {
- }
- }
- ["arg2"]=>
-- object(Console_CommandLine_Argument)#6 (7) {
-+ object(Console_CommandLine_Argument)#6 (8) {
- ["multiple"]=>
- bool(true)
- ["optional"]=>
- bool(false)
-+ ["choices"]=>
-+ array(0) {
-+ }
- ["name"]=>
- string(4) "arg2"
- ["help_name"]=>
-@@ -63,11 +69,14 @@ array(4) {
- }
- }
- ["arg3"]=>
-- object(Console_CommandLine_Argument)#7 (7) {
-+ object(Console_CommandLine_Argument)#7 (8) {
- ["multiple"]=>
- bool(true)
- ["optional"]=>
- bool(false)
-+ ["choices"]=>
-+ array(0) {
-+ }
- ["name"]=>
- string(4) "arg3"
- ["help_name"]=>
-@@ -81,11 +90,14 @@ array(4) {
- }
- }
- ["arg4"]=>
-- object(Console_CommandLine_Argument)#8 (7) {
-+ object(Console_CommandLine_Argument)#8 (8) {
- ["multiple"]=>
- bool(false)
- ["optional"]=>
- bool(true)
-+ ["choices"]=>
-+ array(0) {
-+ }
- ["name"]=>
- string(4) "arg4"
- ["help_name"]=>
-diff --git a/tests/console_commandline_bug18682.phpt b/tests/console_commandline_bug18682.phpt
-new file mode 100644
-index 0000000..aa769c3
---- /dev/null
-+++ b/tests/console_commandline_bug18682.phpt
-@@ -0,0 +1,79 @@
-+--TEST--
-+Test for bug #18682: columnWrap() in Default Renderer eats up lines with only a EOL.
-+--ARGS--
-+cmd1 --help 2>&1
-+--FILE--
-+<?php
-+
-+require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tests.inc.php';
-+
-+class Renderer extends Console_CommandLine_Renderer_Default {
-+ protected function description() {
-+ return $this->columnWrap($this->parser->description, 2);
-+ }
-+}
-+
-+$parser = new Console_CommandLine();
-+$parser->accept(new Renderer);
-+$parser->renderer->line_width = 75;
-+$parser->addCommand('cmd1', array(
-+ 'description' => '
-+Installs listed packages.
-+
-+local package.xml example:
-+php pyrus.phar install package.xml
-+
-+local package archive example:
-+php pyrus.phar install PackageName-1.2.0.tar
-+
-+remote package archive example:
-+php pyrus.phar install http://www.example.com/PackageName-1.2.0.tgz
-+
-+Examples of an abstract package:
-+php pyrus.phar install PackageName
-+ installs PackageName from the default channel with stability preferred_state
-+php pyrus.phar pear/PackageName
-+ installs PackageName from the pear.php.net channel with stability preferred_state
-+php pyrus.phar install channel://doc.php.net/PackageName
-+ installs PackageName from the doc.php.net channel with stability preferred_state
-+php pyrus.phar install PackageName-beta
-+ installs PackageName from the default channel, beta or stable stability
-+php pyrus.phar install PackageName-1.2.0
-+ installs PackageName from the default channel, version 1.2.0'
-+));
-+$parser->parse();
-+
-+?>
-+--EXPECTF--
-+ Installs listed packages.
-+
-+ local package.xml example:
-+ php pyrus.phar install package.xml
-+
-+ local package archive example:
-+ php pyrus.phar install PackageName-1.2.0.tar
-+
-+ remote package archive example:
-+ php pyrus.phar install http://www.example.com/PackageName-1.2.0.tgz
-+
-+ Examples of an abstract package:
-+ php pyrus.phar install PackageName
-+ installs PackageName from the default channel with stability
-+ preferred_state
-+ php pyrus.phar pear/PackageName
-+ installs PackageName from the pear.php.net channel with stability
-+ preferred_state
-+ php pyrus.phar install channel://doc.php.net/PackageName
-+ installs PackageName from the doc.php.net channel with stability
-+ preferred_state
-+ php pyrus.phar install PackageName-beta
-+ installs PackageName from the default channel, beta or stable stability
-+ php pyrus.phar install PackageName-1.2.0
-+ installs PackageName from the default channel, version 1.2.0
-+
-+Usage:
-+ %sconsole_commandline_bug18682.php
-+ [options] cmd1 [options]
-+
-+Options:
-+ -h, --help show this help message and exit
---
-1.7.10
-
diff --git a/Console_CommandLine-bug19683.patch b/Console_CommandLine-bug19683.patch
deleted file mode 100644
index 2fe01b4..0000000
--- a/Console_CommandLine-bug19683.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 05eb12793b236ea631eef42d292e31a27746a6aa Mon Sep 17 00:00:00 2001
-From: Laurent Laville <laurent.laville@gmail.com>
-Date: Wed, 26 Dec 2012 16:03:20 +0100
-Subject: [PATCH] fix PEAR bug 19683
-
----
- tests/console_commandline_webrequest_2.phpt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/console_commandline_webrequest_2.phpt b/tests/console_commandline_webrequest_2.phpt
-index c9ad9da..1d6b029 100644
---- a/tests/console_commandline_webrequest_2.phpt
-+++ b/tests/console_commandline_webrequest_2.phpt
-@@ -15,7 +15,7 @@ $parser->parse();
- Description of our parser goes here...
-
- Usage:
-- some_program [options] <simple> <multiple...>
-+ some_program [options] simple [multiple1 multiple2 ...]
-
- Options:
- -t, --true test the StoreTrue action
---
-1.7.10
-
diff --git a/Console_CommandLine-pr8.patch b/Console_CommandLine-pr8.patch
new file mode 100644
index 0000000..0850293
--- /dev/null
+++ b/Console_CommandLine-pr8.patch
@@ -0,0 +1,149 @@
+diff --git a/tests/console_commandline_addargument.phpt b/tests/console_commandline_addargument.phpt
+index eb2e3af..7f7f689 100644
+--- a/tests/console_commandline_addargument.phpt
++++ b/tests/console_commandline_addargument.phpt
+@@ -27,7 +27,7 @@ $parser->addArgument('Some invalid name');
+ --EXPECTF--
+ array(4) {
+ ["arg1"]=>
+- object(Console_CommandLine_Argument)#5 (8) {
++ object(Console_CommandLine_Argument)#%d (8) {
+ ["multiple"]=>
+ bool(false)
+ ["optional"]=>
+@@ -48,7 +48,7 @@ array(4) {
+ }
+ }
+ ["arg2"]=>
+- object(Console_CommandLine_Argument)#6 (8) {
++ object(Console_CommandLine_Argument)#%d (8) {
+ ["multiple"]=>
+ bool(true)
+ ["optional"]=>
+@@ -69,7 +69,7 @@ array(4) {
+ }
+ }
+ ["arg3"]=>
+- object(Console_CommandLine_Argument)#7 (8) {
++ object(Console_CommandLine_Argument)#%d (8) {
+ ["multiple"]=>
+ bool(true)
+ ["optional"]=>
+@@ -90,7 +90,7 @@ array(4) {
+ }
+ }
+ ["arg4"]=>
+- object(Console_CommandLine_Argument)#8 (8) {
++ object(Console_CommandLine_Argument)#%d (8) {
+ ["multiple"]=>
+ bool(false)
+ ["optional"]=>
+diff --git a/tests/console_commandline_addoption.phpt b/tests/console_commandline_addoption.phpt
+index 73da0ea..1386121 100644
+--- a/tests/console_commandline_addoption.phpt
++++ b/tests/console_commandline_addoption.phpt
+@@ -31,7 +31,7 @@ var_dump($parser->options);
+ --EXPECTF--
+ array(4) {
+ ["opt1"]=>
+- object(Console_CommandLine_Option)#5 (14) {
++ object(Console_CommandLine_Option)#%d (14) {
+ ["short_name"]=>
+ string(2) "-a"
+ ["long_name"]=>
+@@ -65,7 +65,7 @@ array(4) {
+ }
+ }
+ ["opt2"]=>
+- object(Console_CommandLine_Option)#6 (14) {
++ object(Console_CommandLine_Option)#%d (14) {
+ ["short_name"]=>
+ string(2) "-b"
+ ["long_name"]=>
+@@ -105,7 +105,7 @@ array(4) {
+ }
+ }
+ ["list_opt2"]=>
+- object(Console_CommandLine_Option)#7 (14) {
++ object(Console_CommandLine_Option)#%d (14) {
+ ["short_name"]=>
+ NULL
+ ["long_name"]=>
+@@ -148,7 +148,7 @@ array(4) {
+ }
+ }
+ ["opt3"]=>
+- object(Console_CommandLine_Option)#8 (14) {
++ object(Console_CommandLine_Option)#%d (14) {
+ ["short_name"]=>
+ NULL
+ ["long_name"]=>
+diff --git a/tests/console_commandline_parse_17.phpt b/tests/console_commandline_parse_17.phpt
+index d3f8762..23e1444 100644
+--- a/tests/console_commandline_parse_17.phpt
++++ b/tests/console_commandline_parse_17.phpt
+@@ -18,8 +18,8 @@ try {
+ }
+
+ ?>
+---EXPECT--
+-object(Console_CommandLine_Result)#18 (4) {
++--EXPECTF--
++object(Console_CommandLine_Result)#%d (4) {
+ ["options"]=>
+ array(11) {
+ ["true"]=>
+diff --git a/tests/console_commandline_parse_18.phpt b/tests/console_commandline_parse_18.phpt
+index 6efc149..93250c4 100644
+--- a/tests/console_commandline_parse_18.phpt
++++ b/tests/console_commandline_parse_18.phpt
+@@ -18,8 +18,8 @@ try {
+ }
+
+ ?>
+---EXPECT--
+-object(Console_CommandLine_Result)#16 (4) {
++--EXPECTF--
++object(Console_CommandLine_Result)#%d (4) {
+ ["options"]=>
+ array(4) {
+ ["verbose"]=>
+@@ -37,7 +37,7 @@ object(Console_CommandLine_Result)#16 (4) {
+ ["command_name"]=>
+ string(7) "install"
+ ["command"]=>
+- object(Console_CommandLine_Result)#19 (4) {
++ object(Console_CommandLine_Result)#%d (4) {
+ ["options"]=>
+ array(2) {
+ ["force"]=>
+diff --git a/tests/console_commandline_parse_7.phpt b/tests/console_commandline_parse_7.phpt
+index 1bfb6fd..de5c6af 100644
+--- a/tests/console_commandline_parse_7.phpt
++++ b/tests/console_commandline_parse_7.phpt
+@@ -18,8 +18,8 @@ try {
+ }
+
+ ?>
+---EXPECT--
+-object(Console_CommandLine_Result)#18 (4) {
++--EXPECTF--
++object(Console_CommandLine_Result)#%d (4) {
+ ["options"]=>
+ array(11) {
+ ["true"]=>
+diff --git a/tests/console_commandline_parse_8.phpt b/tests/console_commandline_parse_8.phpt
+index ceba877..0925bbe 100644
+--- a/tests/console_commandline_parse_8.phpt
++++ b/tests/console_commandline_parse_8.phpt
+@@ -19,8 +19,8 @@ try {
+ }
+
+ ?>
+---EXPECT--
+-object(Console_CommandLine_Result)#18 (4) {
++--EXPECTF--
++object(Console_CommandLine_Result)#%d (4) {
+ ["options"]=>
+ array(11) {
+ ["true"]=>
diff --git a/php-pear-Console-CommandLine.spec b/php-pear-Console-CommandLine.spec
index 4de0292..e54ccbe 100644
--- a/php-pear-Console-CommandLine.spec
+++ b/php-pear-Console-CommandLine.spec
@@ -1,10 +1,17 @@
+# remirepo/fedora spec file for ImageMagick
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve changelog entries
+#
%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
-%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
+%{!?__pear: %global __pear %{_bindir}/pear}
%global pear_name Console_CommandLine
Name: php-pear-Console-CommandLine
-Version: 1.2.0
-Release: 2%{?dist}
+Version: 1.2.1
+Release: 1%{?dist}
Summary: A full featured command line options and arguments parser
Group: Development/Libraries
@@ -12,25 +19,23 @@ License: MIT
URL: http://pear.php.net/package/%{pear_name}
Source0: http://pear.php.net/get/%{pear_name}-%{version}.tgz
-# columnWrap() in Default Renderer eats up lines with only a EOL
-# https://pear.php.net/bugs/18682
-Patch1: %{pear_name}-bug18682.patch
-# Unit tests are broken
-# https://pear.php.net/bugs/19683
-Patch2: %{pear_name}-bug19683.patch
+# https://github.com/pear/Console_CommandLine/pull/8
+Patch1: %{pear_name}-pr8.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: php-pear
-BuildRequires: php-pear(pear.phpunit.de/PHPUnit)
+BuildRequires: php-dom
Requires: php-dom
+Requires: php-xml
Requires: php-pcre
-Requires: php-spl
Requires(post): %{__pear}
Requires(postun): %{__pear}
Provides: php-pear(%{pear_name}) = %{version}
+Provides: php-composer(pear/console_commandline) = %{version}
+
%description
Console_CommandLine is a full featured package for managing command-line
@@ -54,8 +59,7 @@ sed -e 's/md5sum=.*name/name/' -i package.xml
cd %{pear_name}-%{version}
mv ../package.xml %{name}.xml
-%patch1 -p1 -b .bug18682
-%patch2 -p1 -b .bug19683
+%patch1 -p1 -b .pr8
%build
@@ -65,24 +69,25 @@ cd %{pear_name}-%{version}
%install
cd %{pear_name}-%{version}
-rm -rf $RPM_BUILD_ROOT docdir
-%{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{name}.xml
+rm -rf %{buildroot} docdir
+%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml
# Clean up unnecessary files
-rm -rf $RPM_BUILD_ROOT%{pear_metadir}/.??*
+rm -rf %{buildroot}%{pear_metadir}/.??*
# Install XML package description
-install -d $RPM_BUILD_ROOT%{pear_xmldir}
-install -pm 644 %{name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
+install -d %{buildroot}%{pear_xmldir}
+install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir}
%check
cd %{pear_name}-%{version}
-%{_bindir}/phpunit tests
+%{__pear} run-tests tests | tee ../tests.log
+grep "FAILED TESTS" ../tests.log && exit 1
%clean
-rm -rf $RPM_BUILD_ROOT
+rm -rf %{buildroot}
%post
@@ -106,6 +111,12 @@ fi
%changelog
+* Fri Dec 11 2015 Remi Collet <remi@fedoraproject.org> - 1.2.1-1
+- Update to 1.2.1
+- provide php-composer(pear/console_commandline)
+- run test suite with pear instead of phpunit
+- fix test suite https://github.com/pear/Console_CommandLine/pull/8
+
* Sun Dec 30 2012 Remi Collet <remi@fedoraproject.org> - 1.2.0-2
- fix for https://pear.php.net/bugs/18682
columnWrap() in Default Renderer eats up lines with only a EOL