[pkg-php-pear] Bug#827483: [pkg-horde] Bug#827483: php-horde-mapi: fix autopkgtest errors

Nish Aravamudan nish.aravamudan at canonical.com
Sun Jun 19 07:46:28 UTC 2016


On 18.06.2016 [16:50:23 -0400], David Prévot wrote:
> Hi,
> 
> Le 18/06/2016 à 16:32, Mathieu Parent a écrit :
> 
> > Some other things may break, but I'll vote still vote for this patch,
> > as only 6 packages depends on it.
> > 
> > David, what do you think?
> 
> I disagree, and stand to what I’ve written in the last changelog entry:
> 
>   Actually fixing the constructors requires to also fix all their calls,
>   both internally and externally. This backward-incompatible change has
>   been achieved in version 2 of phpseclib, packaged in Debian as
>   php-phpseclib to ensure co-installability. (Closes: #819420)

Right, my original patch in this e-mail was just to quieten the
deprecated call from this testcase, as it's not really a failure (any
output on stderr is treated as a failure).

> From http://phpseclib.sourceforge.net/:
> 
>   The 2.0 branch has pretty much the exact same API as the 1.0 branch,
>   save for that it is namespaced, uses PHP5-style constructors (thereby
>   avoiding E_DEPRECATED errors) and requires the use of an autoloader.
> 
> A proper fix to the deprecated constructor syntax is maintained
> upstream, provided in Debian via php-phpseclib (version 2). If you want
> to use it, you should depend on php-phpseclib instead of php-seclib
> (helping various upstreams to move away from version 1 to version 2 will
> probably be a better use of our collective time than patching the
> version 1 ourselves).

Agreed, and perhaps something like the attached (which passes
autopkgtests for me) can be applied to Debian's package (and we can sync
in Ubuntu) and massaged to be sent upstream? I apologize if this is way
off-base, I'm not all a PHP developer :)

-Nish
-------------- next part --------------
diff -Nru php-horde-mapi-1.0.8/debian/changelog php-horde-mapi-1.0.8/debian/changelog
--- php-horde-mapi-1.0.8/debian/changelog	2016-06-08 00:09:58.000000000 -0700
+++ php-horde-mapi-1.0.8/debian/changelog	2016-06-19 00:42:35.000000000 -0700
@@ -1,3 +1,9 @@
+php-horde-mapi (1.0.8-3) unstable; urgency=medium
+
+  * debian/patches/use_phpseclibv2.patch: Move to php-phpseclib v2 API.
+
+ -- Nishanth Aravamudan <nish.aravamudan at canonical.com>  Sun, 19 Jun 2016 00:42:07 -0700
+
 php-horde-mapi (1.0.8-2) unstable; urgency=medium
 
   * Update Standards-Version to 3.9.8, no change
diff -Nru php-horde-mapi-1.0.8/debian/control php-horde-mapi-1.0.8/debian/control
--- php-horde-mapi-1.0.8/debian/control	2016-06-08 00:09:58.000000000 -0700
+++ php-horde-mapi-1.0.8/debian/control	2016-06-19 00:41:58.000000000 -0700
@@ -11,7 +11,7 @@
 
 Package: php-horde-mapi
 Architecture: all
-Depends: ${misc:Depends}, ${phppear:Debian-Depends}, php-seclib (<< 2~)
+Depends: ${misc:Depends}, ${phppear:Debian-Depends}, php-phpseclib (> 2~)
 Recommends: ${phppear:Debian-Recommends}
 Breaks: ${phppear:Debian-Breaks}
 Description: ${phppear:summary}
