Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f003c59

Browse filesBrowse files
[travis] fix composer.lock invalidation for deps=low
1 parent 3223d2e commit f003c59
Copy full SHA for f003c59

File tree

Expand file treeCollapse file tree

3 files changed

+66
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+66
-2
lines changed

‎.github/rm-invalid-lowest-lock-files.php

Copy file name to clipboardExpand all lines: .github/rm-invalid-lowest-lock-files.php
+64Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<?php
22

3+
error_reporting(-1);
4+
set_error_handler(function ($type, $message, $file, $line) {
5+
if (error_reporting()) {
6+
throw new \ErrorException($message, 0, $type, $file, $line);
7+
}
8+
});
39
array_shift($_SERVER['argv']);
410
$dirs = $_SERVER['argv'];
511

@@ -59,6 +65,8 @@ function getContentHash(array $composerJson)
5965
$composerJsons[$composerJson['name']] = array($dir, $composerLock['packages'], getRelevantContent($composerJson));
6066
}
6167

68+
$referencedCommits = array();
69+
6270
foreach ($composerJsons as list($dir, $lockedPackages)) {
6371
foreach ($lockedPackages as $lockedJson) {
6472
if (0 !== strpos($version = $lockedJson['version'], 'dev-') && '-dev' !== substr($version, -4)) {
@@ -83,5 +91,61 @@ function getContentHash(array $composerJson)
8391
@unlink($dir.'/composer.lock');
8492
continue 2;
8593
}
94+
95+
$referencedCommits[$name][$lockedJson['source']['reference']][] = $dir;
96+
}
97+
}
98+
99+
if (!$referencedCommits || (isset($_SERVER['TRAVIS_PULL_REQUEST']) && 'false' !== $_SERVER['TRAVIS_PULL_REQUEST'])) {
100+
// cached commits cannot be stale for PRs
101+
return;
102+
}
103+
104+
@mkdir($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org', 0777, true);
105+
106+
$ch = null;
107+
$mh = curl_multi_init();
108+
$sh = curl_share_init();
109+
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
110+
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
111+
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
112+
$chs = array();
113+
114+
foreach ($referencedCommits as $name => $dirsByCommit) {
115+
$chs[] = $ch = array(curl_init(), fopen($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org/provider-'.strtr($name, '/', '$').'.json', 'wb'));
116+
curl_setopt($ch[0], CURLOPT_URL, 'https://repo.packagist.org/p/'.$name.'.json');
117+
curl_setopt($ch[0], CURLOPT_FILE, $ch[1]);
118+
curl_setopt($ch[0], CURLOPT_SHARE, $sh);
119+
curl_multi_add_handle($mh, $ch[0]);
120+
}
121+
122+
do {
123+
curl_multi_exec($mh, $active);
124+
curl_multi_select($mh);
125+
} while ($active);
126+
127+
foreach ($chs as list($ch, $fd)) {
128+
curl_multi_remove_handle($mh, $ch);
129+
curl_close($ch);
130+
fclose($fd);
131+
}
132+
133+
foreach ($referencedCommits as $name => $dirsByCommit) {
134+
$repo = file_get_contents($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org/provider-'.strtr($name, '/', '$').'.json');
135+
$repo = json_decode($repo, true);
136+
137+
foreach ($repo['packages'][$name] as $version) {
138+
unset($referencedCommits[$name][$version['source']['reference']]);
139+
}
140+
}
141+
142+
foreach ($referencedCommits as $name => $dirsByCommit) {
143+
foreach ($dirsByCommit as $dirs) {
144+
foreach ($dirs as $dir) {
145+
if (file_exists($dir.'/composer.lock')) {
146+
echo "$dir/composer.lock references old commit for $name.\n";
147+
@unlink($dir.'/composer.lock');
148+
}
149+
}
86150
}
87151
}

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ install:
185185
else
186186
export SYMFONY_REQUIRE=">=$SYMFONY_VERSION"
187187
fi
188-
composer global require symfony/flex dev-master
188+
composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
189189
190190
- |
191191
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one

‎appveyor.yml

Copy file name to clipboardExpand all lines: appveyor.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ install:
4444
- IF NOT EXIST composer.phar (appveyor DownloadFile https://github.com/composer/composer/releases/download/1.7.1/composer.phar)
4545
- php composer.phar self-update
4646
- copy /Y .composer\* %APPDATA%\Composer\
47-
- php composer.phar global require --no-progress symfony/flex dev-master
47+
- php composer.phar global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
4848
- php .github/build-packages.php "HEAD^" src\Symfony\Bridge\PhpUnit
4949
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
5050
- php composer.phar update --no-progress --no-suggest --ansi

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.