Use inclusive language in build/make

Bug: 158889297
Test: m checkbuild
Change-Id: I54a7e55d3fdd5571ef1ae33ebe443c10d138fd28
Merged-In: I54a7e55d3fdd5571ef1ae33ebe443c10d138fd28
(cherry picked from commit c3ad80467e)
This commit is contained in:
Colin Cross
2020-06-11 11:25:05 -07:00
parent 3cd4a076ba
commit a1383d8f9d
19 changed files with 76 additions and 73 deletions

View File

@@ -13,7 +13,7 @@
# limitations under the License.
#
# Rules to check if classes in the boot jars are from the whitelisted packages.
# Rules to check if classes in the boot jars are from the list of allowed packages.
#
ifneq ($(SKIP_BOOT_JARS_CHECK),true)
@@ -37,14 +37,14 @@ platform_boot_jars := $(filter-out $(ART_APEX_JARS),$(PRODUCT_BOOT_JARS))
built_boot_jars := $(foreach j, $(updatable_boot_jars) $(art_boot_jars) $(platform_boot_jars), \
$(call intermediates-dir-for, JAVA_LIBRARIES, $(j),,COMMON)/classes.jar)
script := build/make/core/tasks/check_boot_jars/check_boot_jars.py
whitelist_file := build/make/core/tasks/check_boot_jars/package_whitelist.txt
allowed_file := build/make/core/tasks/check_boot_jars/package_allowed_list.txt
$(stamp): PRIVATE_BOOT_JARS := $(built_boot_jars)
$(stamp): PRIVATE_SCRIPT := $(script)
$(stamp): PRIVATE_WHITELIST := $(whitelist_file)
$(stamp) : $(built_boot_jars) $(script) $(whitelist_file)
$(stamp): PRIVATE_ALLOWED := $(allowed_file)
$(stamp) : $(built_boot_jars) $(script) $(allowed_file)
@echo "Check package name for $(PRIVATE_BOOT_JARS)"
$(hide) $(PRIVATE_SCRIPT) $(PRIVATE_WHITELIST) $(PRIVATE_BOOT_JARS)
$(hide) $(PRIVATE_SCRIPT) $(PRIVATE_ALLOWED) $(PRIVATE_BOOT_JARS)
$(hide) mkdir -p $(dir $@) && touch $@
.PHONY: check-boot-jars

View File

@@ -3,7 +3,7 @@
"""
Check boot jars.
Usage: check_boot_jars.py <package_whitelist_file> <jar1> <jar2> ...
Usage: check_boot_jars.py <package_allow_list_file> <jar1> <jar2> ...
"""
import logging
import os.path
@@ -12,12 +12,12 @@ import subprocess
import sys
# The compiled whitelist RE.
whitelist_re = None
# The compiled allow list RE.
allow_list_re = None
def LoadWhitelist(filename):
""" Load and compile whitelist regular expressions from filename.
def LoadAllowList(filename):
""" Load and compile allow list regular expressions from filename.
"""
lines = []
with open(filename, 'r') as f:
@@ -27,19 +27,19 @@ def LoadWhitelist(filename):
continue
lines.append(line)
combined_re = r'^(%s)$' % '|'.join(lines)
global whitelist_re
global allow_list_re
try:
whitelist_re = re.compile(combined_re)
allow_list_re = re.compile(combined_re)
except re.error:
logging.exception(
'Cannot compile package whitelist regular expression: %r',
'Cannot compile package allow list regular expression: %r',
combined_re)
whitelist_re = None
allow_list_re = None
return False
return True
def CheckJar(whitelist_path, jar):
def CheckJar(allow_list_path, jar):
"""Check a jar file.
"""
# Get the list of files inside the jar file.
@@ -53,10 +53,10 @@ def CheckJar(whitelist_path, jar):
if f.endswith('.class'):
package_name = os.path.dirname(f)
package_name = package_name.replace('/', '.')
if not package_name or not whitelist_re.match(package_name):
if not package_name or not allow_list_re.match(package_name):
print >> sys.stderr, ('Error: %s contains class file %s, whose package name %s is empty or'
' not in the whitelist %s of packages allowed on the bootclasspath.'
% (jar, f, package_name, whitelist_path))
' not in the allow list %s of packages allowed on the bootclasspath.'
% (jar, f, package_name, allow_list_path))
return False
return True
@@ -65,14 +65,14 @@ def main(argv):
if len(argv) < 2:
print __doc__
return 1
whitelist_path = argv[0]
allow_list_path = argv[0]
if not LoadWhitelist(whitelist_path):
if not LoadAllowList(allow_list_path):
return 1
passed = True
for jar in argv[1:]:
if not CheckJar(whitelist_path, jar):
if not CheckJar(allow_list_path, jar):
passed = False
if not passed:
return 1

View File

@@ -1,4 +1,4 @@
# Boot jar package name whitelist.
# Boot jar package name allowed list.
# Each line is interpreted as a regular expression.
###################################################

View File

@@ -15,7 +15,7 @@
#
# Restrict the vendor module owners here.
_vendor_owner_whitelist := \
_vendor_owner_allowed_list := \
asus \
audience \
atmel \
@@ -87,14 +87,14 @@ _vendor_check_copy_files := $(filter-out $(_vendor_exception_path_prefix),\
$(filter vendor/%, $(PRODUCT_COPY_FILES)))
ifneq (,$(_vendor_check_copy_files))
$(foreach c, $(_vendor_check_copy_files), \
$(if $(filter $(_vendor_owner_whitelist), $(call word-colon,3,$(c))),,\
$(if $(filter $(_vendor_owner_allowed_list), $(call word-colon,3,$(c))),,\
$(error Error: vendor PRODUCT_COPY_FILES file "$(c)" has unknown owner))\
$(eval _vendor_module_owner_info += $(call word-colon,2,$(c)):$(call word-colon,3,$(c))))
endif
_vendor_check_copy_files :=
$(foreach m, $(_vendor_check_modules), \
$(if $(filter $(_vendor_owner_whitelist), $(ALL_MODULES.$(m).OWNER)),,\
$(if $(filter $(_vendor_owner_allowed_list), $(ALL_MODULES.$(m).OWNER)),,\
$(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) with unknown owner \
"$(ALL_MODULES.$(m).OWNER)" in product "$(TARGET_PRODUCT)"))\
$(if $(ALL_MODULES.$(m).INSTALLED),\