From facdd8a5038986f059dda746906b78ff90b9324f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 1 May 2015 13:44:24 +0100 Subject: [PATCH] Add phar-utils package to update timestamps after the build is done, refs #3927 --- bin/compile | 4 +++- composer.json | 3 ++- composer.lock | 46 ++++++++++++++++++++++++++++++++++++++- src/Composer/Compiler.php | 6 +++++ 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/bin/compile b/bin/compile index e1acab34c..ce98de81c 100755 --- a/bin/compile +++ b/bin/compile @@ -3,7 +3,9 @@ $cwd = getcwd(); chdir(__DIR__.'/../'); -shell_exec('php bin/composer install -q'); +// Install with the current version to force it having the right ClassLoader version +// Install without dev packages to clean up the included classmap from phpunit classes +shell_exec('php bin/composer install -q --no-dev'); chdir($cwd); require __DIR__.'/../src/bootstrap.php'; diff --git a/composer.json b/composer.json index 7ce97be8a..7d9b8b698 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,8 @@ "seld/jsonlint": "~1.0", "symfony/console": "~2.5", "symfony/finder": "~2.2", - "symfony/process": "~2.1" + "symfony/process": "~2.1", + "seld/phar-utils": "~1.0" }, "require-dev": { "phpunit/phpunit": "~4.5", diff --git a/composer.lock b/composer.lock index b5c4f49e8..ad6143a67 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "9a6a4c54f625e54ffe83b995dd796620", + "hash": "3b9e15f9521bb0a41897f65f76c1c7de", "packages": [ { "name": "justinrainbow/json-schema", @@ -118,6 +118,50 @@ ], "time": "2015-01-04 21:18:15" }, + { + "name": "seld/phar-utils", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/phar-utils.git", + "reference": "9e36488921bc9252f9712190931966b2fe817e51" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/9e36488921bc9252f9712190931966b2fe817e51", + "reference": "9e36488921bc9252f9712190931966b2fe817e51", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\PharUtils\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "PHAR file format utilities, for when PHP phars you up", + "keywords": [ + "phra" + ], + "time": "2015-05-01 12:39:58" + }, { "name": "symfony/console", "version": "v2.6.6", diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index 971c2f29e..77b48825e 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -15,6 +15,7 @@ namespace Composer; use Composer\Json\JsonFile; use Symfony\Component\Finder\Finder; use Symfony\Component\Process\Process; +use Seld\PharUtils\Timestamps; /** * The Compiler class compiles composer into a phar @@ -143,6 +144,11 @@ class Compiler $this->addFile($phar, new \SplFileInfo(__DIR__.'/../../LICENSE'), false); unset($phar); + + // resign the phar with reproducible timestamp / signature + $util = new Timestamps($pharFile); + $util->updateTimestamps($this->versionDate); + $util->save($pharFile, \Phar::SHA1); } private function addFile($phar, $file, $strip = true)