Add a function to provide the list of third-party directories which are incompatible with Android.

For most directories, we use a regex of whitelisted licenses to parse the 'License' field from the metadata. In some case, for example, where a custom license is used, we rely on a new 'Android Compatibility' field.

This functionality will be used by the snapshot tool, which will exclude these incompatible directories from the snapshot in the Android tree.

BUG=138921

Review URL: https://chromiumcodereview.appspot.com/10829272

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151462 0039d316-1c4b-4281-b951-d872f2087c98
parent 47ac1123
......@@ -49,6 +49,8 @@ chrome/app/theme/chromium/BRANDING
# license. This third-party code is taken from Mozilla, the license for which
# we already pick up from third_party/npapi/.
chrome/browser/download/download_extensions.cc
# String 'copyright' used in code.
chrome/browser/importer/firefox_importer_utils.cc
# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2
# license. Not used on Android.
chrome/browser/importer/firefox_profile_lock.cc
......
......@@ -31,6 +31,40 @@ sys.path.append(os.path.join(REPOSITORY_ROOT, 'tools'))
import licenses
def GetIncompatibleDirectories():
"""Gets a list of third-party directories which use licenses incompatible
with Android. This is used by the snapshot tool.
Returns:
A list of directories.
"""
whitelist = [
'Apache( Version)? 2(\.0)?',
'(New )?BSD( 3-Clause)?( with advertising clause)?',
'L?GPL ?v?2(\.[01])?( or later)?',
'MIT(/X11)?(-like)?',
'MPL 1\.1 ?/ ?GPL 2(\.0)? ?/ ?LGPL 2\.1',
'Microsoft Limited Public License',
'Microsoft Permissive License',
'Public Domain',
'SGI Free Software License B',
'X11',
]
regex = '^(%s)$' % '|'.join(whitelist)
result = []
for directory in _FindThirdPartyDirs():
metadata = licenses.ParseDir(directory)
if metadata.get('License Android Compatible', 'no') == 'yes':
continue
license = re.split(' [Ll]icenses?$', metadata['License'])[0]
tokens = [x.strip() for x in re.split(' and |,', license) if len(x) > 0]
for token in tokens:
if not re.match(regex, token, re.IGNORECASE):
result.append(directory)
break
return result
def _CheckLicenseHeaders(directory_list, whitelisted_files):
"""Checks that all files which are not in a listed third-party directory,
and which do not use the standard Chromium license, are whitelisted.
......
......@@ -7,6 +7,7 @@ Revision: (OPTIONAL if version is supplied) The current revision of the package
License: The license under which the package is distributed. Arbitrary text is allowed, but prefer standard forms, eg MIT/X11/BSD/Apache 2.0/GPL/LGPL.
License File: (OPTIONAL) File that contains a copy of the package's license. Use the special value NOT_SHIPPED to indicate that the package is not included in the shipped product, so its license does not need to be included in about:credits and no license file is required.
Security Critical: Either yes or no depending on whether this package is shipped in releases. For example openssl is critical where cygwin is not.
License Android Compatible: (OPTIONAL) Whether the package uses a license compatible with Android. Required only if the package is compatible and the 'License' field uses a non-standard value.
Description:
A short description of what the package is and is used for.
......
......@@ -4,7 +4,7 @@ URL: https://github.com/kalman/templates
Version: 0
Date: July 13, 2012
Revision: commit 606e9f31a240173e5d6c0b8768159c2e2835da42
License: Apache License, Version 2.0
License: Apache 2.0
Security Critical: no
Description:
......
......@@ -4,6 +4,7 @@ Version: unknown
License: Custom license
License File: LICENSE
Security Critical: yes
License Android Compatible: yes
Description:
Contain support for ICC color profile on top of jpeg6b (and up) library.
......
......@@ -3,7 +3,7 @@ Short Name: khronos_headers
URL: http://www.khronos.org/registry
Version: unknown
Date: 2012-02-01
License: MIT/X11 (BSD like) for {EGL,KHR}/*, SGI Free Software License B for GLES2/*
License: MIT/X11, SGI Free Software License B
Security Critical: no
Description:
......@@ -11,6 +11,9 @@ This package contains header files for the EGL and OpenGL ES 2.0 APIs from
Khronos. They are used for compiling code against these APIs as well as for
generating the GL binding initialization logic.
MIT/X11 (BSD like) license is for {EGL,KHR}/*, SGI Free Software License B is
for GLES2/*.
Local Modifications:
GLES2/gl2.h
......
......@@ -3,7 +3,7 @@ Short Name: libXNVCtrl
URL: cgit.freedesktop.org/~aplattner/nvidia-settings/
Version: unknown
Date: 2008
License: MIT license.
License: MIT
Security Critical: no
Description:
......
......@@ -3,6 +3,7 @@ URL: http://www.ijg.org/
Version: 6b
License: Custom license
Security Critical: yes
License Android Compatible: yes
Description:
This contains a copy of libjpeg-6b.
......
......@@ -3,6 +3,7 @@ URL: http://libpng.org/
Version: 1.2.45
Security Critical: yes
License: libpng license
License Android Compatible: yes
Description:
Our custom configuration options are defined in pngusr.h. This was previously
......
......@@ -2,7 +2,7 @@ Name: SMHasher
URL: http://code.google.com/p/smhasher/
Version: 0
Revision: 146
License: MIT (SMHasher), Public Domain (MurmurHash)
License: MIT, Public Domain
License File: LICENSE
Security Critical: yes
......@@ -10,3 +10,5 @@ Description:
This is a library containing the MurmurHash3 function, and a hashing function
test suite.
Licenses are MIT (SMHasher) and Public Domain (MurmurHash).
......@@ -3,6 +3,7 @@ URL: http://zlib.net/
Version: 1.2.5
Security Critical: yes
License: Custom license
License Android Compatible: yes
Description:
General purpose compression library
......
......@@ -109,6 +109,7 @@ SPECIAL_CASES = {
"Name": "open-vcdiff",
"URL": "http://code.google.com/p/open-vcdiff",
"License": "Apache 2.0, MIT, GPL v2 and custom licenses",
"License Android Compatible": "yes",
},
os.path.join('testing', 'gmock'): {
"Name": "gmock",
......@@ -247,7 +248,7 @@ def ParseDir(path):
# Relative path to a file containing some html we're required to place in
# about:credits.
optional_keys = ["Required Text"]
optional_keys = ["Required Text", "License Android Compatible"]
if path in SPECIAL_CASES:
metadata.update(SPECIAL_CASES[path])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment