Tools: Use better terminology.
"Allowed" is a perfectly fine, non-biased word for designating things that are allowed. Change-Id: Ia1e0642a073210f0475fba3d437eac654ec36cb5 Reviewed-on: https://code.wireshark.org/review/37397 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
668161f8dd
commit
43b5c63aea
|
@ -196,14 +196,14 @@ sub checkprotoabbrev {
|
|||
|
||||
#now check the acceptable "fields from a different protocol"
|
||||
if ($errorline == 1) {
|
||||
if (is_from_other_protocol_whitelist($_[0], $currfile) == 1) {
|
||||
if (is_from_other_protocol_allowed($_[0], $currfile) == 1) {
|
||||
$errorline = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#now check the acceptable "fields that include a version number"
|
||||
if ($errorline == 1) {
|
||||
if (is_protocol_version_whitelist($_[0], $currfile) == 1) {
|
||||
if (is_protocol_version_allowed($_[0], $currfile) == 1) {
|
||||
$errorline = 0;
|
||||
}
|
||||
}
|
||||
|
@ -219,10 +219,10 @@ sub checkprotoabbrev {
|
|||
}
|
||||
|
||||
if (($abbrev ne "") && (lc($abbrev) eq lc($afterabbrev))) {
|
||||
#Allow ASN.1 generated files to duplicate part of proto name
|
||||
# Allow ASN.1 generated files to duplicate part of proto name
|
||||
if ((!(grep {$currfile eq $_ } @asn1automatedfilelist)) &&
|
||||
#Check "approved" whitelist
|
||||
(is_proto_dup_whitelist($abbrev, $check_dup_abbrev) == 0)) {
|
||||
# Check allowed list
|
||||
(is_proto_dup_allowed($abbrev, $check_dup_abbrev) == 0)) {
|
||||
if ($showlinenoFlag) {
|
||||
push(@elements_dup, "$_[1] $_[0] duplicates PROTOABBREV of $abbrev\n");
|
||||
} else {
|
||||
|
@ -322,7 +322,7 @@ sub printprevfile {
|
|||
# to be provided to add to it. Acknowledge these dissectors aren't
|
||||
# a problem for the pre-commit script
|
||||
#--------------------------------------------------------------------
|
||||
sub is_proto_dup_whitelist {
|
||||
sub is_proto_dup_allowed {
|
||||
if (($_[0] eq "amf") && (index($_[1], "amf0") >= 0)) {return 1;}
|
||||
if (($_[0] eq "amf") && (index($_[1], "amf3") >= 0)) {return 1;}
|
||||
if (($_[0] eq "amqp") && (index($_[1], "amqp") >= 0)) {return 1;}
|
||||
|
@ -364,7 +364,7 @@ sub is_proto_dup_whitelist {
|
|||
# justification will need to be provided to add to it.
|
||||
# Acknowledge these dissectors aren't a problem for the pre-commit script
|
||||
#--------------------------------------------------------------------
|
||||
sub is_from_other_protocol_whitelist {
|
||||
sub is_from_other_protocol_allowed {
|
||||
my $proto_filename;
|
||||
my $dir_index = rindex($_[1], "\\");
|
||||
|
||||
|
@ -446,10 +446,10 @@ sub is_from_other_protocol_whitelist {
|
|||
#--------------------------------------------------------------------
|
||||
# This is a list of dissectors that use their (protocol) version number
|
||||
# as part of the first display filter segment, which checkfiltername
|
||||
# usually complains about. Whitelist them so it can pass
|
||||
# usually complains about. Manually allow them so that they can pass
|
||||
# pre-commit script
|
||||
#--------------------------------------------------------------------
|
||||
sub is_protocol_version_whitelist {
|
||||
sub is_protocol_version_allowed {
|
||||
my $proto_filename;
|
||||
my $dir_index = rindex($_[1], "\\");
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ def PrintUsage():
|
|||
to the script file. This will be correct given the normal location
|
||||
of the script in "<root>/tools".
|
||||
|
||||
--ignore-suppressions Ignores path-specific license whitelist. Useful when
|
||||
trying to remove a suppression/whitelist entry.
|
||||
--ignore-suppressions Ignores path-specific allowed license. Useful when
|
||||
trying to remove a suppression/allowed entry.
|
||||
|
||||
tocheck Specifies the directory, relative to root, to check. This defaults
|
||||
to "." so it checks everything.
|
||||
|
@ -29,7 +29,7 @@ Examples:
|
|||
python checklicenses.py --root ~/chromium/src third_party""")
|
||||
|
||||
|
||||
WHITELISTED_LICENSES = [
|
||||
ALLOWED_LICENSES = [
|
||||
'BSD',
|
||||
'BSD (2 clause)',
|
||||
'BSD (2 clause) GPL (v2 or later)',
|
||||
|
@ -49,7 +49,7 @@ WHITELISTED_LICENSES = [
|
|||
]
|
||||
|
||||
|
||||
PATH_SPECIFIC_WHITELISTED_LICENSES = {
|
||||
PATH_SPECIFIC_ALLOWED_LICENSES = {
|
||||
'caputils/airpcap.h': [
|
||||
'BSD-3-Clause',
|
||||
],
|
||||
|
@ -213,20 +213,20 @@ def check_licenses(options, args):
|
|||
continue
|
||||
|
||||
# Support files which provide a choice between licenses.
|
||||
if any(item in WHITELISTED_LICENSES for item in license.split(';')):
|
||||
if any(item in ALLOWED_LICENSES for item in license.split(';')):
|
||||
continue
|
||||
|
||||
if not options.ignore_suppressions:
|
||||
found_path_specific = False
|
||||
for prefix in PATH_SPECIFIC_WHITELISTED_LICENSES:
|
||||
for prefix in PATH_SPECIFIC_ALLOWED_LICENSES:
|
||||
if (filename.startswith(prefix) and
|
||||
license in PATH_SPECIFIC_WHITELISTED_LICENSES[prefix]):
|
||||
license in PATH_SPECIFIC_ALLOWED_LICENSES[prefix]):
|
||||
found_path_specific = True
|
||||
break
|
||||
if found_path_specific:
|
||||
continue
|
||||
|
||||
reason = "'%s' has non-whitelisted license '%s'" % (filename, license)
|
||||
reason = "License '%s' for '%s' is not allowed." % (license, filename)
|
||||
success = False
|
||||
print(reason)
|
||||
exit_status = 1
|
||||
|
@ -253,7 +253,7 @@ def main():
|
|||
option_parser.add_option('--ignore-suppressions',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Ignore path-specific license whitelist.')
|
||||
help='Ignore path-specific allowed license.')
|
||||
options, args = option_parser.parse_args()
|
||||
return check_licenses(options, args)
|
||||
|
||||
|
|
Loading…
Reference in New Issue