提交 2cd9b41b 编写于 作者: I Ian Hickson 提交者: Chinmay Garde

Select MPL instead of LGPL (#7991)

上级 629c0d83
此差异已折叠。
Signature: 293c762c71d027f77cf88deb80f9e78e
Signature: 91b3b5b8c1ef9e911fd65b636d009be8
此差异已折叠。
......@@ -10,8 +10,17 @@ cd flutter/ci/licenses_golden
patch -p2 < my/patch/file
```
## Regenerate License Files (Only works on Linux)
To update the golden license files, make sure you've rebased your branch to the latest upstream master and then run the following in this directory:
## Check for license changes (Only works on Linux)
This script has two sets of output files: "goldens", which describe
the current license state of the repository, and the actual real
LICENSE file, which is what matters.
We look at changes to the goldens to determine if there are any actual
changes to the licenses.
To update the goldens, make sure you've rebased your branch to the
latest upstream master and then run the following in this directory:
```
pub get
......@@ -20,9 +29,29 @@ rm -rf ../../../out/licenses
dart lib/main.dart --src ../../.. --out ../../../out/licenses --golden ../../ci/licenses_golden
```
Then copy any affected files from `../../../out/licenses` to `../../ci/licenses_golden` and add them to your change.
In order for the license script to work correctly, you need to remove
any untracked files inside `engine/src` (the buildroot), not just
`engine/src/flutter`.
Once the script has finished, copy any affected files from
`../../../out/licenses` to `../../ci/licenses_golden` and add them to
your change, and examine the diffs to see what changed.
```
cp ../../../out/licenses/* ../../ci/licenses_golden
git diff
```
If the only changes are to what files are included, then you're good
to go. However, if any of the _licenses_ changed, whether new licenses
are added, old ones removed, or any have their content changed in
_any_ way (including, e.g., whitespace changes), or if the affected
libraries change, **you must update the actual license file**.
The `sky/packages/sky_engine/LICENSE` file is included in product releases and should be updated any time the golden file changes in a way that involves changes to anything other than the FILE lines. To update this file, run:
The `sky/packages/sky_engine/LICENSE` file is the one actually
included in product releases and the one that should be updated any
time the golden file changes in a way that involves changes to
anything other than the `FILE` lines. To update this file, run:
```
pub get
......@@ -30,4 +59,7 @@ gclient sync
dart lib/main.dart --release --src ../../.. --out ../../../out/licenses > ../../sky/packages/sky_engine/LICENSE
```
**In order for the license script to work, please remove all untracked files inside `engine/src` (not just `engine/src/flutter`)**
The bots do not verify that you did this step, it's important that you
do it! When reviewing patches, if you see a change to the golden
files, check to see if there's a corresponding change to the LICENSE
file!
此差异已折叠。
......@@ -269,6 +269,10 @@ abstract class License implements Comparable<License> {
body = system.File('data/academic-3.0').readAsStringSync();
type = LicenseType.afl;
break;
case 'Mozilla Public License:1.1':
body = system.File('data/mozilla-1.1').readAsStringSync();
type = LicenseType.mpl;
break;
case 'http://mozilla.org/MPL/2.0/:2.0':
body = system.File('data/mozilla-2.0').readAsStringSync();
type = LicenseType.mpl;
......
......@@ -1184,7 +1184,7 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource {
result.addAll(licenses);
progress.advance(success: true);
} catch (e, stack) {
system.stderr.writeln('error searching for copyright in: ${file.io}\n$e');
system.stderr.writeln('\nerror searching for copyright in: ${file.io}\n$e');
if (e is! String)
system.stderr.writeln(stack);
system.stderr.writeln('\n');
......@@ -2256,6 +2256,9 @@ Future<void> _collectLicensesForComponent(_RepositoryDirectory componentRoot, {
final List<License> licenses = Set<License>.from(componentRoot.getLicenses(progress).toList()).toList();
if (progress.hadErrors)
throw 'Had failures while collecting licenses.';
sink.writeln('UNUSED LICENSES:\n');
final List<String> unusedLicenses = licenses
.where((License license) => !license.isUsed)
......@@ -2268,6 +2271,38 @@ Future<void> _collectLicensesForComponent(_RepositoryDirectory componentRoot, {
sink.writeln('USED LICENSES:\n');
final List<License> usedLicenses = licenses.where((License license) => license.isUsed).toList();
final List<String> output = usedLicenses.map((License license) => license.toString()).toList();
for (int index = 0; index < output.length; index += 1) {
// The strings we look for here are strings which we do not expect to see in
// any of the licenses we use. They either represent examples of misparsing
// licenses (issues we've previously run into and fixed), or licenses we
// know we are trying to avoid (e.g. the GPL, or licenses that only apply to
// test content which shouldn't get built at all).
// If you find that one of these tests is getting hit, and it's not obvious
// to you why the relevant license is a problem, please ask around (e.g. try
// asking Hixie). Do not merely remove one of these checks, sometimes the
// issues involved are relatively subtle.
if (output[index].contains('Version: MPL 1.1/GPL 2.0/LGPL 2.1'))
throw 'Unexpected trilicense block found in: ${usedLicenses[index].origin}';
if (output[index].contains('The contents of this file are subject to the Mozilla Public License Version'))
throw 'Unexpected MPL block found in: ${usedLicenses[index].origin}';
if (output[index].contains('You should have received a copy of the GNU'))
throw 'Unexpected GPL block found in: ${usedLicenses[index].origin}';
if (output[index].contains('BoringSSL is a fork of OpenSSL'))
throw 'Unexpected legacy BoringSSL block found in: ${usedLicenses[index].origin}';
if (output[index].contains('Contents of this folder are ported from'))
throw 'Unexpected block found in: ${usedLicenses[index].origin}';
if (output[index].contains('https://github.com/w3c/web-platform-tests/tree/master/selectors-api'))
throw 'Unexpected W3C content found in: ${usedLicenses[index].origin}';
if (output[index].contains('http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html'))
throw 'Unexpected W3C copyright found in: ${usedLicenses[index].origin}';
if (output[index].contains('It is based on commit'))
throw 'Unexpected content found in: ${usedLicenses[index].origin}';
if (output[index].contains('The original code is covered by the dual-licensing approach described in:'))
throw 'Unexpected old license reference found in: ${usedLicenses[index].origin}';
if (output[index].contains('must choose'))
throw 'Unexpected indecisiveness found in: ${usedLicenses[index].origin}';
}
output.sort();
sink.writeln(output.join('\n\n'));
sink.writeln('Total license count: ${licenses.length}');
......@@ -2396,17 +2431,3 @@ Future<void> main(List<String> arguments) async {
system.exit(1);
}
}
// Sanity checks:
//
// The following substrings shouldn't be in the output:
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// The contents of this file are subject to the Mozilla Public License Version
// You should have received a copy of the GNU
// BoringSSL is a fork of OpenSSL
// Contents of this folder are ported from
// https://github.com/w3c/web-platform-tests/tree/master/selectors-api
// It is based on commit
// The original code is covered by the dual-licensing approach described in:
// http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
// must choose
......@@ -980,14 +980,14 @@ final List<MultipleVersionedLicenseReferencePattern> csReferencesByUrl = <Multip
MultipleVersionedLicenseReferencePattern(
firstPrefixIndex: 1,
indentPrefixIndex: 2,
licenseIndices: const <int>[3],
versionIndicies: const <int, int>{ 3:4 },
licenseIndices: const <int>[3], // 5 is lgpl, which we're actively not selecting
versionIndicies: const <int, int>{ 3:4 }, // 5:6 for lgpl
pattern: RegExp(
kIndent +
r'(?:Version: [GMPL/012. ]+ *\n'
r'^(?:(?:\1\2? *)? *\n)*'
r'^\1\2)?The contents of this file are subject to the Mozilla Public License Version *\n'
r'^\1\2(?:1\.1) \(the "License"\); you may not use this file except in compliance with *\n'
r'^\1\2)?The contents of this file are subject to the (Mozilla Public License) Version *\n'
r'^\1\2(1\.1) \(the "License"\); you may not use this file except in compliance with *\n'
r'^\1\2the License\. +You may obtain a copy of the License at *\n'
r'^\1\2http://www\.mozilla\.org/MPL/ *\n'
r'^(?:(?:\1\2? *)? *\n)*'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册