From dfd4c0d57a62d5cd48a0df4b03482986c258a935 Mon Sep 17 00:00:00 2001 From: Vasil Rangelov Date: Wed, 14 Aug 2013 17:25:10 +0300 Subject: [PATCH] Packaging related fixes. --- .travis.yml | 6 +- RELEASE-1.0.0a4 | 1 + composer.json | 23 +--- docs/phpdoc.dist.xml | 2 +- extrasetup.php | 1 + package.xml | 28 ++++- packagexmlsetup.php | 255 +++++++++++++++++++++++++------------------ stub.php | 59 +++++++--- 8 files changed, 223 insertions(+), 152 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8c7b8f9..7d9be2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,9 @@ php: before_script: - composer self-update - composer install - - phpunit --configuration tests/secondaryPeer.xml & + - composer require "pear2/cache_shm" ">=0.1.2" + - cd tests + - phpunit --configuration secondaryPeer.xml & - sleep 2 script: - - phpunit --configuration tests/phpunit.xml \ No newline at end of file + - phpunit --configuration phpunit.xml \ No newline at end of file diff --git a/RELEASE-1.0.0a4 b/RELEASE-1.0.0a4 index 6ec9b1b..68cc23d 100644 --- a/RELEASE-1.0.0a4 +++ b/RELEASE-1.0.0a4 @@ -1,3 +1,4 @@ +* Support for encrypted connections. Note that due to known issues with PHP itself, encrypted connections may be unstable (as in "sometimes disconnect suddenly" or "sometimes hang when calling TcpClient::isDataAwaiting() without a timeout"). * Stream::isAcceptingData() and Stream::isDataAwaiting() now accept an optional timeout, modeled after stream_select(). * Changed sending to retry indefinetly unless the connection is broken, thanks to isDataAwaiting()'s new ability. Receiving can still timeout. * Chnaged the PHAR stub to not fail when reading the hash fails. diff --git a/composer.json b/composer.json index a0b416a..4600ca4 100644 --- a/composer.json +++ b/composer.json @@ -16,31 +16,18 @@ "wiki": "http://github.com/pear2/Net_Transmitter/wiki" }, "require": { - "php": ">=5.3.0", - "pear2/cache_shm": "@dev" + "php": ">=5.3.0" }, "suggest": { + "pear2/cache_shm": ">=0.1.2", "ext-apc": ">=3.0.13", - "ext-wincache": ">=1.1.0" + "ext-wincache": ">=1.1.0", + "ext-openssl": "*" }, "autoload": { "psr-0": { "PEAR2\\Net\\Transmitter\\": "src/" } }, - "minimum-stability": "dev", - "repositories": [ - { - "type": "package", - "package": { - "name": "pear2/cache_shm", - "version": "@dev", - "source": { - "type": "git", - "url": "https://github.com/pear2/Cache_SHM.git", - "reference": "master" - } - } - } - ] + "minimum-stability": "dev" } diff --git a/docs/phpdoc.dist.xml b/docs/phpdoc.dist.xml index 0866ef0..e19a0c4 100644 --- a/docs/phpdoc.dist.xml +++ b/docs/phpdoc.dist.xml @@ -3,7 +3,7 @@ PEAR2_Net_Transmitter documentation PEAR2_Net_Transmitter - PEAR2_Net_Transmitter__PhpDocumentor_Documentation + PEAR2_Net_Transmitter__PhpDocumentor_Cache php diff --git a/extrasetup.php b/extrasetup.php index c885c25..c14b286 100644 --- a/extrasetup.php +++ b/extrasetup.php @@ -12,6 +12,7 @@ new RecursiveDirectoryIterator( $pkg, RecursiveDirectoryIterator::UNIX_PATHS + | RecursiveDirectoryIterator::SKIP_DOTS ), RecursiveIteratorIterator::LEAVES_ONLY ) as $path diff --git a/package.xml b/package.xml index 7ac6ffe..115fd5b 100644 --- a/package.xml +++ b/package.xml @@ -13,10 +13,10 @@ This package abstracts this away, so that when you want to get exactly N amount boen.robot@gmail.com yes - 2012-08-03 - + 2013-08-15 + - 1.0.0a3 + 1.0.0a4 1.0.0 @@ -24,10 +24,17 @@ This package abstracts this away, so that when you want to get exactly N amount alpha LGPL License 2.1 - Added locking support at TcpClient, particularly for persistent connections. Also some doc fixes. + * Support for encrypted connections. Note that due to known issues with PHP itself, encrypted connections may be unstable (as in "sometimes disconnect suddenly" or "sometimes hang when calling TcpClient::isDataAwaiting() without a timeout"). +* Stream::isAcceptingData() and Stream::isDataAwaiting() now accept an optional timeout, modeled after stream_select(). +* Changed sending to retry indefinetly unless the connection is broken, thanks to isDataAwaiting()'s new ability. Receiving can still timeout. +* Chnaged the PHAR stub to not fail when reading the hash fails. +* Doc and CS fixes. + + + @@ -93,10 +100,12 @@ This package abstracts this away, so that when you want to get exactly N amount + + @@ -120,25 +129,34 @@ This package abstracts this away, so that when you want to get exactly N amount PEAR2_Cache_SHM pear2.php.net - 0.1.0 + 0.1.2 + + openssl + + + + + + + diff --git a/packagexmlsetup.php b/packagexmlsetup.php index a5f927f..e3308c4 100644 --- a/packagexmlsetup.php +++ b/packagexmlsetup.php @@ -1,59 +1,38 @@ array( - array( - 'attribs' => array( - 'from' => '../src', - 'to' => 'php_dir', - 'type' => 'pear-config' - ) - ) - ) -); - -$srcFileTasks = array( - 'tasks:replace' => array( - array( - 'attribs' => array( - 'from' => '~~summary~~', - 'to' => 'summary', - 'type' => 'package-info' - ) - ), - array( - 'attribs' => array( - 'from' => '~~description~~', - 'to' => 'description', - 'type' => 'package-info' - ) - ), - array( - 'attribs' => array( - 'from' => 'GIT: $Id$', - 'to' => 'version', - 'type' => 'package-info' +$packageGen = function ( + v2 $package, + v2 $compatible = null +) { + $srcDirTask = array( + 'tasks:replace' => array( + array( + 'attribs' => array( + 'from' => '../src', + 'to' => 'php_dir', + 'type' => 'pear-config' + ) ) ) - ) -); - - -$package->files['tests/bootstrap.php'] = array_merge_recursive( - $package->files['tests/bootstrap.php']->getArrayCopy(), - $srcDirTask -); - -$package->files['docs/phpdoc.dist.xml'] = array_merge_recursive( - $package->files['docs/phpdoc.dist.xml']->getArrayCopy(), - $srcDirTask -); + ); -$package->files['docs/doxygen.ini'] = array_merge_recursive( - $package->files['docs/doxygen.ini']->getArrayCopy(), - $srcDirTask, - array( + $srcFileTasks = array( 'tasks:replace' => array( + array( + 'attribs' => array( + 'from' => '~~summary~~', + 'to' => 'summary', + 'type' => 'package-info' + ) + ), + array( + 'attribs' => array( + 'from' => '~~description~~', + 'to' => 'description', + 'type' => 'package-info' + ) + ), array( 'attribs' => array( 'from' => 'GIT: $Id$', @@ -62,73 +41,131 @@ ) ) ) - ) -); + ); + + $package->files['tests/bootstrap.php'] = array_merge_recursive( + $package->files['tests/bootstrap.php']->getArrayCopy(), + $srcDirTask + ); + + $package->files['docs/phpdoc.dist.xml'] = array_merge_recursive( + $package->files['docs/phpdoc.dist.xml']->getArrayCopy(), + $srcDirTask + ); + $package->files['docs/apigen.neon'] = array_merge_recursive( + $package->files['docs/apigen.neon']->getArrayCopy(), + $srcDirTask + ); -$hasCompatible = isset($compatible); -if ($hasCompatible) { - $compatible->license = $package->license; - $compatible->files[ - "test/{$package->channel}/{$package->name}/bootstrap.php" - ] = array_merge_recursive( - $compatible->files[ + $package->files['docs/doxygen.ini'] = array_merge_recursive( + $package->files['docs/doxygen.ini']->getArrayCopy(), + $srcDirTask, + array( + 'tasks:replace' => array( + array( + 'attribs' => array( + 'from' => 'GIT: $Id$', + 'to' => 'version', + 'type' => 'package-info' + ) + ) + ) + ) + ); + $hasCompatible = null !== $compatible; + if ($hasCompatible) { + $compatible->license = $package->license; + $compatible->files[ "test/{$package->channel}/{$package->name}/bootstrap.php" - ]->getArrayCopy(), - $srcDirTask - ); + ] = array_merge_recursive( + $compatible->files[ + "test/{$package->channel}/{$package->name}/bootstrap.php" + ]->getArrayCopy(), + $srcDirTask + ); - $compatible->files[ - "doc/{$package->channel}/{$package->name}/phpdoc.dist.xml" - ] = array_merge_recursive( - $compatible->files[ + $compatible->files[ "doc/{$package->channel}/{$package->name}/phpdoc.dist.xml" - ]->getArrayCopy(), - $srcDirTask - ); + ] = array_merge_recursive( + $compatible->files[ + "doc/{$package->channel}/{$package->name}/phpdoc.dist.xml" + ]->getArrayCopy(), + $srcDirTask + ); - $compatible->files["doc/{$package->channel}/{$package->name}/doxygen.ini"] - = array_merge_recursive( - $compatible->files[ - "doc/{$package->channel}/{$package->name}/doxygen.ini" - ]->getArrayCopy(), - $srcDirTask, - array( - 'tasks:replace' => array( - array( - 'attribs' => array( - 'from' => 'GIT: $Id$', - 'to' => 'version', - 'type' => 'package-info' + $compatible->files["doc/{$package->channel}/{$package->name}/doxygen.ini"] + = array_merge_recursive( + $compatible->files[ + "doc/{$package->channel}/{$package->name}/doxygen.ini" + ]->getArrayCopy(), + $srcDirTask, + array( + 'tasks:replace' => array( + array( + 'attribs' => array( + 'from' => 'GIT: $Id$', + 'to' => 'version', + 'type' => 'package-info' + ) ) ) ) - ) - ); -} + ); + } -$oldCwd = getcwd(); -chdir(__DIR__); -foreach ( - new RecursiveIteratorIterator( - new RecursiveDirectoryIterator( - 'src', - RecursiveDirectoryIterator::UNIX_PATHS - ), - RecursiveIteratorIterator::LEAVES_ONLY - ) as $path) { - $filename = $path->getPathname(); - - $package->files[$filename] = array_merge_recursive( - $package->files[$filename]->getArrayCopy(), - $srcFileTasks - ); - - if ($hasCompatible) { - $compatibleFilename = str_replace('src/', 'php/', $filename); - $compatible->files[$compatibleFilename] = array_merge_recursive( - $compatible->files[$compatibleFilename]->getArrayCopy(), - $srcFileTasks - ); + $oldCwd = getcwd(); + chdir(__DIR__); + foreach ( + new RecursiveIteratorIterator( + new RecursiveDirectoryIterator( + 'src', + RecursiveDirectoryIterator::UNIX_PATHS + | RecursiveDirectoryIterator::SKIP_DOTS + ), + RecursiveIteratorIterator::LEAVES_ONLY + ) as $path) { + $filename = $path->getPathname(); + + $package->files[$filename] = array_merge_recursive( + $package->files[$filename]->getArrayCopy(), + $srcFileTasks + ); + + if ($hasCompatible) { + $compatibleFilename = str_replace('src/', 'php/', $filename); + $compatible->files[$compatibleFilename] = array_merge_recursive( + $compatible->files[$compatibleFilename]->getArrayCopy(), + $srcFileTasks + ); + } + } + + foreach ( + new RecursiveIteratorIterator( + new RecursiveDirectoryIterator( + '.', + RecursiveDirectoryIterator::UNIX_PATHS + | RecursiveDirectoryIterator::SKIP_DOTS + ), + RecursiveIteratorIterator::LEAVES_ONLY + ) as $path) { + $filename = substr($path->getPathname(), 2); + + if (isset($package->files[$filename])) { + $as = (strpos($filename, 'examples') === 0) + ? $filename + : substr($filename, strpos($filename, '/') + 1); + $package->getReleaseToInstall('php')->installAs($filename, $as); + } } + chdir($oldCwd); + return array($package, $compatible); +}; + +list($package, $compatible) = $packageGen( + $package, + isset($compatible) ? $compatible : null +); +if (null === $compatible) { + unset($compatible); } -chdir($oldCwd); diff --git a/stub.php b/stub.php index 2d51653..afdbee3 100644 --- a/stub.php +++ b/stub.php @@ -15,12 +15,12 @@ echo "\nThis package requires PHP 5.3.0 or later."; exit(1); } - + if (extension_loaded('phar')) { try { $phar = new Phar(__FILE__); $sig = $phar->getSignature(); - echo "{$sig['hash_type']} hash: {$sig['hash']}\n\n"; + echo "{$sig['hash_type']} hash: {$sig['hash']}\n"; } catch(Exception $e) { echo <<