0

Change uses of 'whitelist' to 'allowlist' in check_gn_headers.

To make the code a bit more inclusive ...

Bug: 40713186
Change-Id: I2bac2ddcd56bc1e0de6c4761b53d8f193b8641d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6169387
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1406519}
This commit is contained in:
Dirk Pranke
2025-01-14 21:25:19 -08:00
committed by Chromium LUCI CQ
parent b335e4cce4
commit efbb751fc1
5 changed files with 17 additions and 15 deletions

@ -175,9 +175,10 @@ def IsBuildClean(out_dir):
print(e)
return False
def ParseWhiteList(whitelist):
def ParseAllowlist(allowlist):
out = set()
for line in whitelist.split('\n'):
for line in allowlist.split('\n'):
line = re.sub(r'#.*', '', line).strip()
if line:
out.add(line)
@ -214,8 +215,9 @@ def main():
help='output directory of the build')
parser.add_argument('--json',
help='JSON output filename for missing headers')
parser.add_argument('--whitelist', help='file containing whitelist')
parser.add_argument('--skip-dirty-check', action='store_true',
parser.add_argument('--allowlist', help='file containing allowlist')
parser.add_argument('--skip-dirty-check',
action='store_true',
help='skip checking whether the build is dirty')
parser.add_argument('--verbose', action='store_true',
help='print more diagnostic info')
@ -278,10 +280,10 @@ def main():
if any((('/gen/' in i) for i in nonexisting)):
PrintError('OUT_DIR looks wrong. You should build all there.')
if args.whitelist:
whitelist = ParseWhiteList(open(args.whitelist).read())
missing -= whitelist
nonexisting -= whitelist
if args.allowlist:
allowlist = ParseAllowlist(open(args.allowlist).read())
missing -= allowlist
nonexisting -= allowlist
missing = sorted(missing)
nonexisting = sorted(nonexisting)

@ -1,4 +1,4 @@
# Do not add files to this whitelist unless you are adding a new OS or
# Do not add files to this allowlist unless you are adding a new OS or
# changing the GN arguments on bots.
ash/accelerators/accelerator_table.h

@ -51,7 +51,7 @@ gn_input = json.loads(r'''
''')
whitelist = r'''
allowlist = r'''
white-front.c
a/b/c/white-end.c # comment
dir/white-both.c #more comment
@ -85,8 +85,8 @@ class CheckGnHeadersTest(unittest.TestCase):
])
self.assertEqual(headers, expected)
def testWhitelist(self):
output = check_gn_headers.ParseWhiteList(whitelist)
def testAllowlist(self):
output = check_gn_headers.ParseAllowlist(allowlist)
expected = set([
'white-front.c',
'a/b/c/white-end.c',

@ -9,7 +9,7 @@
".*isolate",
".vpython",
"build/check_gn_headers.py",
"build/check_gn_headers_whitelist.txt",
"build/check_gn_headers_allowlist.txt",
"build/get_landmines.py",
"build/gn_helpers.py",
"build/mac_toolchain.py",

@ -17,8 +17,8 @@ def main_run(args):
os.path.join(common.SRC_DIR, 'build', 'check_gn_headers.py'),
'--out-dir',
args.build_dir,
'--whitelist',
os.path.join(common.SRC_DIR, 'build', 'check_gn_headers_whitelist.txt'),
'--allowlist',
os.path.join(common.SRC_DIR, 'build', 'check_gn_headers_allowlist.txt'),
'--json',
tempfile_path,
'--verbose',