1
0
Fork 0

Merge branch '1.6'

pull/7006/head
Jordi Boggiano 2018-01-09 17:57:34 +01:00
commit 4331b11624
3 changed files with 10 additions and 4 deletions

View File

@ -125,7 +125,12 @@ class ValidatingArrayLoader implements LoaderInterface
foreach ($licenses as $license) { foreach ($licenses as $license) {
$spdxLicense = $licenseValidator->getLicenseByIdentifier($license); $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
if ($spdxLicense && $spdxLicense[3]) { if ($spdxLicense && $spdxLicense[3]) {
if (preg_match('{^[AL]?GPL-[123](\.[01])?\+?$}i', $license)) { if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
$this->warnings[] = sprintf(
'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
$license
);
} elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
$this->warnings[] = sprintf( $this->warnings[] = sprintf(
'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead', 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
$license $license

View File

@ -48,7 +48,7 @@ class Url
} elseif (in_array($host, $config->get('github-domains'), true)) { } elseif (in_array($host, $config->get('github-domains'), true)) {
$url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url); $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
} elseif (in_array($host, $config->get('gitlab-domains'), true)) { } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
$url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '$1'.$ref, $url); $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
} }
return $url; return $url;

View File

@ -21,12 +21,12 @@ class UrlTest extends TestCase
/** /**
* @dataProvider distRefsProvider * @dataProvider distRefsProvider
*/ */
public function testUpdateDistReference($url, $expectedUrl, $conf = array()) public function testUpdateDistReference($url, $expectedUrl, $conf = array(), $ref = 'newref')
{ {
$config = new Config(); $config = new Config();
$config->merge(array('config' => $conf)); $config->merge(array('config' => $conf));
$this->assertSame($expectedUrl, Url::updateDistReference($config, $url, 'newref')); $this->assertSame($expectedUrl, Url::updateDistReference($config, $url, $ref));
} }
public static function distRefsProvider() public static function distRefsProvider()
@ -55,6 +55,7 @@ class UrlTest extends TestCase
// gitlab enterprise // gitlab enterprise
array('https://mygitlab.com/api/v4/projects/foo%2Fbar/repository/archive.tar.gz?sha=abcd', 'https://mygitlab.com/api/v4/projects/foo%2Fbar/repository/archive.tar.gz?sha=newref', array('gitlab-domains' => array('mygitlab.com'))), array('https://mygitlab.com/api/v4/projects/foo%2Fbar/repository/archive.tar.gz?sha=abcd', 'https://mygitlab.com/api/v4/projects/foo%2Fbar/repository/archive.tar.gz?sha=newref', array('gitlab-domains' => array('mygitlab.com'))),
array('https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=abcd', 'https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=newref', array('gitlab-domains' => array('mygitlab.com'))), array('https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=abcd', 'https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=newref', array('gitlab-domains' => array('mygitlab.com'))),
array('https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=abcd', 'https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=65', array('gitlab-domains' => array('mygitlab.com')), '65'),
); );
} }
} }