Handle Fuchsia SDK in license tool + roll SDK (flutter/engine#9302)

The Fuchsia SDK includes a root directory with multiple
license/copyright files. For files that don't include a copyright header
matching them to a specific license (e.g. shared library binaries) we
match them to all licenses.

Specifically, the SDK includes:
* LICENSE: the Fuchsia license
* LICENSE.vulkan: Apache 2.0 license for Vulkan
* COPYRIGHT.vulkan: additional non-Apache licenses/copyrights for Vulkan
* COPYRIGHT.musl: musl license/copyrights

Also rolls the Fuchsia SDK CIPD packages.
This commit is contained in:
Chris Bracken
2019-06-12 17:32:32 -07:00
committed by GitHub
parent 892eab4bdf
commit f4c9daeced
5 changed files with 2205 additions and 123 deletions

8
DEPS
View File

@@ -473,7 +473,7 @@ deps = {
'packages': [
{
'package': 'fuchsia/sdk/core/mac-amd64',
'version': 'jlQvNeRMq6X81_VYiFI_Ol311YCXak0xACebeb8f6TcC'
'version': 'Cx51FRV5TCoqQ9nfs4E2QMfYkJ1JWt7arQXhV01tr7cC'
}
],
'condition': 'host_os == "mac"',
@@ -483,7 +483,7 @@ deps = {
'packages': [
{
'package': 'fuchsia/clang/mac-amd64',
'version': '4OfgjQg8g3Ztj2OYJ4Zlz9Q6DGYjOTuHh3G8MSMhxg4C'
'version': 'BzmZEP9A83NSNSqnrff3k0tYJK7UXs0pknphn-quiZwC'
}
],
'condition': 'host_os == "mac"',
@@ -493,7 +493,7 @@ deps = {
'packages': [
{
'package': 'fuchsia/sdk/core/linux-amd64',
'version': '9-zyx3CzWylM-x9RYdL5UTT9uU-sl_0ysOCcEGCtot0C'
'version': 'udf6w2VmM5E8PyQm5ggugW_jjiEdWs-Xl6efeLf2JdkC'
}
],
'condition': 'host_os == "linux"',
@@ -503,7 +503,7 @@ deps = {
'packages': [
{
'package': 'fuchsia/clang/linux-amd64',
'version': 'WPg0zzXLyTjFNrOrz4uA5vPaXUuEYvTJ5DPyYdiaN3MC'
'version': 'dV3r0yk4WXi1C-QwjzNUA-pIkHCG3COYnrlt80GFacYC'
}
],
'condition': 'host_os == "linux"',

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +1,2 @@
Signature: 499a560047281c7ce35f227b57030b8b
Signature: 79db3ae5f054461f1e7fc34ff6ffdf06

View File

@@ -13,13 +13,14 @@ import 'patterns.dart';
class FetchedContentsOf extends Key { FetchedContentsOf(dynamic value) : super(value); }
enum LicenseType { unknown, bsd, gpl, lgpl, mpl, afl, mit, freetype, apache, apacheNotice, eclipse, ijg, zlib, icu, apsl, libpng, openssl }
enum LicenseType { unknown, bsd, gpl, lgpl, mpl, afl, mit, freetype, apache, apacheNotice, eclipse, ijg, zlib, icu, apsl, libpng, openssl, vulkan }
LicenseType convertLicenseNameToType(String name) {
switch (name) {
case 'Apache':
case 'apache-license-2.0':
case 'LICENSE-APACHE-2.0.txt':
case 'LICENSE.vulkan':
return LicenseType.apache;
case 'BSD':
case 'BSD.txt':
@@ -45,6 +46,8 @@ LicenseType convertLicenseNameToType(String name) {
case 'LICENSE.MPLv2':
case 'COPYING-MPL-1.1':
return LicenseType.mpl;
case 'COPYRIGHT.vulkan':
return LicenseType.vulkan;
// common file names that don't say what the type is
case 'COPYING':
case 'COPYING.txt':
@@ -63,6 +66,7 @@ LicenseType convertLicenseNameToType(String name) {
case 'license.txt':
return LicenseType.unknown;
// particularly weird file names
case 'COPYRIGHT.musl':
case 'LICENSE-APPLE':
case 'extreme.indiana.edu.license.TXT':
case 'extreme.indiana.edu.license.txt':
@@ -196,6 +200,7 @@ abstract class License implements Comparable<License> {
case LicenseType.ijg:
case LicenseType.apsl:
return MessageLicense._(body, type, origin: origin);
case LicenseType.vulkan:
case LicenseType.openssl:
return MultiLicense._(body, type, origin: origin);
case LicenseType.libpng:
@@ -329,6 +334,7 @@ abstract class License implements Comparable<License> {
assert(this is BlankLicense);
break;
case LicenseType.openssl:
case LicenseType.vulkan:
assert(this is MultiLicense);
break;
}
@@ -338,6 +344,11 @@ abstract class License implements Comparable<License> {
return true;
}());
final LicenseType detectedType = convertBodyToType(body);
// Fuchsia SDK Vulkan license is Apache 2.0 with some additional BSD-matching copyrights.
if (type == LicenseType.vulkan)
yesWeKnowWhatItLooksLikeButItIsNot = true;
if (detectedType != LicenseType.unknown && detectedType != type && !yesWeKnowWhatItLooksLikeButItIsNot)
throw 'Created a license of type $type but it looks like $detectedType\.';
if (type != LicenseType.apache && type != LicenseType.apacheNotice) {

View File

@@ -2064,6 +2064,37 @@ class _RepositoryFuchsiaDirectory extends _RepositoryDirectory {
return entry.name != 'toolchain'
&& super.shouldRecurse(entry);
}
@override
_RepositoryDirectory createSubdirectory(fs.Directory entry) {
if (entry.name == 'sdk')
return _RepositoryFuchsiaSdkDirectory(this, entry);
return super.createSubdirectory(entry);
}
}
class _RepositoryFuchsiaSdkDirectory extends _RepositoryDirectory {
_RepositoryFuchsiaSdkDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io);
@override
_RepositoryDirectory createSubdirectory(fs.Directory entry) {
if (entry.name == 'linux' || entry.name == 'mac')
return _RepositoryFuchsiaSdkLinuxDirectory(this, entry);
return super.createSubdirectory(entry);
}
}
class _RepositoryFuchsiaSdkLinuxDirectory extends _RepositoryDirectory {
_RepositoryFuchsiaSdkLinuxDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io);
@override
bool shouldRecurse(fs.IoNode entry) {
return entry.name != '.build-id'
&& entry.name != 'docs'
&& entry.name != 'images'
&& entry.name != 'meta'
&& entry.name != 'tools';
}
}
class _RepositoryFlutterThirdPartyDirectory extends _RepositoryDirectory {