From 8bfea1eb5d664f1724cd95d3ebc5cdb7e18458e1 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 19 Apr 2016 07:19:27 +0200 Subject: composer: fix path --- composer-rpm.patch | 59 +++++++++++++++++++++++++++++++++++++++++++++++------- composer.spec | 13 ++++++++++++ 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/composer-rpm.patch b/composer-rpm.patch index 108900f..7021034 100644 --- a/composer-rpm.patch +++ b/composer-rpm.patch @@ -1,6 +1,6 @@ diff -up ./bin/composer.rpm ./bin/composer ---- ./bin/composer.rpm 2016-01-27 14:04:22.000000000 +0100 -+++ ./bin/composer 2016-01-27 16:32:11.313455545 +0100 +--- ./bin/composer.rpm 2016-04-18 22:14:28.000000000 +0200 ++++ ./bin/composer 2016-04-19 07:15:05.420424086 +0200 @@ -5,7 +5,7 @@ if (PHP_SAPI !== 'cli') { echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL; } @@ -11,8 +11,8 @@ diff -up ./bin/composer.rpm ./bin/composer use Composer\Console\Application; diff -up ./src/Composer/Autoload/AutoloadGenerator.php.rpm ./src/Composer/Autoload/AutoloadGenerator.php ---- ./src/Composer/Autoload/AutoloadGenerator.php.rpm 2016-01-27 14:04:22.000000000 +0100 -+++ ./src/Composer/Autoload/AutoloadGenerator.php 2016-01-27 16:32:11.313455545 +0100 +--- ./src/Composer/Autoload/AutoloadGenerator.php.rpm 2016-04-18 22:14:28.000000000 +0200 ++++ ./src/Composer/Autoload/AutoloadGenerator.php 2016-04-19 07:15:05.421424090 +0200 @@ -287,7 +287,7 @@ EOF; file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader)); @@ -22,10 +22,31 @@ diff -up ./src/Composer/Autoload/AutoloadGenerator.php.rpm ./src/Composer/Autolo if ($this->runScripts) { $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array( +diff -up ./src/Composer/Compiler.php.rpm ./src/Composer/Compiler.php +--- ./src/Composer/Compiler.php.rpm 2016-04-18 22:14:28.000000000 +0200 ++++ ./src/Composer/Compiler.php 2016-04-19 07:15:05.421424090 +0200 +@@ -96,7 +96,7 @@ class Compiler + $finder = new Finder(); + $finder->files() + ->name('*.json') +- ->in(__DIR__.'/../../res') ++ ->in((getenv('BUILDROOT')?:'') . '/usr/share/composer/res') + ->in(SpdxLicenses::getResourcesDir()) + ->sort($finderSort) + ; +@@ -138,7 +138,7 @@ class Compiler + } + $this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/composer/ClassLoader.php')); + +- $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../res/cacert.pem'), false); ++ $this->addFile($phar, new \SplFileInfo((getenv('BUILDROOT')?:'') . '/usr/share/composer/res/cacert.pem'), false); + + $this->addComposerBin($phar); + diff -up ./src/Composer/Json/JsonFile.php.rpm ./src/Composer/Json/JsonFile.php ---- ./src/Composer/Json/JsonFile.php.rpm 2016-01-27 14:04:22.000000000 +0100 -+++ ./src/Composer/Json/JsonFile.php 2016-01-27 16:32:11.313455545 +0100 -@@ -155,7 +155,7 @@ class JsonFile +--- ./src/Composer/Json/JsonFile.php.rpm 2016-04-18 22:14:28.000000000 +0200 ++++ ./src/Composer/Json/JsonFile.php 2016-04-19 07:15:05.421424090 +0200 +@@ -156,7 +156,7 @@ class JsonFile self::validateSyntax($content, $this->path); } @@ -34,3 +55,27 @@ diff -up ./src/Composer/Json/JsonFile.php.rpm ./src/Composer/Json/JsonFile.php $schemaData = json_decode(file_get_contents($schemaFile)); if ($schema === self::LAX_SCHEMA) { +diff -up ./src/Composer/Util/RemoteFilesystem.php.rpm ./src/Composer/Util/RemoteFilesystem.php +--- ./src/Composer/Util/RemoteFilesystem.php.rpm 2016-04-18 22:14:28.000000000 +0200 ++++ ./src/Composer/Util/RemoteFilesystem.php 2016-04-19 07:15:05.421424090 +0200 +@@ -925,7 +925,7 @@ class RemoteFilesystem + } + } + +- return $caPath = __DIR__.'/../../../res/cacert.pem'; // Bundled with Composer, last resort ++ return $caPath = (getenv('BUILDROOT')?:'') . '/usr/share/composer/res/cacert.pem'; // Bundled with Composer, last resort + } + + /** +diff -up ./tests/Composer/Test/Json/ComposerSchemaTest.php.rpm ./tests/Composer/Test/Json/ComposerSchemaTest.php +--- ./tests/Composer/Test/Json/ComposerSchemaTest.php.rpm 2016-04-19 07:15:19.122479957 +0200 ++++ ./tests/Composer/Test/Json/ComposerSchemaTest.php 2016-04-19 07:15:45.229586410 +0200 +@@ -87,7 +87,7 @@ class ComposerSchemaTest extends \PHPUni + + private function check($json) + { +- $schema = json_decode(file_get_contents(__DIR__ . '/../../../../res/composer-schema.json')); ++ $schema = json_decode(file_get_contents((getenv('BUILDROOT')?:'') . '/usr/share/composer/res/composer-schema.json')); + $validator = new Validator(); + $validator->check(json_decode($json), $schema); + diff --git a/composer.spec b/composer.spec index 67f728f..88b410c 100644 --- a/composer.spec +++ b/composer.spec @@ -54,6 +54,9 @@ BuildRequires: php-seld-phar-utils >= 1.0.1 BuildRequires: php-seld-cli-prompt >= 1.0.0-3 %endif +# ca-certificates +Requires: %{_sysconfdir}/pki/tls/certs/ca-bundle.crt + # From composer.json, "require": { # "php": "^5.3.2 || ^7.0", # "justinrainbow/json-schema": "^1.6", @@ -136,6 +139,11 @@ Documentation: https://getcomposer.org/doc/ %patch0 -p1 -b .rpm find . -name \*.rpm -exec rm {} \; -print +if grep -r '\.\./res'; then + : Patch need to fixed + exit 1 +fi + cp -p %{SOURCE1} src/Composer/autoload.php cp -p %{SOURCE2} tests/bootstrap.php rm src/bootstrap.php @@ -191,6 +199,9 @@ install -Dpm 755 bin/%{name} %{buildroot}%{_bindir}/%{name} rm tests/Composer/Test/Downloader/XzDownloaderTest.php %endif +: Ensure not used +rm -rf res + : Run test suite export BUILDROOT=%{buildroot} %{_bindir}/phpunit --include-path %{buildroot}%{_datadir}/php --verbose @@ -221,6 +232,8 @@ rm -rf %{buildroot} %changelog * Tue Apr 19 2016 Remi Collet - 1.0.1-1 - update to 1.0.1 +- add dependency on ca-certificates +- fix patch for RPM path * Tue Apr 5 2016 Remi Collet - 1.0.0-1 - update to 1.0.0 -- cgit