Skip to content

Commit

Permalink
Add missing third-party code to brave://credits (fixes brave/brave-br…
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarier committed Nov 9, 2019
1 parent 171e1aa commit fe570ef
Show file tree
Hide file tree
Showing 2 changed files with 174 additions and 0 deletions.
30 changes: 30 additions & 0 deletions patches/tools-licenses.py.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/tools/licenses.py b/tools/licenses.py
index 791efb55b47141db7b961784f80f1dedd57e8823..3bf6e8298ebd870d8f769bc3ab268a78bb393423 100755
--- a/tools/licenses.py
+++ b/tools/licenses.py
@@ -31,6 +31,7 @@ import tempfile
_REPOSITORY_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
sys.path.insert(0, os.path.join(_REPOSITORY_ROOT, 'build/android/gyp'))
from util import build_utils
+from brave_license_helper import AddBraveCredits, BRAVE_THIRD_PARTY_DIRS


# Paths from the root of the tree to directories to skip.
@@ -290,6 +291,7 @@ SPECIAL_CASES = {
"License File": "/third_party/swiftshader/LICENSE.txt",
},
}
+(PRUNE_DIRS, ADDITIONAL_PATHS) = AddBraveCredits(PRUNE_PATHS, SPECIAL_CASES, PRUNE_DIRS, ADDITIONAL_PATHS)

# Special value for 'License File' field used to indicate that the license file
# should not be used in about:credits.
@@ -475,7 +477,8 @@ def FindThirdPartyDirs(prune_paths, root):
if skip in dirs:
dirs.remove(skip)

- if os.path.basename(path) == 'third_party':
+ if (os.path.basename(path) == 'third_party' or
+ os.path.basename(path) in BRAVE_THIRD_PARTY_DIRS):
# Add all subdirectories that are not marked for skipping.
for dir in dirs:
dirpath = os.path.join(path, dir)
144 changes: 144 additions & 0 deletions script/brave_license_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Copyright (c) 2019 The Brave Authors. All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at https://mozilla.org/MPL/2.0/. */

import os

BRAVE_THIRD_PARTY_DIRS = [
'fonts',
'vendor',
]


def AddBraveCredits(prune_paths, special_cases, prune_dirs, additional_paths):
# Exclude these specific paths from needing a README.chromium file.
prune_paths.update([
# Formerly external Brave code which has moved to brave-core
# (i.e these are already covered by the Brave Browser license notice).
os.path.join('brave', 'vendor', 'bat-native-ads'),
os.path.join('brave', 'vendor', 'bat-native-confirmations'),
os.path.join('brave', 'vendor', 'bat-native-ledger'),
os.path.join('brave', 'vendor', 'brave-ios'),
os.path.join('brave', 'vendor', 'brave_base'),

# Brave overrides to third-party code, also covered by main notice.
os.path.join('brave', 'third_party', 'android_deps'),
os.path.join('brave', 'third_party', 'blink'),
os.path.join('brave', 'third_party', 'libaddressinput'),
])

# Add the licensing info that would normally be in a README.chromium file.
# This is for when we pull in external repos directly.
special_cases.update({
os.path.join('brave', 'vendor', 'adblock_rust_ffi'): {
"Name": "adblock-rust-ffi",
"URL": "https://github.com/brave/adblock-rust-ffi",
"License": "MPL-2.0",
},
os.path.join('brave', 'vendor', 'autoplay-whitelist'): {
"Name": "autoplay-whitelist",
"URL": "https://github.com/brave/autoplay-whitelist",
"License": "MPL-2.0",
},
os.path.join('brave', 'vendor', 'bat-native-anonize'): {
"Name": "bat-native-anonize",
"URL": "https://github.com/brave-intl/bat-native-anonize",
"License": "Apache-2.0",
"License File": "/brave/vendor/bat-native-anonize/LICENSE.txt",
},
os.path.join('brave', 'vendor', 'bat-native-rapidjson'): {
"Name": "RapidJSON",
"URL": "https://github.com/brave-intl/bat-native-rapidjson",
"License": "MIT",
"License File": "/brave/vendor/bat-native-rapidjson/license.txt",
},
os.path.join('brave', 'vendor', 'bat-native-tweetnacl'): {
"Name": "TweetNaCl",
"URL": "https://github.com/brave-intl/bat-native-tweetnacl",
"License": "MPL-2.0",
},
os.path.join('brave', 'vendor', 'bat-native-usermodel'): {
"Name": "BAT Native User Model",
"URL": "https://github.com/brave-intl/bat-native-usermodel",
"License": "MPL-2.0",
},
os.path.join('brave', 'vendor', 'bip39wally-core-native'): {
"Name": "libwally-core",
"URL": "https://github.com/brave-intl/bat-native-bip39wally-core",
"License": "MIT",
},
os.path.join('brave', 'vendor', 'bloom-filter-cpp'): {
"Name": "BloomFilter.cpp",
"URL": "https://github.com/brave/bloom-filter-cpp",
"License": "MPL-2.0",
},
os.path.join('brave', 'vendor', 'boto'): {
"Name": "boto",
"URL": "https://github.com/boto/boto",
"License": "MIT",
},
os.path.join('brave', 'vendor', 'brave-extension'): {
"Name": "Brave Only Extension",
"URL": "https://github.com/brave/brave-extension",
"License": "MPL-2.0",
},
os.path.join('brave', 'vendor', 'challenge_bypass_ristretto_ffi'): {
"Name": "challenge-bypass-ristretto-ffi",
"URL": "https://github.com/brave-intl/challenge-bypass-ristretto-ffi",
"License": "MPL-2.0",
},
os.path.join('brave', 'vendor', 'extension-whitelist'): {
"Name": "extension-whitelist",
"URL": "https://github.com/brave/extension-whitelist",
"License": "MPL-2.0",
},
os.path.join('brave', 'vendor', 'hashset-cpp'): {
"Name": "Hash Set",
"URL": "https://github.com/brave/hashset-cpp",
"License": "MPL-2.0",
},
os.path.join('brave', 'vendor', 'omaha'): {
"Name": "Omaha",
"URL": "https://github.com/brave/omaha",
"License": "Apache-2.0",
"License File": "/brave/vendor/omaha/LICENSE.txt",
},
os.path.join('brave', 'vendor', 'python-patch'): {
"Name": "Python Patch",
"URL": "https://github.com/brave/python-patch",
"License": "MIT",
"License File": "/brave/vendor/python-patch/doc/LICENSE",
},
os.path.join('brave', 'vendor', 'requests'): {
"Name": "Requests",
"URL": "https://github.com/psf/requests",
"License": "Apache-2.0",
},
os.path.join('brave', 'vendor', 'sparkle'): {
"Name": "Sparkle",
"URL": "https://github.com/brave/Sparkle",
"License": "MIT",
},
})

# Don't recurse into these directories looking for third-party code.
prune_list = list(prune_dirs)
prune_list += [
'chromium_src', # Brave's overrides, covered by main notice.
'node_modules', # See brave/third_party/npm-* instead.
]
prune_dirs = tuple(prune_list)

# Look for a README.chromium file directly inside these directories.
# This is for directories which include third-party code that isn't
# contained under a "third_party" or "vendor" directory.
additional_list = list(additional_paths)
additional_list += [
os.path.join('brave', 'components', 'brave_prochlo'),
os.path.join('brave', 'components', 'brave_new_tab_ui', 'data'),
os.path.join('brave', 'components', 'brave_sync'),
]
additional_paths = tuple(additional_list)

return (prune_dirs, additional_paths)

0 comments on commit fe570ef

Please sign in to comment.