1
0
Fork 0

Merge branch '2.0'

pull/9900/head
Jordi Boggiano 2021-05-20 14:16:52 +02:00
commit 991985792d
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
7 changed files with 47 additions and 30 deletions

View File

@ -41,7 +41,7 @@ To achieve this, you need to acquire the Composer source code:
2. Download the [`composer.phar`](https://getcomposer.org/composer.phar) executable 2. Download the [`composer.phar`](https://getcomposer.org/composer.phar) executable
3. Run Composer to get the dependencies: `cd composer && php ../composer.phar install` 3. Run Composer to get the dependencies: `cd composer && php ../composer.phar install`
You can run the test suite by executing `vendor/bin/phpunit` when inside the You can run the test suite by executing `vendor/bin/simple-phpunit` when inside the
composer directory, and run Composer by executing the `bin/composer`. To test composer directory, and run Composer by executing the `bin/composer`. To test
your modified Composer code against another project, run `php your modified Composer code against another project, run `php
/path/to/composer/bin/composer` inside that project's directory. /path/to/composer/bin/composer` inside that project's directory.

View File

@ -32,14 +32,14 @@
"psr/log": "^1.0", "psr/log": "^1.0",
"seld/jsonlint": "^1.4", "seld/jsonlint": "^1.4",
"seld/phar-utils": "^1.0", "seld/phar-utils": "^1.0",
"symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
"symfony/filesystem": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", "symfony/filesystem": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
"symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
"symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
"react/promise": "^1.2 || ^2.7" "react/promise": "^1.2 || ^2.7"
}, },
"require-dev": { "require-dev": {
"symfony/phpunit-bridge": "^4.2 || ^5.0", "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0",
"phpspec/prophecy": "^1.10" "phpspec/prophecy": "^1.10"
}, },
"suggest": { "suggest": {

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "9ca39897cc82c83aa794920b6c2f0a60", "content-hash": "bff3f5b355e45125612dff36a8f71737",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",

View File

@ -1,6 +1,6 @@
{ {
"$schema": "https://json-schema.org/draft-04/schema#", "$schema": "https://json-schema.org/draft-04/schema#",
"name": "Package", "title": "Package",
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"required": [ "name", "description" ], "required": [ "name", "description" ],
@ -42,7 +42,7 @@
"version": { "version": {
"type": "string", "type": "string",
"description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.", "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
"pattern": "^v?\\d+(((\\.\\d+)?\\.\\d+)?\\.\\d+)?|^dev-" "pattern": "^v?\\d+(\\.\\d+){0,3}|^dev-"
}, },
"time": { "time": {
"type": "string", "type": "string",
@ -397,7 +397,7 @@
"minimum-stability": { "minimum-stability": {
"type": ["string"], "type": ["string"],
"description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.", "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
"pattern": "^dev|alpha|beta|rc|RC|stable$" "enum": ["dev", "alpha", "beta", "rc", "RC", "stable"]
}, },
"prefer-stable": { "prefer-stable": {
"type": ["boolean"], "type": ["boolean"],

View File

@ -53,6 +53,9 @@ class BinaryInstaller
if (!$binaries) { if (!$binaries) {
return; return;
} }
Platform::workaroundFilesystemIssues();
foreach ($binaries as $bin) { foreach ($binaries as $bin) {
$binPath = $installPath.'/'.$bin; $binPath = $installPath.'/'.$bin;
if (!file_exists($binPath)) { if (!file_exists($binPath)) {

View File

@ -251,16 +251,32 @@ class ProcessExecutor
throw new \RuntimeException('The given CWD for the process does not exist: '.$cwd); throw new \RuntimeException('The given CWD for the process does not exist: '.$cwd);
} }
// TODO in v3, commands should be passed in as arrays of cmd + args try {
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) { // TODO in v3, commands should be passed in as arrays of cmd + args
$process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout()); if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
} else { $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
$process = new Process($command, $cwd, null, null, static::getTimeout()); } else {
$process = new Process($command, $cwd, null, null, static::getTimeout());
}
} catch (\Exception $e) {
call_user_func($job['reject'], $e);
return;
} catch (\Throwable $e) {
call_user_func($job['reject'], $e);
return;
} }
$job['process'] = $process; $job['process'] = $process;
$process->start(); try {
$process->start();
} catch (\Exception $e) {
call_user_func($job['reject'], $e);
return;
} catch (\Throwable $e) {
call_user_func($job['reject'], $e);
return;
}
} }
public function wait($index = null) public function wait($index = null)

View File

@ -71,25 +71,23 @@ class ComposerSchemaTest extends TestCase
public function testMinimumStabilityValues() public function testMinimumStabilityValues()
{ {
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "" }'; $expectedError = array(
$this->assertEquals(array(
array( array(
'property' => 'minimum-stability', 'property' => 'minimum-stability',
'message' => 'Does not match the regex pattern ^dev|alpha|beta|rc|RC|stable$', 'message' => 'Does not have a value in the enumeration ["dev","alpha","beta","rc","RC","stable"]',
'constraint' => 'pattern', 'constraint' => 'enum',
'pattern' => '^dev|alpha|beta|rc|RC|stable$', 'enum' => array('dev', 'alpha', 'beta', 'rc', 'RC', 'stable'),
), ),
), $this->check($json), 'empty string'); );
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "" }';
$this->assertEquals($expectedError, $this->check($json), 'empty string');
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "dummy" }'; $json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "dummy" }';
$this->assertEquals(array( $this->assertEquals($expectedError, $this->check($json), 'dummy');
array(
'property' => 'minimum-stability', $json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "devz" }';
'message' => 'Does not match the regex pattern ^dev|alpha|beta|rc|RC|stable$', $this->assertEquals($expectedError, $this->check($json), 'devz');
'constraint' => 'pattern',
'pattern' => '^dev|alpha|beta|rc|RC|stable$',
),
), $this->check($json), 'dummy');
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "dev" }'; $json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "dev" }';
$this->assertTrue($this->check($json), 'dev'); $this->assertTrue($this->check($json), 'dev');