Bug 1542826 - Add BSD-3-Clause license to about:license and whitelist sha1 which uses it. r=froydnj,mhoye

Differential Revision: https://phabricator.services.mozilla.com/D28355

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kartikaya Gupta 2019-04-23 19:56:09 +00:00
Родитель e8ab7b8564
Коммит 80e9ccefb1
2 изменённых файлов: 60 добавлений и 4 удалений

Просмотреть файл

@ -146,6 +146,10 @@ Please commit or stash these changes before vendoring, or re-run with `--ignore-
'Apache-2.0',
'Apache-2.0 WITH LLVM-exception',
'BSD-2-Clause',
# BSD-3-Clause is ok, but packages using it must be added to the
# appropriate section of about:licenses. To encourage people to remember
# to do that, we do not whitelist the license itself and we require the
# packages to be added to RUNTIME_LICENSE_PACKAGE_WHITELIST below.
'CC0-1.0',
'ISC',
'MIT',
@ -164,6 +168,14 @@ Please commit or stash these changes before vendoring, or re-run with `--ignore-
]
}
# This whitelist should only be used for packages that use an acceptable
# license, but that also need to explicitly mentioned in about:license.
RUNTIME_LICENSE_PACKAGE_WHITELIST = {
'BSD-3-Clause': [
'sha1',
]
}
# This whitelist should only be used for packages that use a
# license-file and for which the license-file entry has been
# reviewed. The table is keyed by package names and maps to the
@ -178,7 +190,7 @@ Please commit or stash these changes before vendoring, or re-run with `--ignore-
}
@staticmethod
def runtime_license(license_string):
def runtime_license(package, license_string):
"""Cargo docs say:
---
https://doc.rust-lang.org/cargo/reference/manifest.html
@ -200,8 +212,11 @@ Please commit or stash these changes before vendoring, or re-run with `--ignore-
return False
license_list = re.split(r'\s*/\s*|\s+OR\s+', license_string)
if any(license in VendorRust.RUNTIME_LICENSE_WHITELIST for license in license_list):
return True
for license in license_list:
if license in VendorRust.RUNTIME_LICENSE_WHITELIST:
return True
if package in VendorRust.RUNTIME_LICENSE_PACKAGE_WHITELIST.get(license, []):
return True
return False
def _check_licenses(self, vendor_dir):
@ -212,7 +227,7 @@ Please commit or stash these changes before vendoring, or re-run with `--ignore-
self.log(logging.DEBUG, 'package_license', {},
'has license {}'.format(license))
if not self.runtime_license(license):
if not self.runtime_license(package, license):
if license not in self.BUILDTIME_LICENSE_WHITELIST:
self.log(logging.ERROR, 'package_license_error', {},
'''Package {} has a non-approved license: {}.

Просмотреть файл

@ -75,6 +75,7 @@
<li><a href="about:license#babel">Babel License</a></li>
<li><a href="about:license#babylon">Babylon License</a></li>
<li><a href="about:license#bincode">bincode License</a></li>
<li><a href="about:license#bsd3clause">BSD-3-Clause License</a></li>
<li><a href="about:license#bspatch">bspatch License</a></li>
<li><a href="about:license#byteorder">byteorder License</a></li>
<li><a href="about:license#cairo">Cairo Component Licenses</a></li>
@ -2892,6 +2893,46 @@ SOFTWARE.
</pre>
<hr>
<h1><a id="bsd3clause"></a>BSD-3-Clause License</h1>
<p>This license applies to files in the following directories:
<ul>
<li><code>third_party/rust/sha1</code></li>
</ul>
See the individual LICENSE files for copyright owners.</p>
<pre>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</pre>
<hr>
<h1><a id="bspatch"></a>bspatch License</h1>