pre-upload: inclusive wording in pre-upload.py and its unittest

This changes a few instances of {black,while}list to more descriptive
and inclusive terms.

BUG=None
TEST=repo upload (runs the unittest)

Change-Id: Iae9042684634dcc477bfb1ca4ee382af21d79644
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/repohooks/+/2446073
Commit-Queue: Bob Haarman <inglorion@chromium.org>
Tested-by: Bob Haarman <inglorion@chromium.org>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 9199299..80abe2c 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -69,7 +69,7 @@
     r'.*\.inl$', r'.*\.asm$', r'.*\.hxx$', r'.*\.hpp$', r'.*\.s$', r'.*\.S$',
     # Scripts
     r'.*\.js$', r'.*\.py$', r'.*\.sh$', r'.*\.rb$', r'.*\.pl$', r'.*\.pm$',
-    # No extension at all, note that ALL CAPS files are black listed in
+    # No extension at all, note that ALL CAPS files are excluded by
     # COMMON_EXCLUDED_LIST below.
     r'(^|.*[\\\/])[^.]+$',
     # Other
@@ -579,7 +579,7 @@
 def _check_no_tabs(_project, commit, options=()):
   """Checks there are no unexpanded tabs."""
   # Don't add entire repos here.  Update the PRESUBMIT.cfg in each repo instead.
-  # We only whitelist known specific filetypes here that show up in all repos.
+  # We only allow known specific filetypes here that show up in all repos.
   TAB_OK_PATHS = [
       r'.*\.ebuild$',
       r'.*\.eclass$',
@@ -1011,10 +1011,10 @@
   # If this is the portage-stable overlay, then ignore the check.  It's rare
   # that we're doing anything other than importing files from upstream, so
   # forcing a rev bump makes no sense.
-  whitelist = (
+  allowlist = (
       'chromiumos/overlays/portage-stable',
   )
-  if project.name in whitelist:
+  if project.name in allowlist:
     return None
 
   def FinalName(obj):
@@ -1028,10 +1028,10 @@
       commit, include_deletes=True, include_symlinks=True, relative=True,
       full_details=True)
 
-  # Don't yell about changes to whitelisted files...
-  whitelist = {'ChangeLog', 'Manifest', 'metadata.xml'}
+  # Don't yell about changes to allowed files...
+  allowlist = {'ChangeLog', 'Manifest', 'metadata.xml'}
   affected_path_objs = [x for x in affected_path_objs
-                        if os.path.basename(FinalName(x)) not in whitelist]
+                        if os.path.basename(FinalName(x)) not in allowlist]
   if not affected_path_objs:
     return None
 
@@ -1117,10 +1117,10 @@
   # If this is the portage-stable overlay, then ignore the check.  It's rare
   # that we're doing anything other than importing files from upstream, and
   # we shouldn't be rewriting things fundamentally anyways.
-  whitelist = (
+  allowlist = (
       'chromiumos/overlays/portage-stable',
   )
-  if project.name in whitelist:
+  if project.name in allowlist:
     return None
 
   BAD_EAPIS = ('0', '1', '2', '3', '4')
@@ -1185,7 +1185,7 @@
   Returns:
     A HookFailure or None.
   """
-  WHITELIST = set(('*', '-*', '~*'))
+  ALLOWLIST = set(('*', '-*', '~*'))
 
   get_keywords = re.compile(r'^\s*KEYWORDS="(.*)"')
 
@@ -1202,7 +1202,7 @@
       m = get_keywords.match(line)
       if m:
         keywords = set(m.group(1).split())
-        if not keywords or WHITELIST - keywords != WHITELIST:
+        if not keywords or ALLOWLIST - keywords != ALLOWLIST:
           continue
 
         bad_ebuilds.append(ebuild)
@@ -1262,10 +1262,10 @@
   """Enforce the virtual PV policies."""
   # If this is the portage-stable overlay, then ignore the check.
   # We want to import virtuals as-is from upstream Gentoo.
-  whitelist = (
+  allowlist = (
       'chromiumos/overlays/portage-stable',
   )
-  if project.name in whitelist:
+  if project.name in allowlist:
     return None
 
   # We assume the repo name is the same as the dir name on disk.
diff --git a/pre-upload_unittest.py b/pre-upload_unittest.py
index ef5db9a..c9addce 100755
--- a/pre-upload_unittest.py
+++ b/pre-upload_unittest.py
@@ -1479,7 +1479,7 @@
         # A modified normal file.
         DiffEntry(src_file='buildbot/constants.py', status='M'),
         # A new symlink file.
-        DiffEntry(dst_file='scripts/cros_env_whitelist', dst_mode='120000',
+        DiffEntry(dst_file='scripts/cros_env_allowlist', dst_mode='120000',
                   status='A'),
         # A deleted file.
         DiffEntry(src_file='scripts/sync_sonic.py', status='D'),
@@ -1643,13 +1643,13 @@
                                       project_top=self.tempdir)
     self.assertTrue(isinstance(ret, errors.HookFailure))
 
-  def testWhitelistOverlay(self):
-    """Skip checks on whitelisted overlays."""
+  def testAllowlistOverlay(self):
+    """Skip checks on allowed overlays."""
     self.assertAccepted([DiffEntry(src_file='cat/pkg/pkg-0.ebuild')],
                         project='chromiumos/overlays/portage-stable')
 
-  def testWhitelistFiles(self):
-    """Skip checks on whitelisted files."""
+  def testAllowlistFiles(self):
+    """Skip checks on allowed files."""
     files = ['ChangeLog', 'Manifest', 'metadata.xml']
     self.assertAccepted([DiffEntry(src_file=os.path.join('c', 'p', x),
                                    status='M')