Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve recognition for Apache 1.1 & 2.0 #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/Software/LicenseUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ my @phrases = (
'has dedicated the work to the Commons' => 'CC0_1_0',
'waiving all of his or her rights to the work worldwide under copyright law' => 'CC0_1_0',
'has waived all copyright and related or neighboring rights to' => 'CC0_1_0',
'apache(?: |-)1.1' => "Apache_1_1",
"Apache Software License(\\s)+Version 1.1" => "Apache_1_1",
'apache(?: |-)2.0' => "Apache_2_0",
"Apache License(\\s)+Version 2.0" => "Apache_2_0",
'apache[- ]1.1' => "Apache_1_1",
"Apache Software License[,\\s]+Version 1.1" => "Apache_1_1",
'apache[- ]2.0' => "Apache_2_0",
"Apache License[,\\s]+Version 2.0" => "Apache_2_0",
'No license is granted to other entities' => 'None',
);

Expand Down
31 changes: 31 additions & 0 deletions t/guess_license_from_pod.t
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,18 @@ Version 1.1
Copyright (c) 2000 The Apache Software Foundation. All rights reserved.
LICENSE

# https://www.apache.org/licenses/LICENSE-1.1
# "An example Apache Software License 1.1 file"
my $license_as_example = <<'LICENSE_AS_EXAMPLE';
The Apache Software License, Version 1.1

Copyright (c) 2000 The Apache Software Foundation. All rights
reserved.
LICENSE_AS_EXAMPLE

my @license_strings = (
$license,
$license_as_example,
"apache 1.1", "Apache 1.1", "APACHE 1.1",
"apache-1.1", "Apache-1.1", "APACHE-1.1",
);
Expand All @@ -78,8 +88,29 @@ subtest 'apache_2_0' => sub {
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
LICENSE

# https://www.apache.org/licenses/LICENSE-2.0 suggests:
#
# To apply the Apache License to specific files in your work, attach
# the following boilerplate declaration, ...
my $boilerplate = << 'BOILERPLATE';
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
BOILERPLATE

my @license_strings = (
$license,
$boilerplate,
"apache 2.0", "Apache 2.0", "APACHE 2.0",
"apache-2.0", "Apache-2.0", "APACHE-2.0",
);
Expand Down
Loading