diff -Nru php-horde-mapi-1.0.8/debian/patches/series php-horde-mapi-1.0.8/debian/patches/series
--- php-horde-mapi-1.0.8/debian/patches/series	1969-12-31 16:00:00.000000000 -0800
+++ php-horde-mapi-1.0.8/debian/patches/series	2016-06-19 00:41:51.000000000 -0700
@@ -0,0 +1 @@
+use_phpseclibv2.patch
diff -Nru php-horde-mapi-1.0.8/debian/patches/use_phpseclibv2.patch php-horde-mapi-1.0.8/debian/patches/use_phpseclibv2.patch
--- php-horde-mapi-1.0.8/debian/patches/use_phpseclibv2.patch	1969-12-31 16:00:00.000000000 -0800
+++ php-horde-mapi-1.0.8/debian/patches/use_phpseclibv2.patch	2016-06-19 00:43:13.000000000 -0700
@@ -0,0 +1,88 @@
+Description: Move to php-phpseclib v2 API
+ Use the v2 php-phpseclib library.
+Author: Nishanth Aravamudan <nish.aravamudan at canonical.com>
+
+--- a/Horde_Mapi-1.0.8/lib/Horde/Mapi.php
++++ b/Horde_Mapi-1.0.8/lib/Horde/Mapi.php
+@@ -20,6 +20,9 @@
+  * @author    Michael J Rubinsky <mrubinsk at horde.org>
+  * @package   Mapi_Utils
+  */
++
++use phpseclib\Math;
++
+ class Horde_Mapi
+ {
+     /**
+@@ -169,13 +172,13 @@
+             'A'=>'10',  'B'=>'11',  'C'=>'12',  'D'=>'13',  'E'=>'14',  'F'=>'15'
+         );
+ 
+-        $bci = new Math_BigInteger('0');
++        $bci = new phpseclib\Math\BigInteger('0');
+         $len = strlen($str);
+         for ($i = 0; $i < $len; ++$i) {
+-            $bci = $bci->multiply(new Math_BigInteger('16'));
++            $bci = $bci->multiply(new phpseclib\Math\BigInteger('16'));
+             $ch = $str[$i];
+             if (isset($hex[$ch])) {
+-                $bci = $bci->add(new Math_BigInteger($hex[$ch]));
++                $bci = $bci->add(new phpseclib\Math\BigInteger($hex[$ch]));
+             }
+         }
+ 
+@@ -184,14 +187,14 @@
+ 
+     /**
+      *
+-     * @param  Math_BigInteger $bci
++     * @param  phpseclib\Math\BigInteger $bci
+      * @return string
+      */
+     protected static function _win64ToUnix($bci)
+     {
+         // Unix epoch as a Windows file date-time value
+-        $t = $bci->subtract(new Math_BigInteger('116444735995904000'));    // Cast to Unix epoch
+-        list($quotient, $remainder) = $t->divide(new Math_BigInteger('10000000'));
++        $t = $bci->subtract(new phpseclib\Math\BigInteger('116444735995904000'));    // Cast to Unix epoch
++        list($quotient, $remainder) = $t->divide(new phpseclib\Math\BigInteger('10000000'));
+ 
+         return (string)$quotient;
+     }
+--- a/Horde_Mapi-1.0.8/test/Horde/Mapi/Autoload.php
++++ /dev/null
+@@ -1,15 +0,0 @@
+-<?php
+-/**
+- * Setup autoloading for the tests.
+- *
+- * @category   Horde
+- * @package    Mapi
+- * @subpackage UnitTests
+- * @author     Jan Schneider <jan at horde.org>
+- * @license    http://www.horde.org/licenses/lgpl21 LGPL 2.1
+- */
+-
+-/* Load Math_BigInteger now, before composer autoloaders can mess with the
+- * include path. This is to avoid using phpseclib's Math\BigInteger from
+- * Horde_Pgp instead of PEAR's Math_BigInteger. */
+-require_once 'Math/BigInteger.php';
+\ No newline at end of file
+--- a/package.xml
++++ b/package.xml
+@@ -32,7 +32,6 @@
+    <file baseinstalldir="/" md5sum="79ad1ecb7a5f959a90465c8568dc7059" name="lib/Horde/Mapi.php" role="php" />
+    <file baseinstalldir="/" md5sum="b7de7a8f7b5122b5e9d07a124e712e63" name="test/Horde/Mapi/fixtures/filetime" role="test" />
+    <file baseinstalldir="/" md5sum="8bc9518b9c0576806c82d9413489d099" name="test/Horde/Mapi/AllTests.php" role="test" />
+-   <file baseinstalldir="/" md5sum="86c7ea21f502b7b4734d818a2ddc595a" name="test/Horde/Mapi/Autoload.php" role="test" />
+    <file baseinstalldir="/" md5sum="0a5018f0726d4673850fece3ad4d72c0" name="test/Horde/Mapi/bootstrap.php" role="test" />
+    <file baseinstalldir="/" md5sum="8ea09b82af793f43a98790c2b8b8666c" name="test/Horde/Mapi/MapiTest.php" role="test" />
+    <file baseinstalldir="/" md5sum="090ce475b8a9773a240e954334988c75" name="test/Horde/Mapi/phpunit.xml" role="test" />
+@@ -79,7 +78,6 @@
+    <install as="Horde/Mapi/Exception.php" name="lib/Horde/Mapi/Exception.php" />
+    <install as="Horde/Mapi/Timezone.php" name="lib/Horde/Mapi/Timezone.php" />
+    <install as="Horde/Mapi/AllTests.php" name="test/Horde/Mapi/AllTests.php" />
+-   <install as="Horde/Mapi/Autoload.php" name="test/Horde/Mapi/Autoload.php" />
+    <install as="Horde/Mapi/bootstrap.php" name="test/Horde/Mapi/bootstrap.php" />
+    <install as="Horde/Mapi/MapiTest.php" name="test/Horde/Mapi/MapiTest.php" />
+    <install as="Horde/Mapi/phpunit.xml" name="test/Horde/Mapi/phpunit.xml" />


More information about the pkg-php-pear mailing list