license-reconcile-0.4/0000755000000000000000000000000012222345167011632 5ustar license-reconcile-0.4/bin/0000755000000000000000000000000012207662275012407 5ustar license-reconcile-0.4/bin/license-reconcile0000755000000000000000000002110712207662275015721 0ustar #!/usr/bin/perl use strict; use warnings; use Getopt::Long; use Pod::Usage; use Debian::LicenseReconcile::App; my $man = 0; my $help = 0; my $quiet = 0; my $display_mapping = 0; my $directory = "."; my @filters = qw(Rules Std Shebang ChangeLog Default~Std); my @filters_override = (); my $config_file = 'debian/license-reconcile.yml'; my $changelog_file = 'debian/changelog'; my $copyright_file = 'debian/copyright'; my $check_copyright = 1; my $format_spec = 1; GetOptions( 'help|?' => \$help, man => \$man, 'copyright-file=s' => \$copyright_file, 'format-spec!' => \$format_spec, 'quiet!' => \$quiet, 'display-mapping!' => \$display_mapping, 'directory=s' => \$directory, 'config-file=s' => \$config_file, 'changelog-file=s' => \$changelog_file, 'check-copyright!' => \$check_copyright, 'filters=s@' => sub { shift; # name of option my $value = shift; if (not grep {$value eq $_} @filters_override) { push @filters_override, $value; } }, ) or pod2usage(2); pod2usage(1) if $help; pod2usage(-exitstatus => 0, -verbose => 2) if $man; if (@filters_override) { @filters = @filters_override; } my $app = Debian::LicenseReconcile::App->new( copyright => $copyright_file, check_copyright => $check_copyright, changelog_file => $changelog_file, format_spec => $format_spec, config_file => $config_file, directory => $directory, quiet => $quiet, display_mapping => $display_mapping, filters => \@filters, format_spec => $format_spec, ); exit($app->run); =head1 NAME license-reconcile - reconcile debian/copyright against source =head1 SYNOPSIS B B<--help>|B<--man> B [B<--copyright-file=>I] [B<--no-check-copyright>] [B<--no-format-spec>] [B<--quiet>] [B<--display-mapping>] [B<--directory=>I] [B<--filters=>I] [B<--config-file=>I] [B<--changelog-file=>I] =head1 DESCRIPTION B attempts to match license and copyright information in a directory with the information available in C. It gets most of its data from C so should produce something worth looking at out of the box. However for a given package it can be configured to succeed in a known good state, so that if on subsequent upstream updates it fails, it points out what needs looking at. By default the tests run are as follows: =over =item - Does the copyright file have an approved format specification as its first line? =item - Can the copyright file be parsed? =item - Does every file in the source match at least one clause in the copyright file? =item - Can every file, license and copyright datum extracted from the source be contained in the corresponding matching paragraph from the copyright file? The data for this comparison comes from a number filter objects. See L for more information. =item - Is every file in the source assigned copyright and a license by some part of the C file. =back =head1 GETTING STARTED =head2 out of the box From the top level of the source directory of Debian packaged software, just run C. =head2 setting a config file Normally to make any progress it will be necessary to have a config file. The default file is C. A different config file can be set with the B<--config-file=>I. The config file is interpreted using L but for the purposes of this documentation# we assume the format is L. =head2 overriding incorrect results Suppose you are really lucky. For just one file, C, the default filters which are wrappers around C, have got it wrong. They have for some reason decided that the file has a GPL-3 license, when inspection shows it is in the public domain. This is causing a false positive break against your carefully crafted C file. You can fix this with the following config fragment: Rules: rules: - Glob: a/b License: public-domain Copyright: 1556, Nostrodamus See L for more information on how to configure this filter. =head2 providing a catch all license and copyright You can make the filters provide a default license, but providing a suitable rule in the Default section of the config file: Default: rules: - License: All software is property of the proletariat license Copyright: 1984, Ministry of Algorithms The Default filter uses exactly the same code as the Rules filter, but by default runs last. So it has all the same functionality but the lowest precedence. =head2 controlling the sequence of filters. By default the filters run are: Rules, Std, Shebang, ChangeLog and Default. You can vary the filters using the B<--filters=>I option. Setting C<--filters Rules> would mean that only the L filter would be used. Once you specify one filter you must specify them all. =head2 filter aliasing The Default filter is an alias for Rules. This means it runs the same code but has a separate config. Default is defined as "Default~Rules". In general "X~Y" means use the code from Y but get the config from X. =head2 writing your own filter. You can write your own filters by inheriting from L. You need to define the C method. =head1 OPTIONS =head2 B<--copyright-file=>I Specify an alternative copyright file. Defaults to C. =head2 B<--no-format-spec> Don't check the first line of the copyright file against permitted format specifications. =head2 B<--no-check-copyright> Don't check the copyright clauses. =head2 B<--quiet> Don't give any explanations, simply a success or a fail via the exit status. =head2 B<--display-mapping> Display mapping from the directory onto the copyright clauses. =head2 B<--directory=>I The directory whose copyright and licenses will be verified. This defaults to ".". =head2 B<--filters=>I B<--filters=>I .... A sequence of filters which will inspect the source package and return license and copyright information. Each module name must sit below the L and inherit from it. The default value is "Rules Std Shebang ChangeLog Default". =head2 B<--config-file=>I A file used to provide filter specific configuration data. The file is read by L and the relevant section is passed to each filter constructor via the C parameter. =head2 <--changelog-file=>I The Debian changelog file which defaults to C. The Rules filter uses this to get the current version and the ChangeLog filter gets its data from it. =head1 Filters By default the filters are processed in the order below. Once a file has been returned by a filter, subsequent filters will ignore it. =over =item - L =item - L =item - L =item - L =item - L =back Each filter constructor will be passed the following parameters: =over =item - directory - the directory from which to find license and copyright data. =item - files_remaining - an array ref of files which have not been analyzed. =item - config - a data structure representing the portion of the config file relevant to this filter. =item - changelog - a L object. =item - licensecheck - a L object. =back =head1 LIMITATIONS The DEP-5 specification is subtly different from the file glob specification. Since the L module is the only practical implementation there is little that can be done. The consequence is that attempting to specify that a file name should contain '[' and later a ']' in C is unlikely to work correctly. In copyright parsing years cannot be expressed in an abbreviated two digit form. This is probably a good thing, but it it will surely cause an issue at some point. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut license-reconcile-0.4/Build.PL0000644000000000000000000000226212222342225013120 0ustar use 5.006; use strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'Debian::LicenseReconcile', license => 'perl', dist_author => q{Nicholas Bamber }, dist_version_from => 'lib/Debian/LicenseReconcile.pm', build_requires => { 'perl' => 5.018, 'Set::IntSpan' => '1.19', 'Test::More' => 0, 'Test::Compile' => 0, 'Test::Deep' => 0, 'Test::Output' => 0, 'Test::NoWarnings' => 0, }, requires => { 'perl' => 5.006, 'Scalar::Util'=>0, 'Class::XSAccessor' => 0, 'Config::Any' => 0, 'Debian::Copyright' => '0.2', 'Dpkg::Version' => 0, 'Parse::DebianChangelog' => 0, 'Email::Address' => 0, 'List::MoreUtils'=>0, 'Readonly'=>0, 'File::Slurp' => 0, 'File::MMagic' => 0, 'File::FnMatch' => 0, 'Set::IntSpan' => 0, 'Text::LevenshteinXS' => 0, 'Smart::Comments' => 0, }, add_to_cleanup => [ 'Debian-LicenseReconcile-*' ], create_makefile_pl => 'traditional', ); $builder->create_build_script(); license-reconcile-0.4/META.yml0000644000000000000000000000107712207662275013115 0ustar --- abstract: 'check format is recognized' author: - 'Nicholas Bamber ' build_requires: Test::Compile: 0 Test::More: 0 configure_requires: Module::Build: 0.4 dynamic_config: 1 generated_by: 'Module::Build version 0.4, CPAN::Meta::Converter version 2.110440' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Debian-LicenseReconcile requires: Debian::Copyright: 0.2 File::Slurp: 0 Tree::RedBlack: 0 perl: 5.006 resources: license: http://dev.perl.org/licenses/ version: 0.01 license-reconcile-0.4/ignore.txt0000644000000000000000000000020512207662275013660 0ustar blib* Makefile Makefile.old Build Build.bat _build* pm_to_blib* *.tar.gz .lwpcookies cover_db pod2htm*.tmp Debian-LicenseReconcile-* license-reconcile-0.4/META.json0000644000000000000000000000177312207662275013270 0ustar { "abstract" : "check format is recognized", "author" : [ "Nicholas Bamber " ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4, CPAN::Meta::Converter version 2.110440", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Debian-LicenseReconcile", "prereqs" : { "build" : { "requires" : { "Test::Compile" : 0, "Test::More" : 0 } }, "configure" : { "requires" : { "Module::Build" : "0.4" } }, "runtime" : { "requires" : { "Debian::Copyright" : "0.2", "File::Slurp" : 0, "Tree::RedBlack" : 0, "perl" : "5.006" } } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ] }, "version" : "0.01" } license-reconcile-0.4/debian/0000755000000000000000000000000012222345167013054 5ustar license-reconcile-0.4/debian/license-reconcile.yml0000644000000000000000000000162712207662275017175 0ustar Rules: rules: - Glob: lib/Debian/LicenseReconcile/Filter/ChangeLog.pm License: Artistic or GPL-1+ CopyrightExtract: (?:=item\s+Copyright\s+\(C\)\s+(\Y+[\w\s]+\s\<\w+\@[\w\.]+\>\s*$\s*))(?:=item\s+Copyright\s+\(C\)\s+(\Y+[\w\s]+\s\<\w+\@[\w\.]+\>\s*$\s*)) - Glob: lib/*.pm License: Artistic or GPL-1+ CopyrightExtract: (?:Copyright\s+(\Y+[\w\s]+C\<\<\s+\<[\s\w\.]+\>)) - Glob: t/data/* Contains: The Regents of the University of California License: BSD-3-clause Copyright: 1992-1993, The Regents of the University of California - Glob: t/data/* Contains: Periapt Technologies License: Artistic or GPL-1+ Copyright: 2012, Nicholas Bamber Justification: Periapt is controlled by Nicholas Bamber ChangeLog: license: Artistic or GPL-1+ Default: rules: - Copyright: Nicholas Bamber License: Artistic or GPL-1+ license-reconcile-0.4/debian/compat0000644000000000000000000000000212207662275014257 0ustar 9 license-reconcile-0.4/debian/license-reconcile.docs0000644000000000000000000000000512207662275017311 0ustar TODO license-reconcile-0.4/debian/changelog0000644000000000000000000000311112222344423014714 0ustar license-reconcile (0.4) unstable; urgency=low * Team upload. * Fix test suite to fix FTBFS (Closes: #724304) + Fix random order issues in t/17-copyright.t, t/18-app.t, and t/20-copyright_extract.t. + Fix t/17-copyright.t for usage with recent libset-intspan-perl, add version to build-dependency. + Adapt t/lib/TestData.pm to Perl 5.18's error messages. * Add test to ensure that all version numbers in the modules are the same as in debian/changelog. * Summarize build-dependencies on Perl as >= 5.18 * Make Changes a pointer to debian/changelog as nobody updated it anyway -- Axel Beckert Mon, 30 Sep 2013 20:55:09 +0200 license-reconcile (0.3) unstable; urgency=low * Team upload. * Debian::LicenseReconcile::Utils: sort returned files. Thanks to Oleg Gashev for the patch. (Closes: #713409) -- gregor herrmann Sat, 10 Aug 2013 15:53:33 +0200 license-reconcile (0.2) unstable; urgency=low * Team upload. [ Salvatore Bonaccorso ] * Change Vcs-Git to canonical URI (git://anonscm.debian.org) * Change search.cpan.org based URIs to metacpan.org based URIs [ gregor herrmann ] * Add explicit (build) dependency on libuniversal-require-perl. It got pulled in during build but not at runtime. Thanks to Michael Prokop for the bug report. (Closes: #703496) -- gregor herrmann Wed, 20 Mar 2013 18:21:27 +0100 license-reconcile (0.1) unstable; urgency=low * Initial Release (Closes: #686485). -- Nicholas Bamber Sun, 30 Dec 2012 19:18:52 +0000 license-reconcile-0.4/debian/copyright0000644000000000000000000000627212211134472015007 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Debian-LicenseReconcile Source: https://metacpan.org/release/Debian-LicenseReconcile/ Upstream-Contact: Nicholas Bamber Files: * Copyright: 2012, Nicholas Bamber License: Artistic or GPL-1+ Files: lib/Debian/LicenseReconcile/Filter/ChangeLog.pm Copyright: 2007-2010, Damyan Ivanov 2011-2012, Nicholas Bamber License: Artistic or GPL-1+ Files: t/data/rltty.c License: GPL-2+ Copyright: 1992-2005, Free Software Foundation, Inc Files: t/data/nolicense.c t/data/tty.c License: BSD-3-clause Copyright: 1992-1993, The Regents of the University of California. License: Artistic This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl. . On Debian systems, the complete text of the Artistic License can be found in `/usr/share/common-licenses/Artistic'. License: GPL-1+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. . On Debian systems, the complete text of version 1 of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-1'. License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. . On Debian systems, the complete text of version 2 of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-2'. License: BSD-3-clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. . THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. license-reconcile-0.4/debian/license-reconcile.examples0000644000000000000000000000001312207662275020176 0ustar examples/* license-reconcile-0.4/debian/control0000644000000000000000000000537512222342565014470 0ustar Source: license-reconcile Maintainer: Debian Perl Group Uploaders: Nicholas Bamber Section: devel Priority: optional Build-Depends: debhelper (>= 9), perl (>= 5.18) Build-Depends-Indep: devscripts, libclass-xsaccessor-perl, libconfig-any-perl, libdebian-copyright-perl (>= 0.2), libdpkg-perl, libemail-address-perl, libfile-fnmatch-perl, libfile-mmagic-perl, libfile-slurp-perl, liblist-moreutils-perl, libparse-debianchangelog-perl, libreadonly-perl, libreadonly-xs-perl, libset-intspan-perl (>= 1.19), libsmart-comments-perl, libtest-compile-perl, libtest-deep-perl, libtest-exception-perl, libtest-nowarnings-perl, libtest-output-perl, libtext-levenshteinxs-perl, libuniversal-require-perl, libyaml-libyaml-perl Standards-Version: 3.9.4 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-perl/packages/license-reconcile.git Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/license-reconcile.git Package: license-reconcile Architecture: all Depends: ${misc:Depends}, ${perl:Depends}, devscripts, libclass-xsaccessor-perl, libconfig-any-perl, libdebian-copyright-perl (>= 0.2), libdpkg-perl, libemail-address-perl, libfile-fnmatch-perl, libfile-mmagic-perl, libfile-slurp-perl, liblist-moreutils-perl, libparse-debianchangelog-perl, libreadonly-perl, libreadonly-xs-perl, libset-intspan-perl, libsmart-comments-perl, libtext-levenshteinxs-perl, libuniversal-require-perl Recommends: libyaml-libyaml-perl Description: tool to reconcile copyright file and source Out of the box the license-reconcile tool compares licensecheck output and the debian/changelog file against the debian/copyright file. However the power of the tool is that the behaviour can be overridden and complemented by rules. Rules include the ability to file match, to match against licensecheck output and to extract copyright years. The rules can be defined in a file and should need to be changed less often than the debian/copyright file itself. If necessary copyright and license data can be extracted from the source code in more specialized ways by adding Perl modules below Debian::LicenseReconcile::Filter. license-reconcile-0.4/debian/source/0000755000000000000000000000000012207662275014361 5ustar license-reconcile-0.4/debian/source/format0000644000000000000000000000001512207662275015570 0ustar 3.0 (native) license-reconcile-0.4/debian/rules0000755000000000000000000000003612207662275014140 0ustar #!/usr/bin/make -f %: dh $@ license-reconcile-0.4/Changes0000644000000000000000000000003412222342725013117 0ustar Please see debian/changelog license-reconcile-0.4/MANIFEST0000644000000000000000000000024612207662275012772 0ustar Build.PL Changes lib/Debian/LicenseReconcile.pm MANIFEST This list of files README t/00-load.t t/manifest.t t/pod-coverage.t t/pod.t Makefile.PL META.yml META.json license-reconcile-0.4/lib/0000755000000000000000000000000012207662275012405 5ustar license-reconcile-0.4/lib/Debian/0000755000000000000000000000000012222342225013552 5ustar license-reconcile-0.4/lib/Debian/LicenseReconcile.pm0000644000000000000000000000454712222342225017330 0ustar package Debian::LicenseReconcile; use 5.006; use strict; use warnings; use Debian::LicenseReconcile::Errors; sub new { my $class = shift; my $patterns = shift; my $self = $patterns; bless $self, $class; return $self; } sub check { my $self = shift; my $subject = shift; my $target = shift; my $copyright = shift; my $pattern = $target->{pattern}; my $license = $subject->{license}; if ($subject->{license}) { my $target_license = $self->{$pattern}->{license}; if ($subject->{license} ne $target_license) { my $msg = "File $subject->{file} has license $subject->{license} which does not match $target_license."; Debian::LicenseReconcile::Errors->push( test => 'License mismatch', msg => $msg, ); } } if ($subject->{copyright} and $copyright) { my $target_copyright = $self->{$pattern}->{copyright}; my $msg = ""; if (not $target_copyright->contains($subject->{copyright}, \$msg)) { Debian::LicenseReconcile::Errors->push( test => 'Copyright mismatch', msg => "File $subject->{file}: $msg", ); } } return; } =head1 NAME Debian::LicenseReconcile - compare actual and required copyright and license =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile; my $reconcile = Debian::LicenseReconcile->new(); $reconcile->check($actual, $required); =head1 SUBROUTINES/METHODS =head2 new A constructor with no flexibility needed. =head2 check This method takes two arguments, firstly a hash obtained from the source code under inspection and the second from the copyright file. Currently only the C field is checked. This field from the first hash must exactly match the first line of the license field from the second. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile license-reconcile-0.4/lib/Debian/LicenseReconcile/0000755000000000000000000000000012222342225016760 5ustar license-reconcile-0.4/lib/Debian/LicenseReconcile/Filter.pm0000644000000000000000000001174412222342225020552 0ustar package Debian::LicenseReconcile::Filter; use 5.006; use strict; use warnings; use Class::XSAccessor constructor => 'new', getters => { directory => 'directory', files_remaining => 'files_remaining', changelog => 'changelog', config => 'config', licensecheck => 'licensecheck', name=>'name', }, ; use Readonly; use File::Slurp; use File::FnMatch qw(:fnmatch); use File::MMagic; use Dpkg::Version; Readonly my $MMAGIC => File::MMagic->new('/etc/magic'); sub get_info { my $self = shift; die "not implemented in base class"; } sub _fnmatch_split { my $glob = shift; my $file = shift; foreach my $s (split ' ', $glob) { return 1 if fnmatch($s, $file); } return 0; } sub find_rule { my $self = shift; my $file = shift; my $rules = shift; my $matching_rule = undef; my $contents = undef; my $this_version = undef; foreach my $rule (@$rules) { # Run through the test clauses if (exists $rule->{Glob}) { next if not _fnmatch_split($rule->{Glob}, $file); } if (exists $rule->{MaxVersion}) { if (not $this_version) { $this_version = Dpkg::Version->new($self->changelog->data->[0]->Version); } my $max_version = Dpkg::Version->new($rule->{MaxVersion}); next if $this_version > $max_version; } if (exists $rule->{VerifyLicense}) { my $license = $self->licensecheck->raw_license($file); next if -1 == index $license, $rule->{VerifyLicense}; } if (exists $rule->{MMagic} or exists $rule->{Contains} or exists $rule->{Matches}) { if (not $contents) { $contents = read_file($self->directory."/$file"); } if (exists $rule->{MMagic}) { next if length $contents == 0; # don't apply magic to degenerates next if $rule->{MMagic} ne $MMAGIC->checktype_contents($contents); } if (exists $rule->{Contains}) { next if -1 == index $contents, $rule->{Contains}; } if (exists $rule->{Matches}) { next if $contents !~ qr/$rule->{Matches}/xms; } } # Now we've found a matching rule $matching_rule = $rule; return $rule; } return; } =head1 NAME Debian::LicenseReconcile::Filter - abstract interface to license info =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::Filter; my $filter = Debian::LicenseReconcile::Filter->new(arg1=>"blah",...); my @info = $filter->get_info(@files); =head1 SUBROUTINES/METHODS =head2 new This constructor takes key value pairs and returns the correspondingly blessed object. =head2 get_info Returns a list of hash references describing copyright and license information that should be checked against the copyright target. =head2 directory Returns the search directory as set in the constructor. =head2 files_remaining Returns the files to be checked as set in the constructor. =head2 changelog Returns the L as set in the constructor. =head2 config Returns the config data as set in the constructor. =head2 licensecheck Returns the L object as set in the constructor. =head2 name Returns the name set in the constructor. =head2 find_rule This is a helper method designed to allow derived classes implement rules based semantics. It takes a file name and an array ref to a sequence of rules. Each rule is a hash ref, which may contain the following fields: =over =item - Glob (optional) - a file glob to limit which files the rule applies to. =item - Contains (optional) - a piece of text which the file must contain for the rule to apply. =item - Matches (optional) - an extended regular expression which the file contents must match for the rule to apply. =item - MMagic (optional) - a string which must equal the magic value obtained from L for the rule to apply. =item - MaxVersion (optional) - an upstream version string after which the rule will not be applied. This is recommended unless you are certain that the rule is robust so that the rule will be regularly reviewed. =item - VerifyLicense (optional) - a string which must be present in the license portion of L output. =back The first rule which matches the file is returned. If no rule matches then undef is returned. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile::FormatSpec license-reconcile-0.4/lib/Debian/LicenseReconcile/Errors.pm0000644000000000000000000000273712222342225020603 0ustar package Debian::LicenseReconcile::Errors; use 5.006; use strict; use warnings; my @errors = (); sub push { shift; # class method; my %info = @_; push @errors, \%info; return; } sub how_many { shift; # class method; return scalar @errors; } sub list { shift; # class method; return @errors; } =head1 NAME Debian::LicenseReconcile::Errors - list of license reconciliation errors =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::Errors; Debian::LicenseReconcile::Errors->push(short=>'Format',long=>.....); foreach my $error (Debian::LicenseReconcile::Errors->list) { print Dump($error); } exit(Debian::LicenseReconcile::Errors->how_many()); =head1 DESCRIPTION This module represents somewhere to store errors so that they can be displayed later. =head1 SUBROUTINES/METHODS =head2 push This method takes a set of key value pairs, and pushes them onto the list of errors. =head2 how_many =head2 list =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile license-reconcile-0.4/lib/Debian/LicenseReconcile/LicenseCheck.pm0000644000000000000000000001602512222342225021642 0ustar package Debian::LicenseReconcile::LicenseCheck; use 5.006; use strict; use warnings; use Readonly; use File::Slurp; use Smart::Comments -ENV; Readonly my $YEAR_RE => '(?:\d{4}(?:\s|,\s|\-))'; Readonly my $SQBR_RE => qr{ \A \[ ([^]]*) \] \z }xms; Readonly my $SEP_RE => qr{ \s+ / \s+ }xms; Readonly my %LICENSE_MAPPING => ( 'Apache (v2.0)' => 'Apache-2.0', 'GPL' => 'GPL-2', 'GPL-2' => 'GPL-2', 'GPL (v2)' => 'GPL-2', 'GPL (v2 or later)' => 'GPL-2+', 'LGPL (v2)' => 'LGPL', 'zlib/libpng' => 'zlib/libpng', 'BSD (4 clause)' => 'BSD-4-clause', 'BSD (2 clause)' => 'BSD-2-clause', 'BSD (3 clause)' => 'BSD-3-clause', ); Readonly my $SCRIPT => '/usr/bin/licensecheck --no-conf'; Readonly my $PARSE_RE => qr{ ^ # beginning of line ([^\n:]+) # file name :\s+ # separator ([^\n]+) # license \s* # just in case $ # end of line \s* # just in case ([^\n]+)? # copyright notice \s* # just in case $ # end of line \s* # just in case }xms; sub new { my $class = shift; my $self = { mapping=>{}, raw=>{}, }; $self->{directory} = shift; my $mapping = shift || []; $self->{check_copyright} = shift; %{$self->{mapping}} = (%LICENSE_MAPPING, @$mapping); bless $self, $class; $self->_get_raw_data; return $self; } sub get_info { my $self = shift; my $subject = shift; my $copyright_extract = shift; my @files = $subject ? ($subject) : keys %{$self->{raw}}; my @results; foreach my $file (@files) { if (not exists $self->{raw}->{$file}) { $self->_get_raw_data($file); } my $license = $self->{raw}->{$file}->{license}; my $copyright = $self->{raw}->{$file}->{copyright}; my $addresult = 0; my $result = { file => $file }; ### assert: $license $license = $self->_cleanup_license($license); if ($license) { $addresult = 1; $result->{license} = $license; } if ($self->{check_copyright}) { my $found_copyright = 0; if ($copyright_extract and my @lines = $self->_extract_copyright($file, $copyright_extract)) { $result->{copyright} = \@lines; $addresult = 1; $found_copyright = 1; } if ($copyright and not $found_copyright) { $copyright =~ $SQBR_RE; $copyright = $1; if ($copyright) { $addresult = 1; my @lines = split $SEP_RE, $copyright; $result->{copyright} = \@lines; } } } next if not $addresult; push @results, $result; } return @results; } sub _extract_copyright { my $self = shift; my $file = shift; my $copyright_extract = shift; $copyright_extract =~ s{\\Y}{$YEAR_RE}xmsg; my $contents = read_file "$self->{directory}/$file"; my @lines = ($contents =~ m{$copyright_extract}xms); my @results; foreach my $line (@lines) { next if not $line; $line =~ s{\s*\R+\s*}{ }xmsg; push @results, $line; } return @results; } sub _get_raw_data { my $self = shift; my $subject = shift; if (defined $subject) { $subject = "$self->{directory}/$subject"; } else { $subject = $self->{directory}; } my $commands = $SCRIPT; if ($self->{check_copyright}) { $commands .= ' --copyright'; } if (-d $subject) { $commands .= ' --recursive'; } $commands .= " $subject" ; my $output = `$commands`; while ($output =~ /$PARSE_RE/g) { my $file = substr($1, 1+length $self->{directory}); $self->{raw}->{$file} = { license => $2, copyright => $3, }; } return; } sub _cleanup_license { my $self = shift; my $license = shift; $license =~ s{\*No\s+copyright\*}{}xms; $license =~ s{GENERATED\s+FILE}{}xms; $license =~ s{^\s+}{}xms; $license =~ s{\s+$}{}xms; $license =~ s{\s+\(with\s+incorrect\s+FSF\s+address\)}{}xms; return $self->{mapping}->{$license} if exists $self->{mapping}->{$license}; return if $license eq 'UNKNOWN'; return $license; } sub raw_license { my $self = shift; my $file = shift; ### assert: $file and -f $file; return $self->{raw}->{$file}->{license} if exists $self->{raw}->{$file}; $self->_get_raw_data($file); ### assert: exists $self->{raw}->{$file}->{license} return $self->{raw}->{$file}->{license}; } =head1 NAME Debian::LicenseReconcile::LicenseCheck - wrapper around licensecheck =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::LicenseCheck; my $filter = Debian::LicenseReconcile::LicenseCheck->new(directory=>'.'); my @info = $filter->get_info(); =head1 DESCRIPTION This module is designed to provide an interface to the licensecheck program suitable for use in L objects. =head1 SUBROUTINES/METHODS =head2 new The constructor takes the base directory as an argument. Any other arguments are interpreted as key/value pairs mapping the license statements generated by licensecheck onto those used in C. =head2 get_info Returns a list of hash references describing copyright and license information that should be checked against the copyright target. If no additional argument is passed, the results returned from this filter are those that are obtained from C. The optional file argument must be relative to the directory given to the constructor. If the file is a directory then the C<--recursive> option is used. Optionally this method may take an additional regular expression format string argument. If present this regular expression will be used to extract copyright data from the file contents in preference to what licensecheck returns. If the regular expression fails to match, licensecheck data will be used instead. The regular expression should have a capture for each line. A capture may span lines and the regular expression will be enclosed in C. =head2 raw_license Given a file this method returns the license data produced from C. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile::FormatSpec license-reconcile-0.4/lib/Debian/LicenseReconcile/Filter/0000755000000000000000000000000012222342225020205 5ustar license-reconcile-0.4/lib/Debian/LicenseReconcile/Filter/Shebang.pm0000644000000000000000000000535512222342225022122 0ustar package Debian::LicenseReconcile::Filter::Shebang; use 5.006; use strict; use warnings; use base qw(Debian::LicenseReconcile::Filter); sub get_info { my $self = shift; my @results; # set up default rules that give the class its name. my $rules = ref $self->config eq 'HASH' ? $self->config->{rules} : [{ Matches=>'\A\#\!'}]; foreach my $file (@{$self->files_remaining}) { my $rule = $self->find_rule($file, $rules); next if not $rule; my @tmp = $self->licensecheck->get_info($file); if (@tmp) { $tmp[0]->{test} = $self->name; push @results, $tmp[0]; } } return @results; } =head1 NAME Debian::LicenseReconcile::Filter::Shebang - applies licensecheck to probable scripts =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::Filter::Shebang; my $filter = Debian::LicenseReconcile::Filter::Rules->new( files_remaining=>[....], ); my @info = $filter->get_info(); =head1 SUBROUTINES/METHODS =head2 get_info Returns a list of hash references describing copyright and license information that should be checked against the copyright target. The results returned are those obtained by applying the rules in the config file in sequence and applying licensecheck to any file that matches one of the rules. Each rule might have the following fields: =over =item - Glob (optional) - a file glob to limit which files the rule applies to. =item - Contains (optional) - a piece of text which the file must contain for the rule to apply. =item - Matches (optional) - an extended regular expression which the file contents must match for the rule to apply. =item - MMagic (optional) - a string which must equal the magic value obtained from L for the rule to apply. =item - MaxVersion (optional) - an upstream version string after which the rule will not be applied. This is recommended unless you are certain that the rule is robust so that the rule will be regularly reviewed. =back The default rules are to check any file starting with '#!', hence the name. Normal recursive use of licensecheck might not find these files as it might not have one of the file extensions that licensecheck looks for. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile::FormatSpec license-reconcile-0.4/lib/Debian/LicenseReconcile/Filter/Rules.pm0000644000000000000000000000664612222342225021651 0ustar package Debian::LicenseReconcile::Filter::Rules; use 5.006; use strict; use warnings; use base qw(Debian::LicenseReconcile::Filter); sub get_info { my $self = shift; my @results; foreach my $file (@{$self->files_remaining}) { my $rule = $self->find_rule($file, $self->config->{rules}); next if not $rule; my $result = { file=>$file, test=>$self->name, }; my @info; if (not ($rule->{License} and $rule->{Copyright})) { push @info, $self->licensecheck->get_info($file, $rule->{CopyrightExtract}); } $result->{license} = $rule->{License} ? $rule->{License} : $info[0]->{license}; $result->{copyright} = $rule->{Copyright} ? $rule->{Copyright} : $info[0]->{copyright}; if (exists $rule->{CopyrightClean}) { $result->{copyright} = _clean_copyright( $result->{copyright}, $rule->{CopyrightClean}, ); } push @results, $result; } return @results; } sub _clean_copyright { my $copyright = shift; my $clean_re = shift; if (ref $copyright eq 'ARRAY') { foreach my $a (0..$#$copyright) { $copyright->[$a] =~ s{$clean_re}{ }xms; } } elsif ($copyright) { $copyright =~ s{$clean_re}{ }xms; } return $copyright; } =head1 NAME Debian::LicenseReconcile::Filter::Rules - applies licensecheck to get data =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::Filter::Rules; my $filter = Debian::LicenseReconcile::Filter::Rules->new( directory=>'.', files_remaining=>[....], config=>[....], ); my @info = $filter->get_info(); =head1 SUBROUTINES/METHODS =head2 get_info Returns a list of hash references describing copyright and license information that should be checked against the copyright target. The results returned are those obtained by applying the rules in the config file in sequence. Each rule might have the fields as discussed in L. In addition the following fields are supported: =over =item License (optional) - Specifies the exact license value. If not set the license will be obtained from L. =item Copyright (optional) - Specifies the exact copyright value. If not set the copyright will be obtained from L. =item CopyrightExtract (optional) - Gives a regular expression that is used to get copyright data from the file contents. Each captured value will be a line assumed to contain a sequence of years and the copyright holder. The regular expression will be enclosed in C. Also it supports an additional shorthand C<\Y> which represents a year followed by various separators. =item CopyrightClean (optional) - Gives a regular exprression that is replaced in the copyright string by a single space. =back =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile::FormatSpec license-reconcile-0.4/lib/Debian/LicenseReconcile/Filter/ChangeLog.pm0000644000000000000000000001121612222342225022373 0ustar package Debian::LicenseReconcile::Filter::ChangeLog; use 5.006; use strict; use warnings; use base qw(Debian::LicenseReconcile::Filter); use Readonly; Readonly my $ACTUAL_NAME_RE => '\pL[\s\pL\-\'\.]*\pL'; # See http://www.faqs.org/rfcs/rfc2822.html # Section 3.4.1 use Email::Address; Readonly my $EMAIL_RE => $Email::Address::addr_spec; Readonly my $EMAIL_CHANGES_RE => qr{ ^ # beginining of line \s+\*\s # item marker Email\schange:\s # email change token ($ACTUAL_NAME_RE) # actual name \s+->\s+ # gap between name and email ($EMAIL_RE) # email address $ # end of line }xms; Readonly my $PERSON_PARSE_RE => qr{ \A # beginining of string ($ACTUAL_NAME_RE) # actual name \s # gap \<$EMAIL_RE\> # logged email \z # end of string }xms; sub get_info { my $self = shift; my $license = $self->config->{license} || 'GPL-2+'; my %maintainers = (); my %email_changes = (); foreach ( $self->changelog->data() ) { my $person = $_->Maintainer; my $date = $_->Date; my @date_pieces = split( " ", $date ); my $year = $date_pieces[3]; if (my %changes = ($_->Changes =~ m/$EMAIL_CHANGES_RE/xmsg)) { # This way round since we are going backward in time thru changelog foreach my $p (keys %changes) { $changes{$p} =~ s{[\s\n]+$}{}xms; } %email_changes = ( %changes, %email_changes ); } if (my ($name) = ($person =~ $PERSON_PARSE_RE)) { if (exists $email_changes{$name}) { $person = "$name <$email_changes{$name}>"; } } if ( defined( $maintainers{$person} ) ) { push @{ $maintainers{$person} }, $year; @{ $maintainers{$person} } = sort( @{ $maintainers{$person} } ); } else { @{ $maintainers{$person} } = ($year); } } my @strings; foreach my $maint_name ( keys %maintainers ) { my $str = " "; my %uniq = map { $_ => 0 } @{ $maintainers{$maint_name} }; foreach ( sort keys %uniq ) { $str .= $_; $str .= ", "; } $str .= $maint_name; push @strings, $str; } @strings = sort @strings; my @results; foreach my $file (@{$self->files_remaining}) { next if not $file =~ m{\Adebian/}xms; push @results, { test=>$self->name, file=>$file, license=>$license, copyright=>\@strings, }; } return @results; } =head1 NAME Debian::LicenseReconcile::Filter::ChangeLog - parses changelog =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::Filter::ChangeLog; my $filter = Debian::LicenseReconcile::Filter::ChangeLog->new( directory=>'.', changelog=>$CHANGELOG, ); my @info = $filter->get_info(); =head1 SUBROUTINES/METHODS =head2 get_info Returns a list of hash references describing copyright and license information that should be checked against the copyright target. The results returned from this filter consist of blocks whose copyright holders and years are taken from the changelog. One block is generated for every file with unassigned copyright below the debian directory. The license string is taken from the license field of the filter config but defaults to 'GPL-2+'. Also the code will look for changelog lines of the form: Email change: Nicholas Bamber -> periapt@debian.org The purpose of this is that if a maintainer's email address has changed over the course of the history of the package only the email address specified in that directive will be used. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT This file draws heavily upon the L module. Inspection of the history of that file suggests that appropriate copyright declaration is: =over 4 =item Copyright (C) 2007-2010 Damyan Ivanov =item Copyright (C) 2011-2012, Nicholas Bamber =back This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile::FormatSpec license-reconcile-0.4/lib/Debian/LicenseReconcile/Filter/Std.pm0000644000000000000000000000262412222342225021301 0ustar package Debian::LicenseReconcile::Filter::Std; use 5.006; use strict; use warnings; use base qw(Debian::LicenseReconcile::Filter); use Readonly; sub get_info { my $self = shift; return map { $_->{test} = $self->name; $_ } $self->licensecheck->get_info; } =head1 NAME Debian::LicenseReconcile::Filter::Std - applies licensecheck to get data =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::Filter::Std; my $filter = Debian::LicenseReconcile::Filter::Std->new( directory=>'.', licensecheck=>$LICENSECHECK, ); my @info = $filter->get_info(); =head1 SUBROUTINES/METHODS =head2 get_info Returns a list of hash references describing copyright and license information that should be checked against the copyright target. The results returned from this filter are those that are obtained from C. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile::FormatSpec license-reconcile-0.4/lib/Debian/LicenseReconcile/CopyrightDatum/0000755000000000000000000000000012222342225021723 5ustar license-reconcile-0.4/lib/Debian/LicenseReconcile/CopyrightDatum/Holder.pm0000644000000000000000000000451512222342225023503 0ustar package Debian::LicenseReconcile::CopyrightDatum::Holder; use 5.006; use strict; use warnings; use Text::LevenshteinXS qw(distance); use Class::XSAccessor setters=>{ _set_width=>'width', }, getters=>{ ours=>'ours', theirs=>'theirs', width=>'width', }; sub new { my $class = shift; my %args = @_; my $self = bless \%args, ref($class)||$class; $self->_set_width(distance($self->theirs, $self->ours)); return $self; } sub _my_cmp { my $a = shift; my $b = shift; return $a->width <=> $b->width; } sub _my_str { my $self = shift; return "[".$self->ours.",".$self->theirs.",".$self->width."]"; } sub touches { my $self = shift; my $other = shift; return 1 if $self->ours eq $other->ours; return 1 if $self->theirs eq $other->theirs; return 0; } sub is_ambiguous { my $self = shift; my $like_subject = shift; return 0 if scalar @$like_subject <= 1; return $self->width==$like_subject->[1]->width; } sub relative_width { my $self = shift; return 2.0*($self->width)/((length $self->ours) + (length $self->theirs)); } use overload '<=>' => \&_my_cmp, '""' => \&_my_str; =head1 NAME Debian::LicenseReconcile::CopyrightDatum::Holder - encapsulate pair =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::CopyrightDatum::Holder; my $holder = Debian::LicenseReconcile::CopyrightDatum::Holder->new( theirs=>'AA', ours=>'BA', ); if ($holder > $holder2) { ... } =head1 DESCRIPTION We want to be able to quickly find the two texts that are closest to each other. So these objects have C, C and C fields. The comparison just compares by the distance field. =head1 SUBROUTINES/METHODS =head2 new =head2 width =head2 ours =head2 theirs =head2 touches =head2 is_ambiguous =head2 relative_width =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile license-reconcile-0.4/lib/Debian/LicenseReconcile/App.pm0000644000000000000000000001530512222342225020042 0ustar package Debian::LicenseReconcile::App; use 5.006; use strict; use warnings; use Class::XSAccessor constructor => 'new', getters => { quiet => 'quiet', display_mapping => 'display_mapping', changelog_file => 'changelog_file', config_file => 'config_file', copyright => 'copyright', check_copyright => 'check_copyright', directory =>'directory', filters => 'filters', format_spec => 'format_spec', }, ; use File::Slurp; use Readonly; use Debian::LicenseReconcile::Errors; use Debian::LicenseReconcile::FormatSpec; use Debian::LicenseReconcile::CopyrightTarget; use Debian::LicenseReconcile::LicenseCheck; use Debian::LicenseReconcile; use Parse::DebianChangelog; use UNIVERSAL::require; use Config::Any; sub _read_copyright_file { my $self = shift; my $copyright_text = scalar read_file($self->copyright); if ($self->format_spec) { Debian::LicenseReconcile::FormatSpec->check($copyright_text); } my $copyright_target = Debian::LicenseReconcile::CopyrightTarget->new; if ($copyright_target->parse($copyright_text)) { return $copyright_target; } return; } sub _parse_changelog { my $self = shift; return Parse::DebianChangelog->init( { infile=>$self->changelog_file } ); } sub _parse_config { my $self = shift; my $config = Config::Any->load_files({ files=>[$self->config_file], use_ext=>1, flatten_to_hash=>1, })->{$self->config_file}; if (not defined $config) { $config = {}; } if (not exists $config->{licensecheck}) { $config->{licensecheck} = {}; } if ($self->filters) { foreach my $key (@{$self->filters}) { if (not exists $config->{$key}) { $config->{$key}={rules=>[]}; } } } foreach my $key (keys %$config) { next if $key eq 'licensecheck'; next if ref $config->{$key} ne 'HASH'; next if exists $config->{$key}->{rules}; $config->{$key}->{rules}=[]; } return $config; } sub _build_licensecheck { my $self = shift; my $config = shift; return Debian::LicenseReconcile::LicenseCheck->new( $self->directory, $config->{LicenseCheck}, $self->check_copyright, ); } sub _build_file_mapping { my $self = shift; my $copyright_target = shift; my $file_mapping = $copyright_target->map_directory($self->directory); if ($self->display_mapping) { foreach my $file (sort keys %$file_mapping) { print "$file: $file_mapping->{$file}->{pattern}\n"; } } return $file_mapping; } sub run { my $self = shift; Readonly my $CHANGELOG => $self->_parse_changelog; Readonly my $CONFIG => $self->_parse_config; Readonly my $LICENSECHECK => $self->_build_licensecheck($CONFIG); Readonly my $COPYRIGHT_TARGET => $self->_read_copyright_file; if ($COPYRIGHT_TARGET) { Readonly my $FILE_MAPPING => $self->_build_file_mapping($COPYRIGHT_TARGET); Readonly my $RECONCILE => Debian::LicenseReconcile->new( $COPYRIGHT_TARGET->patterns($self->check_copyright) ); my $file_checked = {}; foreach my $filter_name (@{$self->filters}) { $file_checked = $self->_run_filter( $filter_name, $file_checked, $CONFIG, $CHANGELOG, $LICENSECHECK, $FILE_MAPPING, $RECONCILE ); } } return $self->_report_errors; } sub _run_filter { my $self = shift; my $filter_name = shift; my $file_checked = shift; my $config = shift; my $changelog = shift; my $licensecheck = shift; my $file_mapping = shift; my $reconcile = shift; my $class; ($class, $filter_name) = _parse_filter_name($filter_name); $class->require; my @files_remaining = grep {not exists $file_checked->{$_}} keys %$file_mapping; my $our_config = {rules=>[]}; if (exists $config->{$filter_name}->{rules} and ref $config->{$filter_name}->{rules} eq 'ARRAY') { $our_config = $config->{$filter_name}; } my $test = $class->new( directory=>$self->directory, files_remaining=>\@files_remaining, config=>$our_config, changelog=>$changelog, licensecheck=>$licensecheck, name=>$filter_name, ); foreach my $titbit ($test->get_info) { next if $file_checked->{$titbit->{file}}; $file_checked->{$titbit->{file}} = 1; if (exists $file_mapping->{$titbit->{file}}) { $reconcile->check( $titbit, $file_mapping->{$titbit->{file}}, $self->check_copyright, ); } else { Debian::LicenseReconcile::Errors->push( test => 'File mismatch', msg => "Filter $filter_name found $titbit->{file} which was not in the file mapping. This probably implies a bug in the filter.", ); } } return $file_checked; } sub _report_errors { my $self = shift; if (not $self->quiet) { foreach my $error (Debian::LicenseReconcile::Errors->list) { warn "$error->{test}: $error->{msg}"; } } return Debian::LicenseReconcile::Errors->how_many > 0 ? 1 : 0; } sub _parse_filter_name { my $filter_name = shift; my $class = "Debian::LicenseReconcile::Filter::"; if ($filter_name =~ m{\A(\w+)~(\w+)\z}xms) { $class .= $2; $filter_name = $1; } else { $class .= $filter_name; } return $class, $filter_name; } =head1 NAME Debian::LicenseReconcile::App - encapsulate the application code =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::App; my $app = Debian::LicenseReconcile::App->new(...); exit($app->run); =head1 SUBROUTINES/METHODS =head2 new This constructor takes key value pairs and returns the correspondingly blessed object. =head2 run =head2 quiet =head2 display_mapping =head2 changelog_file =head2 config_file =head2 copyright =head2 check_copyright =head2 directory =head2 filters =head2 format_spec =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile::FormatSpec license-reconcile-0.4/lib/Debian/LicenseReconcile/Utils.pm0000644000000000000000000000245012222342225020417 0ustar package Debian::LicenseReconcile::Utils; use 5.006; use strict; use warnings; use base qw(Exporter); use File::Find; our @EXPORT_OK = qw(get_files); sub get_files { my $directory = shift; my @files = (); find(sub { return if $File::Find::name =~ m{\A\.git}; return if $File::Find::name =~ m{\A\.pc}; push @files, substr($File::Find::name,length($directory)+1) if ! -d $_; }, $directory); return sort @files; } =head1 NAME Debian::LicenseReconcile::Utils - various just about describable utilities =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::Utils qw(get_files); my @files = get_files($directory); =head1 SUBROUTINES/METHODS =head2 get_files Takes a directory and returns a list of all the files in that directory and below. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile license-reconcile-0.4/lib/Debian/LicenseReconcile/CopyrightDatum.pm0000644000000000000000000002062312222342225022264 0ustar package Debian::LicenseReconcile::CopyrightDatum; use 5.006; use strict; use warnings; use Scalar::Util qw(blessed); use Readonly; use Set::IntSpan; use Debian::LicenseReconcile::CopyrightDatum::Holder; use Debian::LicenseReconcile::Errors; use List::MoreUtils qw(part); use Smart::Comments -ENV; Readonly my $NL_RE => qr{ \s* $ \s* }xms; Readonly my $FILLER_RE => '[\-,\s\(\)]'; # We regard each line as a Set::IntSpan run list followed by free text. Readonly my $LINE_RE => qr{ \A # start of string (?: Copyright (?:\s+\([cC]\)\s*?)? [:\s] )? # Copyright string $FILLER_RE* # filler ( # start of Set::IntSpan \d{4} # year (?:$FILLER_RE+\d{4})* # more years )? # end of Set::IntSpan $FILLER_RE* # filler (.*?) # free text copyright holder (?: # All rights reserved \s* All\s+[Rr]ights\s+[Rr]eserved \.? )? \s* \z # end of string }xms; Readonly my $MAX_RELATIVE_WIDTH => 0.33; sub new { my $class = shift; my $self = {}; bless $self, $class; my $text = shift; if (ref $text eq 'ARRAY') { foreach my $line (@$text) { $self->_parse($line); } } elsif ($text) { $self->_parse($text); } return $self; } sub _parse { my $self = shift; my $text = shift; foreach my $line (split $NL_RE, $text) { next if not $line; my $match = ($line =~ $LINE_RE); ### assert: $match my $set_intspan = $1; my $copyright_holder = $2; $self->{$copyright_holder} = eval { Set::IntSpan->new($set_intspan) }; if ($@) { my @err = split $NL_RE, $@; Debian::LicenseReconcile::Errors->push( test => 'Copyright parsing', msg => "Trying to parse $set_intspan: $err[0]", ); $self->{$copyright_holder} = Set::IntSpan->new; } } return; } sub contains { my $self = shift; my $other = shift; my $msg_ref = shift; undef $msg_ref if not ref $msg_ref; return _msg($msg_ref, 'The other copyright data was undefined.') if not defined $other; my $other_class = blessed $other || ''; if ($other_class ne 'Debian::LicenseReconcile::CopyrightDatum') { $other = Debian::LicenseReconcile::CopyrightDatum->new($other); } # 1.) Get lists of our and their copyright holders. # 2.) If we have less than theirs that is an easy fail. # 3.) Match off any that are exact matches and check those # 4.) Now create a mapping from Levenshtein distances to sets of pairs # of copyright holders. However if a holder is equidistant between # two oppisate holders then we immediately reject the whole # match as being ambiguous. # 5.) If we get this far then working from the shortest Levenshtein # distances up, we can pair off copyright holders and run the other # checks. my $our_data = $self->as_hash; my $their_data = $other->as_hash; my @their_keys = keys %$their_data; my $our_size = keys %$our_data; my $their_size = @their_keys; if ($our_size < $their_size) { my $our_list = join '|', keys %$our_data; my $their_list = join '|', keys %$their_data; return _msg($msg_ref, "$their_size cannot be fitted into $our_size: ($their_list) versus ($our_list)"); } foreach my $key (@their_keys) { if (exists $our_data->{$key}) { my $our_years = delete $our_data->{$key}; my $their_years = delete $their_data->{$key}; if (not $their_years le $our_years) { return _msg($msg_ref, "For copyright holder '$key' the years $their_years cannot be fitted into $our_years."); } } } my @pairs = sort {$a <=> $b} map { my $ours = $_; map { Debian::LicenseReconcile::CopyrightDatum::Holder->new( theirs=>$_, ours=>$ours ) } keys %$their_data # note could be a subset of @their_keys } keys %$our_data; while(@pairs) { my $subject = $pairs[0]; if ($subject->relative_width > $MAX_RELATIVE_WIDTH) { my $ours = $subject->ours; my $theirs = $subject->theirs; return _msg($msg_ref, "Trying to match '$theirs' against '$ours' but it does not look like a good match."); } my ($like_subject, $unlike_subject) = part {not $subject->touches($_)} @pairs; if ($subject->is_ambiguous($like_subject)) { my $friend = $like_subject->[1]; my $subject_ours = $subject->ours; my $friend_ours = $friend->ours; my $subject_theirs = $subject->theirs; my $friend_theirs = $friend->theirs; if ($subject_ours eq $friend_ours) { return _msg($msg_ref, "Was trying to match '$subject_theirs' to '$subject_ours', but '$friend_theirs' would match as well so giving up."); } ### assert: $subject_theirs eq $friend_theirs return _msg($msg_ref, "Was trying to match '$subject_theirs' to '$subject_ours', but '$friend_ours' would be matched as well so giving up."); } my $our_key = $subject->ours; my $their_key = $subject->theirs; my $our_years = delete $our_data->{$our_key}; my $their_years = delete $their_data->{$their_key}; if (not $their_years le $our_years) { return _msg($msg_ref, "For copyright holder '$their_key' (which looks like '$our_key') the years $their_years cannot be fitted into $our_years."); } @pairs = $unlike_subject ? @$unlike_subject : (); } return 1; } sub _msg { my $msg_ref = shift; my $text = shift; ### assert: $msg_ref $$msg_ref = $text; return 0; } sub copyright_holders { my $self = shift; return keys %$self; } sub years { my $self = shift; my $holder = shift; return if not exists $self->{$holder}; return $self->{$holder}; } sub as_hash { my $self = shift; my %hash = %$self; return \%hash; } =head1 NAME Debian::LicenseReconcile::CopyrightDatum - copyright data as an object =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 DESCRIPTION This module conceives of copyright data as a mapping from strings (the individual copyright holders) to sets of years. Copyright data can be compared. Datum C is contained in Datum C if for every key C in C, C is contained in C, where C is the key in C that most closely matches C. When matching strings they are paired off in a 1-1 manner. =head1 SYNOPSIS use Debian::LicenseReconcile::CopyrightDatum; my $copyright = Debian::LicenseReconcile::CopyrightDatum->new($text); my $explanation = ""; if (not $copyright->contains($copyright2, \$explanation)) { warn $explanation; } =head1 SUBROUTINES/METHODS =head2 new This constructor parses a copyright string. =head2 contains This method returns a boolean indicating whether the object contains the argument. The method will respect the argument if it is a L and otherwise stringify and parse it. It may also take an optional reference. If this is set on failing to veryify containment the reason found will be placed in that reference. =head2 copyright_holders This method returns the list of copyright holders parsed from the original string. =head2 years Given an exactly matching copyright holder this returns the set of years as an L object. =head2 as_hash Returns a hash reference of the objects data. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile::FormatSpec license-reconcile-0.4/lib/Debian/LicenseReconcile/CopyrightTarget.pm0000644000000000000000000000771012222342225022442 0ustar package Debian::LicenseReconcile::CopyrightTarget; use 5.006; use strict; use warnings; use Debian::LicenseReconcile::Errors; use Debian::Copyright; use Readonly; use Debian::LicenseReconcile::Utils qw(get_files); use Debian::LicenseReconcile::CopyrightDatum; use File::FnMatch qw(:fnmatch); Readonly my $SPACE => qr{\s+}xms; sub new { my $class = shift; my $self = {}; bless $self, $class; return $self; } sub parse { my $self = shift; my $copyright = shift; my $parser = Debian::Copyright->new($copyright); eval { $parser->read(\$copyright); }; if ($@) { my $msg = $@; Debian::LicenseReconcile::Errors->push( test => 'CopyrightParsing', msg => $msg, ); return; } $self->{files} = $parser->files; return $self; } sub patterns { my $self = shift; my $check_copyright = shift; my %patterns; foreach my $pattern ($self->{files}->Keys) { my $index = $self->{files}->Indices($pattern); my $value = $self->{files}->Values($index); my @patterns = split $SPACE, $pattern; foreach my $key (@patterns) { my $target_license = $value->License; $target_license =~ s{\n.*\z}{}xms; $patterns{$key} = { license => $target_license, }; if ($check_copyright) { $patterns{$key}->{copyright} = Debian::LicenseReconcile::CopyrightDatum->new( $value->Copyright ); } } } return \%patterns; } sub map_directory { my $self = shift; my $directory = shift; my @files = get_files($directory); my $file_mapping = {}; # For each Files clause try to find candidate matches. foreach my $pattern ($self->{files}->Keys) { my @patterns = split $SPACE, $pattern; foreach my $p (@patterns) { foreach my $file (grep { fnmatch($p, $_) } @files) { my $index = $self->{files}->Indices($pattern); $file_mapping->{$file} = { pattern=>$p, copyright=>$self->{files}->Values($index)->Copyright, license=>$self->{files}->Values($index)->License, }; } } } my @missing = grep {not exists $file_mapping->{$_}} @files; foreach my $file (@missing) { Debian::LicenseReconcile::Errors->push( test => 'FileMapping', msg => "Could not find matching copyright clause for $file", ); } return $file_mapping; } =head1 NAME Debian::LicenseReconcile::CopyrightTarget - file patterns mapped to Debian copyright =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::CopyrightTarget; my $copyright_target = Debian::LicenseReconcile::CopyrightTarget->new; $copyright_target->parse($text); =head1 SUBROUTINES/METHODS =head2 new This constructor returns an empty copyright target object. =head2 parse This takes as an argument the copyright data. If the copyright data cannot be parsed by L then the method returns undef and reports an error via L. =head2 map_directory Takes a directory path and attempts to map the contents of that directory onto the copyright specification. It returns a hash reference containing that mapping. =head2 patterns Returns the file to License and Copyright mapping. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile::FormatSpec license-reconcile-0.4/lib/Debian/LicenseReconcile/FormatSpec.pm0000644000000000000000000000342612222342225021366 0ustar package Debian::LicenseReconcile::FormatSpec; use 5.006; use strict; use warnings; use Debian::LicenseReconcile::Errors; use Readonly; Readonly my %PERMITTED_FORMATS => ( 'Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/'=>1, ); Readonly my $TEST => 'FormatSpec'; Readonly my $NL => "\n"; =head1 NAME Debian::LicenseReconcile::FormatSpec - check format is recognized =head1 VERSION Version 0.4 =cut our $VERSION = '0.4'; =head1 SYNOPSIS use Debian::LicenseReconcile::FormatSpec; my $check = Debian::LicenseReconcile::FormatSpec->check($copyright); =head1 SUBROUTINES/METHODS =head2 check This class method takes the copyright data as input and returns a boolean indicating whether it has a permitted format. It also records the error in the L system. =cut sub check { my $class = shift; my $copyright = shift; my @lines = split $NL, $copyright; if (scalar @lines == 0) { Debian::LicenseReconcile::Errors->push( test => $TEST, msg => 'copyright data is empty', ); return 0; } return 1 if exists $PERMITTED_FORMATS{$lines[0]}; Debian::LicenseReconcile::Errors->push( test => $TEST, msg => "Cannot recognize format: $lines[0]", ); return 0; } =head1 AUTHOR Nicholas Bamber, C<< >> =head1 LICENSE AND COPYRIGHT Copyright 2012 Nicholas Bamber C<< >>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Debian::LicenseReconcile::FormatSpec license-reconcile-0.4/examples/0000755000000000000000000000000012207662275013455 5ustar license-reconcile-0.4/examples/cwm.yml0000644000000000000000000000043312207662275014766 0ustar Rules: rules: Std: #Shebang: # rules: # - # Glob: BUILD/* # - # Matches: \A\#\! ChangeLog: license: ISC Default: rules: - Copyright: | Copyright 2004,2005 Marius Aamodt Eriksen Copyright 2004 Andy Adamson License: ISC license-reconcile-0.4/examples/bwctl.yml0000644000000000000000000000101112207662275015304 0ustar Rules: rules: - Glob: bwlib/rijndael-api-fst.? License: public-domain Copyright: 2000, Vincent Rijmen , Antoon Bosselaers , Paulo Barreto Justification: from files Std: #Shebang: # rules: # - # Glob: BUILD/* # - # Matches: \A\#\! ChangeLog: license: BSD-3-clause Default: rules: - Copyright: 2003-2012 Internet2 License: Apache-2.0 Justification: This is taken from the README file. license-reconcile-0.4/examples/license-reconcile.yml0000644000000000000000000001334312207662275017567 0ustar Rules: rules: - Glob: sql/tzfile.h MaxVersion: 5.6 MMagic: text/plain Contains: | /* Copyright (c) 2004, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc. Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* This file is based on public domain code from ftp://elsie.ncih.nist.gov/ Initial source code is in the public domain, so clarified as of 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). */ License: GPL-2 Copyright: Copyright (c) 2004, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc. Justification: Seems to have been taken out of public domain by Oracle. - Glob: storage/ndb/src/common/util/md5_hash.cpp MaxVersion: 5.6 MMagic: text/plain Contains: | /* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * The code has been modified by Mikael Ronstroem to handle * calculating a hash value of a key that is always a multiple * of 4 bytes long. Word 0 of the calculated 4-word hash value * is returned as the hash value. */ Matches: the\s+Free\s+Software\s+Foundation;\s+version\s+2\s+of\s+the\s+License. License: GPL-2 Copyright: Copyright (C) 2003 MySQL AB Justification: Seems to have been taken out of public domain by Oracle. - Glob: mysys/md5.c MaxVersion: 5.6 MMagic: text/plain Contains: | /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. */ /* This code was modified in 1997 by Jim Kingdon of Cyclic Software to not require an integer type which is exactly 32 bits. This work draws on the changes for the same purpose by Tatu Ylonen as part of SSH, but since I didn't actually use that code, there is no copyright issue. I hereby disclaim copyright in any changes I have made; this code remains in the public domain. */ License: GPL-2 Copyright: Copyright (C) 2000 MySQL AB Justification: Seems to have been taken out of public domain by Oracle. - Glob: storage/ndb/test/include/getarg.h MaxVersion: 5.5.30 Copyright: | 2003 MySQL AB 1997-1999 Kungliga Tekniska Högskolan License: BSD (3 clause) or GPL-2 Justification: Check the actual file but this looks like a dual-license to me - Glob: dbug/* Matches: Copyright\s+Abandoned,\s+1987,\s+Fred\s+Fish\s+\*\s+\*\s+\*\s+\*\s+\*\s+\*\s+This\s+previously\s+copyrighted\s+work\s+has\s+been\s+placed\s+into\s+the\s+public\s+\*\s+\*\s+domain\s+by\s+the\s+author\s+and\s+may\s+be\s+freely\s+used\s+for\s+any\s+purpose,\s+\*\s+\*\s+private\s+or\s+commercial\. Copyright: 1987 Abandoned Fred Fish License: public-domain Std: #Shebang: # rules: # - # Glob: BUILD/* # - # Matches: \A\#\! ChangeLog: license: GPL-2+ Default: rules: - Glob: cmd-line-utils/readline/* Copyright: 1987-2006 Free Software Foundation Inc License: GPL-2+ Justification: More based on the actual files than cmd-line-utils/readline/README - Glob: zlib/* Copyright: 1995-2005 Jean-loup Gailly and Mark Adler License: zlib/libpng Justification: See zlib/README - Copyright: 2000, 2012, Oracle and/or its affiliates. All rights reserved. License: GPL-2 Justification: This is taken from the README file. license-reconcile-0.4/examples/bwctl.log0000644000000000000000000005126412207662275015303 0ustar License mismatch: File bwlib/rijndael-api-fst.h has license public-domain which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/rijndael-api-fst.h: Trying to match 'Vincent Rijmen , Antoon Bosselaers , Paulo Barreto ' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File bwlib/rijndael-api-fst.c has license public-domain which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/rijndael-api-fst.c: Trying to match 'Vincent Rijmen , Antoon Bosselaers , Paulo Barreto ' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File I2util/I2util/readpassphrase.h has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File I2util/I2util/readpassphrase.h: Trying to match 'Copyright: 2003 * / 2000 Todd C. Miller ' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File I2util/I2util/readpassphrase.c has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File I2util/I2util/readpassphrase.c: Trying to match 'Copyright: 2003 * / 2000 Todd C. Miller / only applies to changes made / follows' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwctl/bwctl.c: Trying to match '/home/nicholas/debian/mentors/bwctl-1/bwctl/bwctlP.h: *No copyright* Apache (v2.0)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File thrulay/ltmain.sh has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File thrulay/ltmain.sh: Trying to match 'Copyright: 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwctld/policy.h: Trying to match '/home/nicholas/debian/mentors/bwctl-1/bwctld/policy.c: *No copyright* Apache (v2.0)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwctld/bwctldP.h: Trying to match '/home/nicholas/debian/mentors/bwctl-1/bwctld/bwctld.c: *No copyright* Apache (v2.0)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/sapi.c: Trying to match 'Copyright: 2003 *' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/arithm64.c: Trying to match 'Copyright: 2003 *' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/time.c: Trying to match 'Copyright: 2003 *' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/context.c: Trying to match 'Copyright: 2003 *' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/bwlib.h: Trying to match '/home/nicholas/debian/mentors/bwctl-1/bwlib/nuttcp.c: *No copyright* Apache (v2.0)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/iperf.c: Trying to match '/home/nicholas/debian/mentors/bwctl-1/bwlib/rijndael-alg-fst.c: *No copyright* BSD' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/thrulay.c: Trying to match '/home/nicholas/debian/mentors/bwctl-1/bwlib/api.c: Apache (v2.0)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/io.c: Trying to match '/home/nicholas/debian/mentors/bwctl-1/bwlib/tools.c: *No copyright* Apache (v2.0)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/protocol.c: Trying to match '/home/nicholas/debian/mentors/bwctl-1/bwlib/error.c: Apache (v2.0)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/daemon.c: Trying to match '/home/nicholas/debian/mentors/bwctl-1/bwlib/rijndael-alg-fst.h: *No copyright* BSD' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/endpoint.c: Trying to match 'Copyright: 2003 *' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/util.c: Trying to match '/home/nicholas/debian/mentors/bwctl-1/bwlib/rijndael-api-fst.c: *No copyright* BSD' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File bwlib/capi.c: Trying to match '/home/nicholas/debian/mentors/bwctl-1/config/ltmain.sh: GPL (v2 or later) GENERATED FILE' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File I2util/config/install-sh has license MIT/X11 (BSD like) which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File I2util/config/install-sh: Trying to match 'Copyright: 1994 X Consortium' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File thrulay/install-sh has license MIT/X11 (BSD like) which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File thrulay/install-sh: Trying to match 'Copyright: 1994 X Consortium' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File I2util/config/missing has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File I2util/config/missing: Trying to match 'Copyright: 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File I2util/config/depcomp has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File I2util/config/depcomp: Trying to match 'Copyright: 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File config/config.sub has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File config/config.sub: Trying to match 'Copyright: 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File thrulay/missing has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File thrulay/missing: Trying to match 'Copyright: 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File I2util/config/config.guess has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File I2util/config/config.guess: Trying to match 'Copyright: 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 / 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File thrulay/config.guess has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File thrulay/config.guess: Trying to match 'Copyright: 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 / 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File thrulay/config.sub has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File thrulay/config.sub: Trying to match 'Copyright: 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File I2util/config/config.sub has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File I2util/config/config.sub: Trying to match 'Copyright: 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File config/depcomp has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File config/depcomp: Trying to match 'Copyright: 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File config/config.guess has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File config/config.guess: Trying to match 'Copyright: 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 / 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File config/missing has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File config/missing: Trying to match 'Copyright: 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File config/install-sh has license MIT/X11 (BSD like) which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File config/install-sh: Trying to match 'Copyright: 1994 X Consortium' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File thrulay/depcomp has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File thrulay/depcomp: Trying to match 'Copyright: 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File config/compile has license GPL-2+ which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File config/compile: Trying to match 'Copyright: 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-server.install has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-server.install: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/rules has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/rules: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-server.init.d has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-server.init.d: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/copyright has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/copyright: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/patches/manpages has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/patches/manpages: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-server.README.Debian has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-server.README.Debian: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-server.postinst has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-server.postinst: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/control has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/control: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-client.manpages has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-client.manpages: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-server.postrm has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-server.postrm: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-client.lintian-overrides has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-client.lintian-overrides: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/changelog has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/changelog: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/patches/series has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/patches/series: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-client.install has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-client.install: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-server.default has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-server.default: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-server.prerm has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-server.prerm: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/compat has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/compat: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/source/format has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/source/format: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/watch has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/watch: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/patches/serverconfig has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/patches/serverconfig: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-server.manpages has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-server.manpages: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. License mismatch: File debian/bwctl-server.examples has license BSD-3-clause which does not match Apache-2.0. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. Copyright mismatch: File debian/bwctl-server.examples: Trying to match 'ARRAY(0xab4286c)' against 'Internet2' but it does not look like a good match. at lib/Debian/LicenseReconcile/App.pm line 154, line 3. license-reconcile-0.4/examples/bwctl.log20000644000000000000000000002166612207662275015370 0ustar License mismatch: File I2util/test/hmac-sha1test.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/aespasswd/aespasswd.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/configure.ac has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/config.h.in has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/conf.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/sha1.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/sha1P.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/config/randomdev.m4 has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/pfstore/pfstore.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/config/c-attribute.m4 has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/md5.c has license Apache-2.0 which does not match public domain. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/utilP.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/random.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/ErrLogImmediate.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/doc/aespasswd.man.html has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/Pthread.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/hmac-sha1.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/sha1.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/config/c-syslog-names.m4 has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/doc/aespasswd.man has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util.spec.in has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/aespasswd/Makefile.am has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/Pthread.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/mach_dep.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/test/pbkdf2test.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/saddr.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/Makefile.am has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/errlog.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/errlogsyslog.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/addr.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/ChangeLog has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/table.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/saddr.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/test/Makefile.am has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/errlogimmediate.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/config/c-syslog-perror.m4 has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/random.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/ErrLogSyslog.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/doc/pfstore.man.html has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/table.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/pbkdf2.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/io.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/Makefile.am has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/pfstore/Makefile.am has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/README has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/ErrLog.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/addr.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/hmac-sha1.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/conf.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/md5.h has license Apache-2.0 which does not match public domain. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/hex.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/hex.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/doc/Makefile.am has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/mach_dep.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/doc/pfstore.man has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/util.h has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/io.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/I2util/pbkdf2.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. License mismatch: File I2util/test/sha1test.c has license Apache-2.0 which does not match BSD-3-clause. at bin/license-reconcile line 121, line 3. license-reconcile-0.4/examples/cwm.log0000644000000000000000000000000012207662275014734 0ustar license-reconcile-0.4/t/0000755000000000000000000000000012222342225012065 5ustar license-reconcile-0.4/t/10-get_files.t0000644000000000000000000000061612207662275014451 0ustar #!/usr/bin/perl use Test::More tests => 1; use Debian::LicenseReconcile::Utils qw(get_files); use Test::Deep; my @files = sort { $a cmp $b} get_files('t/data/example'); cmp_deeply(\@files, [ 'a/0.h', 'a/1.h', 'a/2.h', 'a/3.h', 'a/base', 'a/g/blah', 'a/g/scriggs.t', 'a/scriggs.g', 'base', 'base.h', 'debian/changelog', 'debian/control', 'debian/copyright', 'sample.png', ]); license-reconcile-0.4/t/19-rules-verify.t0000644000000000000000000000272712207662275015162 0ustar #!/usr/bin/perl use Test::More tests => 3; use Test::Deep; use Debian::LicenseReconcile::Utils qw(get_files); use Debian::LicenseReconcile::Filter::Rules; use Debian::LicenseReconcile::LicenseCheck; use Readonly; Readonly my $LICENSECHECK => Debian::LicenseReconcile::LicenseCheck->new('t/data/example', [], 0); Readonly my $DIR => 't/data/example'; my @files = get_files($DIR); my $filter = Debian::LicenseReconcile::Filter::Rules->new( directory=>$DIR, name=>'Rules8', licensecheck=>$LICENSECHECK, config=>{ rules=>[ { VerifyLicense=>'BSD', License=>'Blah1', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, { VerifyLicense=>'GPL (v2)', License=>'Blah2', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ], }, files_remaining=>\@files, ); isa_ok($filter, 'Debian::LicenseReconcile::Filter'); isa_ok($filter, 'Debian::LicenseReconcile::Filter::Rules'); my @data = $filter->get_info; cmp_deeply(\@data, [ { file=>'base', license=>'Blah2', test=>'Rules8', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, { file=>'base.h', license=>'Blah2', test=>'Rules8', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ]); license-reconcile-0.4/t/18-app.t0000644000000000000000000001247012222342225013264 0ustar #!/usr/bin/perl use Test::More tests => 41; use Test::Deep; use Test::Output; use Test::NoWarnings; use Debian::LicenseReconcile::Errors; use Debian::LicenseReconcile::App; use lib qw(t/lib); use TestData; is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); my $app1 = Debian::LicenseReconcile::App->new( copyright=>'t/data/example/debian/copyright', format_spec=>1, ); isa_ok($app1, 'Debian::LicenseReconcile::App'); my $target = $app1->_read_copyright_file; is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); isa_ok($target, 'Debian::LicenseReconcile::CopyrightTarget'); my $app2 = Debian::LicenseReconcile::App->new( copyright=>'t/data/bad-format', ); isa_ok($app2, 'Debian::LicenseReconcile::App'); my $target2 = $app2->_read_copyright_file; is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); isa_ok($target2, 'Debian::LicenseReconcile::CopyrightTarget'); my $app3 = Debian::LicenseReconcile::App->new( copyright=>'t/data/bad-format', format_spec=>1, ); isa_ok($app3, 'Debian::LicenseReconcile::App'); my $target3 = $app3->_read_copyright_file; is(Debian::LicenseReconcile::Errors->how_many,1,'how many'); my @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ $DLR_ERROR1 ], 'initial state'); isa_ok($target3, 'Debian::LicenseReconcile::CopyrightTarget'); my $app4 = Debian::LicenseReconcile::App->new( copyright=>'t/data/flossy', format_spec=>1, ); isa_ok($app4, 'Debian::LicenseReconcile::App'); my $target4 = $app4->_read_copyright_file; is(Debian::LicenseReconcile::Errors->how_many,2,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ $DLR_ERROR1, $DLR_ERROR2, ]); is($target4, undef); my $app5 = Debian::LicenseReconcile::App->new( changelog_file=>'t/data/example/debian/changelog', ); isa_ok($app5, 'Debian::LicenseReconcile::App'); my $target5 = $app5->_parse_changelog; is(Debian::LicenseReconcile::Errors->how_many,2,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ $DLR_ERROR1, $DLR_ERROR2, ]); isa_ok($target5, 'Parse::DebianChangelog'); my $app6 = Debian::LicenseReconcile::App->new( config_file =>'t/data/empty.yml', filters=>['X','Y','Z'], ); isa_ok($app6, 'Debian::LicenseReconcile::App'); my $target6 = $app6->_parse_config; is(Debian::LicenseReconcile::Errors->how_many,2,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ $DLR_ERROR1, $DLR_ERROR2, ]); cmp_deeply($target6, {licensecheck=>{},X=>{rules=>[]},Y=>{rules=>[]},Z=>{rules=>[]}}); my $app7 = Debian::LicenseReconcile::App->new( config_file =>'t/data/almost.yml', ); isa_ok($app7, 'Debian::LicenseReconcile::App'); my $target7 = $app7->_parse_config; is(Debian::LicenseReconcile::Errors->how_many,2,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ $DLR_ERROR1, $DLR_ERROR2, ]); cmp_deeply($target7, {licensecheck=>{},Rules=>{rules=>[],blah=>undef},Blah=>[undef]}); my $app8 = Debian::LicenseReconcile::App->new( directory=>'t/data/example', ); isa_ok($app8, 'Debian::LicenseReconcile::App'); my $target8 = $app8->_build_licensecheck($target7); is(Debian::LicenseReconcile::Errors->how_many,2,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ $DLR_ERROR1, $DLR_ERROR2, ]); isa_ok($target8, 'Debian::LicenseReconcile::LicenseCheck'); my $app9 = Debian::LicenseReconcile::App->new( directory=>'t/data/example', display_mapping => 0, ); isa_ok($app9, 'Debian::LicenseReconcile::App'); my $target9 = undef; stdout_is(sub { $target9 = $app9->_build_file_mapping($target); }, ''); cmp_deeply($target9, { 'a/0.h'=>$COPYRIGHT_DATA2, 'a/1.h'=>$COPYRIGHT_DATA2, 'a/2.h'=>$COPYRIGHT_DATA2, 'a/3.h'=>$COPYRIGHT_DATA2, 'a/base'=>$COPYRIGHT_DATA, 'a/g/blah'=>$COPYRIGHT_DATA2u, 'a/g/scriggs.t'=>$COPYRIGHT_DATA5, 'a/scriggs.g'=>$COPYRIGHT_DATA4, 'base'=>$COPYRIGHT_DATA, 'sample.png'=>$COPYRIGHT_DATA, 'base.h'=>$COPYRIGHT_DATA, 'debian/changelog'=>$COPYRIGHT_DATA3, 'debian/control'=>$COPYRIGHT_DATA3, 'debian/copyright'=>$COPYRIGHT_DATA3, }); my $app10 = Debian::LicenseReconcile::App->new( directory=>'t/data/example', display_mapping => 1, ); isa_ok($app10, 'Debian::LicenseReconcile::App'); my $target10 = undef; my $expected = 'a/0.h: a/*.h a/1.h: a/*.h a/2.h: a/*.h a/3.h: a/*.h a/base: * a/g/blah: a/g/* a/g/scriggs.t: a/g/*.t a/scriggs.g: a/*.g base: * base.h: * debian/changelog: debian/* debian/control: debian/* debian/copyright: debian/* sample.png: * '; stdout_is(sub { $target10 = $app10->_build_file_mapping($target); }, $expected); cmp_deeply($target10, $target9); my $app11 = Debian::LicenseReconcile::App->new( copyright=>'t/data/example/debian/copyright', format_spec=>1, directory=>'t/data/example', display_mapping => 0, check_copyright=>1, changelog_file=>'t/data/example/debian/changelog', config_file=>'t/data/example/debian/license-reconcile.yml', filters=>['Rules', 'Std', 'Shebang', 'ChangeLog', 'Default~Std'], quiet=>1, ); isa_ok($app11, 'Debian::LicenseReconcile::App'); is($app11->run, 1, 'exit status'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, bag( $DLR_ERROR1, $DLR_ERROR2, $DLR_ERROR3, $DLR_ERROR4, $DLR_ERROR5, $DLR_ERROR6, $DLR_ERROR7, $DLR_ERROR8, $DLR_ERROR9, $DLR_ERROR10, )); license-reconcile-0.4/t/data/0000755000000000000000000000000012207662275013013 5ustar license-reconcile-0.4/t/data/nolicense.c0000644000000000000000000000024612207662275015140 0ustar /* $NetBSD: tty.c,v 1.41 2011/10/04 15:27:04 christos Exp $ */ /*- * Copyright (c) 1992, 1993 The Regents of the University of California. All rights reserved. * license-reconcile-0.4/t/data/bad-format0000644000000000000000000000011212207662275014744 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.O/ license-reconcile-0.4/t/data/duplicate0000644000000000000000000000224112207662275014707 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: pkg-components Upstream-Contact: Nicholas Bamber Source: http://github.com/periapt/pkg-components Files: * Copyright: 2010-2011, Nicholas Bamber License: Artistic or GPL-2+ Files: lib/Debian/Copyright* Copyright: 2011, Nicholas Bamber License: GPL-2+ Files: lib/Debian/Copyright* Copyright: 2009, Damyan Ivanov [Portions] License: GPL-2+ License: Artistic This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl. . On Debian systems, the complete text of the Artistic License can be found in `/usr/share/common-licenses/Artistic'. License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. . On Debian systems, the complete text of version 2 of the General Public License can be found in `/usr/share/common-licenses/GPL-2'. license-reconcile-0.4/t/data/copyright_extract20000644000000000000000000000066712207662275016573 0ustar Copyright (c) 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of license-reconcile-0.4/t/data/tty.c0000644000000000000000000000362712207662275014007 0ustar /* $NetBSD: tty.c,v 1.41 2011/10/04 15:27:04 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; #else #endif #endif /* not lint && not SCCSID */ license-reconcile-0.4/t/data/copyright0000644000000000000000000000215312207662275014747 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: pkg-components Upstream-Contact: Nicholas Bamber Source: http://github.com/periapt/pkg-components Files: * Copyright: 2010-2011, Nicholas Bamber License: Artistic or GPL-2+ Files: lib/Debian/Copyright* Copyright: 2011, Nicholas Bamber 2009, Damyan Ivanov [Portions] License: GPL-2+ License: Artistic This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl. . On Debian systems, the complete text of the Artistic License can be found in `/usr/share/common-licenses/Artistic'. License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. . On Debian systems, the complete text of version 2 of the General Public License can be found in `/usr/share/common-licenses/GPL-2'. license-reconcile-0.4/t/data/partial-match0000644000000000000000000000222112207662275015461 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: pkg-components Upstream-Contact: Nicholas Bamber Source: http://github.com/periapt/pkg-components Files: * Copyright: 2010-2011, Nicholas Bamber License: Artistic or GPL-2+ Files: lib/Debian/Copyright* Copyright: 2011, Nicholas Bamber License: GPL-2+ Files: lib/* Copyright: 2009, Damyan Ivanov [Portions] License: GPL-2+ License: Artistic This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl. . On Debian systems, the complete text of the Artistic License can be found in `/usr/share/common-licenses/Artistic'. License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. . On Debian systems, the complete text of version 2 of the General Public License can be found in `/usr/share/common-licenses/GPL-2'. license-reconcile-0.4/t/data/empty.yml0000644000000000000000000000000012207662275014662 0ustar license-reconcile-0.4/t/data/almost.yml0000644000000000000000000000003512207662275015033 0ustar Rules: blah: Blah: - license-reconcile-0.4/t/data/example/0000755000000000000000000000000012207662275014446 5ustar license-reconcile-0.4/t/data/example/base.h0000644000000000000000000000140412207662275015530 0ustar /* Copyright (c) 2011, Periapt Technologies. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ blah, blah, blah, blahty code, blah blah license-reconcile-0.4/t/data/example/sample.png0000644000000000000000000000022212207662275016431 0ustar ‰PNG  IHDRwSÞ pHYs  šœtIMEÜ --Ξ ‚tEXtCommentCreated with GIMPW IDAT×cUœÔ«lÚIEND®B`‚license-reconcile-0.4/t/data/example/debian/0000755000000000000000000000000012207662275015670 5ustar license-reconcile-0.4/t/data/example/debian/changelog0000644000000000000000000000044212207662275017542 0ustar example (3.20.16beta-2) unstable; urgency=low * Blah, blah,blah -- Christian Schwarz Sun, 11 May 1997 14:19:26 +0200 example (3.20.16beta-1) unstable; urgency=low * Initial Release. -- Christian Schwarz Sat, 12 Apr 1997 13:51:28 +0200 license-reconcile-0.4/t/data/example/debian/copyright0000644000000000000000000000417512207662275017632 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: pkg-components Upstream-Contact: Nicholas Bamber Source: http://github.com/periapt/pkg-components Files: * Copyright: 2010-2011, Nicholas Bamber License: Artistic or GPL-2+ Files: debian/* Copyright: 2008-2010, gregor hermann 2010-2011, Nicholas Bamber License: Artistic or GPL-2+ Files: a/*.h a/g/* Copyright: 2011, Nicholas Bamber 2008, Joe Bloggs License: GPL-3+ Files: a/g/*.t a/*.g Copyright: 2011, Nicholas Bamber 2009, Damyan Ivanov License: GPL-1+ License: Artistic This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl. . On Debian systems, the complete text of the Artistic License can be found in `/usr/share/common-licenses/Artistic'. License: GPL-1+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. . On Debian systems, the complete text of version 1 of the General Public License can be found in `/usr/share/common-licenses/GPL-1'. License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. . On Debian systems, the complete text of version 2 of the General Public License can be found in `/usr/share/common-licenses/GPL-2'. License: GPL-3+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. . On Debian systems, the complete text of version 3 of the General Public License can be found in `/usr/share/common-licenses/GPL-3'. license-reconcile-0.4/t/data/example/debian/control0000644000000000000000000000000012207662275017261 0ustar license-reconcile-0.4/t/data/example/base0000755000000000000000000000142412207662275015307 0ustar #!/usr/bin/bash /* Copyright (c) 2012, Periapt Technologies. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ blah, blah, blah, blahty code, blah blah license-reconcile-0.4/t/data/example/a/0000755000000000000000000000000012207662275014666 5ustar license-reconcile-0.4/t/data/example/a/3.h0000644000000000000000000000000012207662275015167 0ustar license-reconcile-0.4/t/data/example/a/g/0000755000000000000000000000000012207662275015114 5ustar license-reconcile-0.4/t/data/example/a/g/blah0000644000000000000000000000000012207662275015733 0ustar license-reconcile-0.4/t/data/example/a/g/scriggs.t0000644000000000000000000000000012207662275016730 0ustar license-reconcile-0.4/t/data/example/a/2.h0000644000000000000000000000000012207662275015166 0ustar license-reconcile-0.4/t/data/example/a/0.h0000644000000000000000000000000012207662275015164 0ustar license-reconcile-0.4/t/data/example/a/scriggs.g0000644000000000000000000000000012207662275016465 0ustar license-reconcile-0.4/t/data/example/a/base0000644000000000000000000000000012207662275015511 0ustar license-reconcile-0.4/t/data/example/a/1.h0000644000000000000000000000000012207662275015165 0ustar license-reconcile-0.4/t/data/good-format0000644000000000000000000000011212207662275015146 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ license-reconcile-0.4/t/data/wtfpl0000644000000000000000000000136412207662275014076 0ustar DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. license-reconcile-0.4/t/data/rltty.c0000644000000000000000000000236112207662275014337 0ustar /* rltty.c -- functions to prepare and restore the terminal for readline's use. */ /* Copyright (C) 1992-2005 Free Software Foundation, Inc. This file is part of the GNU Readline Library, a library for reading lines of text with interactive input and history editing. The GNU Readline Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. The GNU Readline Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The GNU General Public License is often shipped with GNU software, and is generally kept in a file called COPYING or LICENSE. If you do not have a copy of the license, write to the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) # include "config_readline.h" #endif #include #include #include #include #if defined (HAVE_UNISTD_H) license-reconcile-0.4/t/data/copyright_extract10000644000000000000000000000073112207662275016562 0ustar /* Copyright (C) 2007 Google Inc. Copyright (c) 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of license-reconcile-0.4/t/data/flossy0000644000000000000000000000224212207662275014255 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: pkg-components Upstream-Contact: Nicholas Bamber Source: http://github.com/periapt/pkg-components Files: * Copyright: 2010-2011, Nicholas Bamber License: Artistic or GPL-2+ Files: lib/Debian/Copyright* Copyright: 2011, Nicholas Bamber License: GPL-2+ Flossy: lib/Debian/Copyright* Copyright: 2009, Damyan Ivanov [Portions] License: GPL-2+ License: Artistic This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl. . On Debian systems, the complete text of the Artistic License can be found in `/usr/share/common-licenses/Artistic'. License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. . On Debian systems, the complete text of version 2 of the General Public License can be found in `/usr/share/common-licenses/GPL-2'. license-reconcile-0.4/t/15-rules-matches.t0000644000000000000000000000342312207662275015270 0ustar #!/usr/bin/perl use Test::More tests => 3; use Test::Deep; use Debian::LicenseReconcile::Utils qw(get_files); use Debian::LicenseReconcile::Filter::Rules; use Readonly; Readonly my $DIR => 't/data/example'; my @files = get_files($DIR); my $filter = Debian::LicenseReconcile::Filter::Rules->new( directory=>$DIR, name=>'Rules6', config=>{ rules=>[ { MMagic=>'application/octet-stream', License=>'BSD', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, { Glob=>'*a*', MMagic=>'text/plain', Matches=><<'EOS', \*\s+Copyright\s+\(c\)\s+2012,\s+Periapt\s+Technologies\. \s+All\s+rights\s+reserved\. \s+This\s+program\s+is\s+free\s+software; \s+you\s+can\s+redistribute\s+it\s+and\/or\s+modify \s+it\s+under\s+the\s+terms\s+of\s+the\s+GNU\s+General\s+Public\s+License \s+as\s+published\s+by\s+the\s+Free\s+Software\s+Foundation; \s+version\s+2\s+of\s+the\s+License\. EOS License=>'GPL-1', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ], }, files_remaining=>\@files, ); isa_ok($filter, 'Debian::LicenseReconcile::Filter'); isa_ok($filter, 'Debian::LicenseReconcile::Filter::Rules'); my @data = sort { $a->{file} cmp $b->{file} } $filter->get_info; cmp_deeply(\@data, [ { file=>'base', license=>'GPL-1', test=>'Rules6', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, { file=>'sample.png', license=>'BSD', test=>'Rules6', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ]); license-reconcile-0.4/t/02-format.t0000644000000000000000000000264212207662275014002 0ustar #!/usr/bin/perl use Test::More tests => 11; use Test::Deep; use Debian::LicenseReconcile::Errors; use Debian::LicenseReconcile::FormatSpec; use File::Slurp; is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); my @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [], 'initial state'); is(Debian::LicenseReconcile::FormatSpec->check(''), 0, 'empty copyright'); is(Debian::LicenseReconcile::Errors->how_many,1,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ { test=>'FormatSpec', msg=>'copyright data is empty', }, ], 'initial state'); is(Debian::LicenseReconcile::FormatSpec->check(read_file('t/data/good-format')), 1, 'good format'); is(Debian::LicenseReconcile::Errors->how_many,1,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ { test=>'FormatSpec', msg=>'copyright data is empty', }, ], 'initial state'); is(Debian::LicenseReconcile::FormatSpec->check(read_file('t/data/bad-format')), 0, 'bad format'); is(Debian::LicenseReconcile::Errors->how_many,2,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ { test=>'FormatSpec', msg=>'copyright data is empty', }, { test=>'FormatSpec', msg=>'Cannot recognize format: Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.O/', }, ], 'initial state'); license-reconcile-0.4/t/manifest.t0000644000000000000000000000042012207662275014071 0ustar #!perl -T use strict; use warnings; use Test::More; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } eval "use Test::CheckManifest 0.9"; plan skip_all => "Test::CheckManifest 0.9 required" if $@; ok_manifest(); license-reconcile-0.4/t/12-rules-pattern.t0000644000000000000000000000162412207662275015317 0ustar #!/usr/bin/perl use Test::More tests => 3; use Test::Deep; use Debian::LicenseReconcile::Utils qw(get_files); use Debian::LicenseReconcile::Filter::Rules; use Readonly; Readonly my $DIR => 't/data/example'; my @files = get_files($DIR); my $filter = Debian::LicenseReconcile::Filter::Rules->new( directory=>$DIR, config=>{ rules=>[ { Glob=>'b*s?', License=>'GPL-1', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ], }, files_remaining=>\@files, name=>'Rules3', ); isa_ok($filter, 'Debian::LicenseReconcile::Filter'); isa_ok($filter, 'Debian::LicenseReconcile::Filter::Rules'); my @data = $filter->get_info; cmp_deeply(\@data, [{ file=>'base', license=>'GPL-1', test=>'Rules3', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }]); license-reconcile-0.4/t/16-rules-maxversion.t0000644000000000000000000000306612207662275016043 0ustar #!/usr/bin/perl use Test::More tests => 3; use Test::Deep; use Debian::LicenseReconcile::Utils qw(get_files); use Debian::LicenseReconcile::Filter::Rules; use Readonly; use Parse::DebianChangelog; Readonly my $DIR => 't/data/example'; Readonly my $CHANGELOG => Parse::DebianChangelog->init({infile=>"$DIR/debian/changelog"}); my @files = get_files($DIR); my $filter = Debian::LicenseReconcile::Filter::Rules->new( directory=>$DIR, name=>'Rules7', changelog=>$CHANGELOG, config=>{ rules=>[ { MMagic=>'application/octet-stream', License=>'BSD', MaxVersion=>'3.20.16beta-1', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, { Glob=>'ba*', MMagic=>'text/plain', MaxVersion=>'3.20.16beta-2', License=>'GPL-1', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ], }, files_remaining=>\@files, ); isa_ok($filter, 'Debian::LicenseReconcile::Filter'); isa_ok($filter, 'Debian::LicenseReconcile::Filter::Rules'); my @data = $filter->get_info; cmp_deeply(\@data, [ { file=>'base', license=>'GPL-1', test=>'Rules7', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, { file=>'base.h', license=>'GPL-1', test=>'Rules7', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ]); license-reconcile-0.4/t/20-copyright_extract.t0000644000000000000000000000302312222342225016231 0ustar #!/usr/bin/perl use Test::More tests => 6; use Test::Deep; use Test::NoWarnings; use Debian::LicenseReconcile::LicenseCheck; use Readonly; Readonly my $LICENSECHECK => Debian::LicenseReconcile::LicenseCheck->new('t/data', [], 1); Readonly my $RE => '(?:Copyright\s+\(C\)\s+(\Y+Google\s+Inc)\.\s*\R+)?\s*Copyright\s+\(c\)\s+(\Y+MySQL\s+AB),\s+(\Y+Sun\s+Microsystems,\s+Inc)\.\s*\R+'; my @data = $LICENSECHECK->get_info('copyright_extract1'); cmp_deeply(\@data, [{ file=>'copyright_extract1', license=>'GPL-2', copyright=>bag( re('2007 Google Inc'), re('2008 MySQL AB, 2008-2009 Sun Microsystems, Inc') ), }]); @data = $LICENSECHECK->get_info('copyright_extract1', $RE); cmp_deeply(\@data, [{ file=>'copyright_extract1', license=>'GPL-2', copyright=>[ '2007 Google Inc', '2008 MySQL AB', '2008-2009 Sun Microsystems, Inc'], }]); @data = $LICENSECHECK->get_info('copyright_extract2'); cmp_deeply(\@data, [{ file=>'copyright_extract2', license=>'GPL-2', copyright=>[ 'Copyright: 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc' ], }]); @data = $LICENSECHECK->get_info('copyright_extract2', $RE); cmp_deeply(\@data, [{ file=>'copyright_extract2', license=>'GPL-2', copyright=>[ '2008 MySQL AB', '2008-2009 Sun Microsystems, Inc'], }]); @data = $LICENSECHECK->get_info('wtfpl', 'blah'); cmp_deeply(\@data, [{ file=>'wtfpl', license=>'WTFPL', copyright=>[ 'Copyright: 2004 Sam Hocevar '], }]); license-reconcile-0.4/t/05-duplicate.t0000644000000000000000000000240712207662275014466 0ustar #!/usr/bin/perl use Test::More tests => 7; use Test::Deep; use Debian::LicenseReconcile::Errors; use Debian::LicenseReconcile::CopyrightTarget; use File::Slurp; is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); my @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [], 'initial state'); my $copyright = Debian::LicenseReconcile::CopyrightTarget->new; isa_ok($copyright, 'Debian::LicenseReconcile::CopyrightTarget'); isa_ok($copyright->parse(scalar read_file('t/data/duplicate')),'Debian::LicenseReconcile::CopyrightTarget'); is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [], 'initial state'); my $data = { copyright=>' 2010-2011, Nicholas Bamber ', license=>'Artistic or GPL-2+', pattern=>'*', }; cmp_deeply($copyright->map_directory('t/data/example'), { 'a/0.h'=>$data, 'a/1.h'=>$data, 'a/2.h'=>$data, 'a/3.h'=>$data, 'a/base'=>$data, 'a/g/blah'=>$data, 'a/g/scriggs.t'=>$data, 'a/scriggs.g'=>$data, 'a/base'=>$data, 'base'=>$data, 'base.h'=>$data, 'sample.png'=>$data, 'debian/changelog'=>$data, 'debian/control'=>$data, 'debian/copyright'=>$data, }, 'directory mapping'); license-reconcile-0.4/t/pod-coverage.t0000644000000000000000000000104712207662275014644 0ustar use strict; use warnings; use Test::More; # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok(); license-reconcile-0.4/t/11-rules.t0000644000000000000000000000141412207662275013640 0ustar #!/usr/bin/perl use Test::More tests => 3; use Test::Deep; use Debian::LicenseReconcile::Filter::Rules; my $filter = Debian::LicenseReconcile::Filter::Rules->new( directory=>'t/data/example', config=>{ rules=>[ { License=>'GPL-1', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ], }, files_remaining=>[ 'base', ], name=>'Rules2', ); isa_ok($filter, 'Debian::LicenseReconcile::Filter'); isa_ok($filter, 'Debian::LicenseReconcile::Filter::Rules'); my @data = $filter->get_info; cmp_deeply(\@data, [{ file=>'base', license=>'GPL-1', test=>'Rules2', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }]); license-reconcile-0.4/t/06-filter.t0000644000000000000000000000040612207662275013777 0ustar #!/usr/bin/perl use Test::More tests => 2; use Debian::LicenseReconcile::Filter; use Test::Exception; my $f = Debian::LicenseReconcile::Filter->new; isa_ok($f, 'Debian::LicenseReconcile::Filter'); throws_ok { $f->get_info } qr/not implemented in base class/; license-reconcile-0.4/t/17-kungliga.t0000644000000000000000000000044712207662275014322 0ustar #!/usr/bin/perl use Test::More tests => 1; use Test::Deep; use Debian::LicenseReconcile::CopyrightDatum; use Readonly; Readonly my $DATUM => Debian::LicenseReconcile::CopyrightDatum->new('1997-2000 - Kungliga Tekniska Högskolan'); isa_ok($DATUM, 'Debian::LicenseReconcile::CopyrightDatum'); license-reconcile-0.4/t/00-load.t0000644000000000000000000000240412207662275013423 0ustar #!perl use Test::More tests => 15; use Test::Compile; BEGIN { use_ok( 'Debian::LicenseReconcile' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::Errors' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::App' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::LicenseCheck' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::FormatSpec' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::CopyrightTarget' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::CopyrightDatum' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::CopyrightDatum::Holder' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::Utils' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::Filter' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::Filter::Rules' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::Filter::Std' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::Filter::Shebang' ) || print "Bail out!\n"; use_ok( 'Debian::LicenseReconcile::Filter::ChangeLog' ) || print "Bail out!\n"; } diag( "Testing Debian::LicenseReconcile $Debian::LicenseReconcile::VERSION, Perl $], $^X" ); pl_file_ok('bin/license-reconcile'); license-reconcile-0.4/t/lib/0000755000000000000000000000000012222342225012633 5ustar license-reconcile-0.4/t/lib/TestData.pm0000644000000000000000000000647012222342225014711 0ustar package TestData; use strict; use warnings; use base qw(Exporter); use Readonly; our @EXPORT = qw( $COPYRIGHT_DATA $COPYRIGHT_DATA2 $COPYRIGHT_DATA2u $COPYRIGHT_DATA3 $COPYRIGHT_DATA4 $COPYRIGHT_DATA5 $DLR_ERROR1 $DLR_ERROR2 $DLR_ERROR3 $DLR_ERROR4 $DLR_ERROR5 $DLR_ERROR6 $DLR_ERROR7 $DLR_ERROR8 $DLR_ERROR9 $DLR_ERROR10 ); Readonly our $COPYRIGHT_DATA => { copyright=>' 2010-2011, Nicholas Bamber ', license=>'Artistic or GPL-2+', pattern=>'*', }; Readonly our $COPYRIGHT_DATA2 => { copyright=>' 2011, Nicholas Bamber 2008, Joe Bloggs ', license=>'GPL-3+', pattern=>'a/*.h', }; Readonly our $COPYRIGHT_DATA2u => { copyright=>' 2011, Nicholas Bamber 2008, Joe Bloggs ', license=>'GPL-3+', pattern=>'a/g/*', }; Readonly our $COPYRIGHT_DATA3 => { copyright=>' 2008-2010, gregor hermann 2010-2011, Nicholas Bamber ', license=>'Artistic or GPL-2+', pattern=>'debian/*', }; Readonly our $COPYRIGHT_DATA4 => { copyright=>' 2011, Nicholas Bamber 2009, Damyan Ivanov ', license=>'GPL-1+', pattern=>'a/*.g', }; Readonly our $COPYRIGHT_DATA5 => { copyright=>$COPYRIGHT_DATA4->{copyright}, license=>$COPYRIGHT_DATA4->{license}, pattern=>'a/g/*.t', }; Readonly our $DLR_ERROR1 => { test=>'FormatSpec', msg=>'Cannot recognize format: Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.O/', }; Readonly our $DLR_ERROR2 => { test=>'CopyrightParsing', msg=>'Invalid field given (Flossy) at /usr/share/perl5/Debian/Copyright.pm line 142. ', }; Readonly our $DLR_ERROR3 => { test=>'License mismatch', msg=>'File base.h has license GPL-2 which does not match Artistic or GPL-2+.', }; Readonly our $DLR_ERROR4 => { test=>'Copyright mismatch', msg=>"File base.h: Trying to match 'Periapt Technologies.' against 'Nicholas Bamber ' but it does not look like a good match.", }; Readonly our $DLR_ERROR5 => { test=>'License mismatch', msg=>'File debian/control has license GPL-2+ which does not match Artistic or GPL-2+.', }; Readonly our $DLR_ERROR6 => { test=>'Copyright mismatch', msg=>"File debian/control: Trying to match 'Christian Schwarz ' against 'gregor hermann ' but it does not look like a good match.", }; Readonly our $DLR_ERROR7 => { test=>'License mismatch', msg=>"File debian/copyright has license GPL-2+ which does not match Artistic or GPL-2+.", }; Readonly our $DLR_ERROR8 => { test=>'Copyright mismatch', msg=>"File debian/copyright: Trying to match 'Christian Schwarz ' against 'gregor hermann ' but it does not look like a good match.", }; Readonly our $DLR_ERROR9 => { test=>'License mismatch', msg=>"File debian/changelog has license GPL-2+ which does not match Artistic or GPL-2+.", }; Readonly our $DLR_ERROR10 => { test=>'Copyright mismatch', msg=>"File debian/changelog: Trying to match 'Christian Schwarz ' against 'gregor hermann ' but it does not look like a good match.", }; 1 license-reconcile-0.4/t/09-nolicense.t0000644000000000000000000000074712207662275014504 0ustar #!/usr/bin/perl use Test::More tests => 2; use Test::Deep; use Debian::LicenseReconcile::LicenseCheck; use Readonly; Readonly my $LICENSECHECK => Debian::LicenseReconcile::LicenseCheck->new('t/data', [], 1); isa_ok($LICENSECHECK, 'Debian::LicenseReconcile::LicenseCheck'); my @data = $LICENSECHECK->get_info('nolicense.c'); cmp_deeply(\@data, [{ file=>'nolicense.c', copyright=>['Copyright: 1992, 1993 The Regents of the University of California. All rights reserved'], }]); license-reconcile-0.4/t/01-errors.t0000644000000000000000000000055312207662275014024 0ustar #!/usr/bin/perl use Test::More tests => 20; use Debian::LicenseReconcile::Errors; for(my $i = 0; $i < 10; $i++) { is(Debian::LicenseReconcile::Errors->how_many,$i,'how many'); my $digest = join '', (map { $_->{text} } Debian::LicenseReconcile::Errors->list); is($digest, 'x' x $i, 'digest'); Debian::LicenseReconcile::Errors->push(text=>'x'); } license-reconcile-0.4/t/08-map_directory.t0000644000000000000000000000434612207662275015364 0ustar #!/usr/bin/perl use Test::More tests => 7; use Test::Deep; use Debian::LicenseReconcile::Errors; use Debian::LicenseReconcile::CopyrightTarget; use File::Slurp; use lib qw(t/lib); use TestData; is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); my @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [], 'initial state'); my $copyright = Debian::LicenseReconcile::CopyrightTarget->new; isa_ok($copyright, 'Debian::LicenseReconcile::CopyrightTarget'); isa_ok($copyright->parse(scalar read_file('t/data/example/debian/copyright')),'Debian::LicenseReconcile::CopyrightTarget'); is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [], 'initial state'); my $data = { copyright=>' 2010-2011, Nicholas Bamber ', license=>'Artistic or GPL-2+', pattern=>'*', }; my $data2 = { copyright=>' 2011, Nicholas Bamber 2008, Joe Bloggs ', license=>'GPL-3+', pattern=>'a/*.h', }; my $data2u = { copyright=>' 2011, Nicholas Bamber 2008, Joe Bloggs ', license=>'GPL-3+', pattern=>'a/g/*', }; my $data3 = { copyright=>' 2008-2010, gregor hermann 2010-2011, Nicholas Bamber ', license=>'Artistic or GPL-2+', pattern=>'debian/*', }; my $data4 = { copyright=>' 2011, Nicholas Bamber 2009, Damyan Ivanov ', license=>'GPL-1+', pattern=>'a/*.g', }; my $data5 = { copyright=>$data4->{copyright}, license=>$data4->{license}, pattern=>'a/g/*.t', }; cmp_deeply($copyright->map_directory('t/data/example'), { 'a/0.h'=>$COPYRIGHT_DATA2, 'a/1.h'=>$COPYRIGHT_DATA2, 'a/2.h'=>$COPYRIGHT_DATA2, 'a/3.h'=>$COPYRIGHT_DATA2, 'a/base'=>$COPYRIGHT_DATA, 'a/g/blah'=>$COPYRIGHT_DATA2u, 'a/g/scriggs.t'=>$COPYRIGHT_DATA5, 'a/scriggs.g'=>$COPYRIGHT_DATA4, 'base'=>$COPYRIGHT_DATA, 'sample.png'=>$COPYRIGHT_DATA, 'base.h'=>$COPYRIGHT_DATA, 'debian/changelog'=>$COPYRIGHT_DATA3, 'debian/control'=>$COPYRIGHT_DATA3, 'debian/copyright'=>$COPYRIGHT_DATA3, }, 'directory mapping'); license-reconcile-0.4/t/09-licensecheck.t0000644000000000000000000000217312207662275015140 0ustar #!/usr/bin/perl use Test::More tests => 7; use Test::Deep; use Test::NoWarnings; use Debian::LicenseReconcile::Filter::Std; use Debian::LicenseReconcile::LicenseCheck; use Readonly; Readonly my $LICENSECHECK => Debian::LicenseReconcile::LicenseCheck->new('t/data/example', [], 1); my $filter = Debian::LicenseReconcile::Filter::Std->new( licensecheck=>$LICENSECHECK, name=>'Std2', ); isa_ok($filter, 'Debian::LicenseReconcile::Filter'); isa_ok($filter, 'Debian::LicenseReconcile::Filter::Std'); my @data = $filter->get_info; cmp_deeply(\@data, [{ file=>'base.h', license=>'GPL-2', test=>'Std2', copyright=>['Copyright: 2011, Periapt Technologies. All rights reserved'], }]); Readonly my $LICENSECHECK2 => Debian::LicenseReconcile::LicenseCheck->new('t/data/example', [], 0); my $filter2 = Debian::LicenseReconcile::Filter::Std->new( licensecheck=>$LICENSECHECK2, name=>'Std2', ); isa_ok($filter2, 'Debian::LicenseReconcile::Filter'); isa_ok($filter2, 'Debian::LicenseReconcile::Filter::Std'); @data = $filter2->get_info; cmp_deeply(\@data, [{ file=>'base.h', license=>'GPL-2', test=>'Std2', }]); license-reconcile-0.4/t/pod.t0000644000000000000000000000035012207662275013047 0ustar #!perl -T use strict; use warnings; use Test::More; # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp"; plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; all_pod_files_ok(); license-reconcile-0.4/t/version.t0000644000000000000000000000156512222342225013746 0ustar #!/usr/bin/perl -wl use Test::More; use File::Basename; my $basedir = dirname($0).'/..'; my $debian_changelog_version = `head -1 $basedir/debian/changelog | awk -F'[ ()]+' '{print \$2}'`; chomp($debian_changelog_version); foreach my $file (map { "$basedir/$_" } ('lib/Debian/LicenseReconcile.pm', glob('lib/Debian/LicenseReconcile/*.pm'), glob('lib/Debian/LicenseReconcile/*/*.pm'))) { my $pm_version = `egrep '^our .VERSION' $file`; eval($pm_version); is( $VERSION, $debian_changelog_version, "Version number in debian/changelog and \$VERSION in $file are the same" ); my $pod_version = `egrep '^Version [0-9]' $file`; my @v = split(/\s+/, $pod_version); is( $v[1], $debian_changelog_version, "Version numbers in debian/changelog and POD of $file are the same" ); } done_testing; license-reconcile-0.4/t/03-parse.t0000644000000000000000000000136212207662275013623 0ustar #!/usr/bin/perl use Test::More tests => 6; use Test::Deep; use Debian::LicenseReconcile::Errors; use Debian::LicenseReconcile::CopyrightTarget; is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); my @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [], 'initial state'); my $copyright = Debian::LicenseReconcile::CopyrightTarget->new; isa_ok($copyright, 'Debian::LicenseReconcile::CopyrightTarget'); is($copyright->parse("Blah: hello\n"), undef, 'failed parse'); is(Debian::LicenseReconcile::Errors->how_many,1,'how many'); @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ { test=>'CopyrightParsing', msg=>"Got copyright stanza with unrecognised field\n", }, ], 'bad copyright'); license-reconcile-0.4/t/09-tty.t0000644000000000000000000000066712207662275013346 0ustar #!/usr/bin/perl use Test::More tests => 2; use Test::Deep; use Debian::LicenseReconcile::LicenseCheck; use Readonly; Readonly my $LICENSECHECK => Debian::LicenseReconcile::LicenseCheck->new('t/data', [], 1); isa_ok($LICENSECHECK, 'Debian::LicenseReconcile::LicenseCheck'); my @data = $LICENSECHECK->get_info('tty.c'); cmp_deeply(\@data, [{ file=>'tty.c', license=>'BSD-3-clause', copyright=>['Copyright: 1992, 1993'], }]); license-reconcile-0.4/t/13-rules-contains.t0000644000000000000000000000322412207662275015457 0ustar #!/usr/bin/perl use Test::More tests => 3; use Test::Deep; use Debian::LicenseReconcile::Utils qw(get_files); use Debian::LicenseReconcile::Filter::Rules; use Readonly; Readonly my $DIR => 't/data/example'; my @files = get_files($DIR); my $filter = Debian::LicenseReconcile::Filter::Rules->new( directory=>$DIR, name=>'Rules4', config=>{ rules=>[ { Glob=>'*b*', Contains=><<'EOS', /* Copyright (c) 2012, Periapt Technologies. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ EOS License=>'GPL-1', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ], }, files_remaining=>\@files, ); isa_ok($filter, 'Debian::LicenseReconcile::Filter'); isa_ok($filter, 'Debian::LicenseReconcile::Filter::Rules'); my @data = $filter->get_info; cmp_deeply(\@data, [{ file=>'base', license=>'GPL-1', test=>'Rules4', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }]); license-reconcile-0.4/t/17-copyright.t0000644000000000000000000000757312222342225014523 0ustar #!/usr/bin/perl use Test::More tests => 40; use Test::Deep; use Debian::LicenseReconcile::CopyrightDatum; use Debian::LicenseReconcile::Errors; my $d = Debian::LicenseReconcile::CopyrightDatum->new; isa_ok($d, 'Debian::LicenseReconcile::CopyrightDatum'); is($d->contains($d), 1, 'contains'); is($d->contains($d, 'no better than a default'), 1, 'contains'); my @dk = $d->copyright_holders; cmp_deeply(\@dk, [], 'copyright holders'); is($d->years(''), undef, 'years'); my $test = 'blah'; my $copyright = \'blah'; is($d->contains($copyright, \$test), 0); is($$copyright, 'blah'); like($test, qr/1 cannot be fitted into 0:/); undef $copyright; is($d->contains($copyright, \$test), 0, 'undefined other'); is($copyright, undef); is($test, 'The other copyright data was undefined.'); my $d3=Debian::LicenseReconcile::CopyrightDatum->new(' '); isa_ok($d3, 'Debian::LicenseReconcile::CopyrightDatum'); my @dk3 = $d3->copyright_holders; cmp_deeply(\@dk3, [], 'copyright holders'); my $d4=Debian::LicenseReconcile::CopyrightDatum->new('X'); isa_ok($d4, 'Debian::LicenseReconcile::CopyrightDatum'); my @dk4 = $d4->copyright_holders; cmp_deeply(\@dk4, ['X'], 'copyright holders'); isa_ok($d4->years('X'), 'Set::IntSpan'); ok($d4->years('X')->empty, 'empty set of years'); my $text=<<'EOS'; 1997, 1999-2006, Blah Wah Ltd 1996-1998, 2001, Woo Goo & Co EOS my $d5=Debian::LicenseReconcile::CopyrightDatum->new($text); isa_ok($d5, 'Debian::LicenseReconcile::CopyrightDatum'); my @dk5 = $d5->copyright_holders; cmp_deeply(\@dk5, bag('Woo Goo & Co','Blah Wah Ltd'), 'copyright holders'); isa_ok($d5->years('Woo Goo & Co'), 'Set::IntSpan'); isa_ok($d5->years('Blah Wah Ltd'), 'Set::IntSpan'); my $woo_years = $d5->years('Woo Goo & Co')->elements; cmp_deeply($woo_years,[1996,1997,1998,2001], 'woo years'); my $blah_years = $d5->years('Blah Wah Ltd')->elements; cmp_deeply($blah_years,[1997,1999,2000,2001,2002,2003,2004,2005,2006], 'blah years'); my $test2='haha'; is($d5->contains('2005, Microflop Inc', \$test2), 0); is($test2, "Trying to match 'Microflop Inc' against 'Woo Goo & Co' but it does not look like a good match."); $test2='haha'; is($d5->contains('2005, WiooGoo $ Coc', \$test2), 0); is($test2, "For copyright holder 'WiooGoo \$ Coc' (which looks like 'Woo Goo & Co') the years 2005 cannot be fitted into 1996-1998,2001."); $test2='haha'; is($d5->contains('1997,1999, Blah Wah Ltd', \$test2), 1); is($test2, 'haha'); is($d5->contains('1998, Blah Wah Ltd', \$test2), 0); is($test2, "For copyright holder 'Blah Wah Ltd' the years 1998 cannot be fitted into 1997,1999-2006."); my $text2=<<'EOS'; 1997, 1999-2006, Blah1 Wah Ltd 1997, 1999-2006, Blah Wah8 Ltd EOS $test2='haha'; is($d5->contains($text2, \$test2), 0); like($test2, qr/Was trying to match 'Blah1? Wah8? Ltd' to 'Blah Wah Ltd', but 'Blah1? Wah8? Ltd' would match as well so giving up\./, "Does not match: '$test2'"); my $text3=<<'EOS'; 1997, 1999-2006, Blah4 Wah Ltd 1996-1998, 2001, Blah WaT Ltd EOS my $d6=Debian::LicenseReconcile::CopyrightDatum->new($text3); $test2='haha'; is($d6->contains($text, \$test2), 0); like($test2, qr/Was trying to match 'Blah Wah Ltd' to 'Blah4? Wa[hT] Ltd', but 'Blah4? Wa[hT] Ltd' would be matched as well so giving up\./, "Does not match: '$test2'"); is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); my $text4='Copyright: 1997--1998 Jan Pazdziora, adelton@fi.muni.cz'; my $d7=Debian::LicenseReconcile::CopyrightDatum->new($text4); $test2='haha'; is($d7->contains('1997-1998 Jan Pazdziora, adelton@fi.muni.cz', \$test2), 0); is($test2, "For copyright holder 'Jan Pazdziora, adelton\@fi.muni.cz' the years 1997-1998 cannot be fitted into -."); is(Debian::LicenseReconcile::Errors->how_many,1,'how many'); my @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [ { test=>'Copyright parsing', msg=>"Trying to parse 1997--1998: Set::IntSpan::_copy_run_list: Bad order 2: 1997--1998", }, ], 'bad copyright'); license-reconcile-0.4/t/09-wtfpl.t0000644000000000000000000000071212207662275013651 0ustar #!/usr/bin/perl use Test::More tests => 2; use Test::Deep; use Debian::LicenseReconcile::LicenseCheck; use Readonly; Readonly my $LICENSECHECK => Debian::LicenseReconcile::LicenseCheck->new('t/data', [], 1); isa_ok($LICENSECHECK, 'Debian::LicenseReconcile::LicenseCheck'); my @data = $LICENSECHECK->get_info('wtfpl'); cmp_deeply(\@data, [{ file=>'wtfpl', license=>'WTFPL', copyright=>['Copyright: 2004 Sam Hocevar '], }]); license-reconcile-0.4/t/17-rltty.t0000644000000000000000000000333212207662275013673 0ustar #!/usr/bin/perl use Test::More tests => 8; use Test::Deep; use Debian::LicenseReconcile::CopyrightDatum; use Debian::LicenseReconcile::LicenseCheck; use Debian::LicenseReconcile::Filter::Rules; use Readonly; Readonly my $LICENSECHECK => Debian::LicenseReconcile::LicenseCheck->new('t/data', [], 1); Readonly my $RAW_DATA => $LICENSECHECK->get_info('rltty.c'); Readonly my $DATUM => Debian::LicenseReconcile::CopyrightDatum->new($RAW_DATA->{copyright}); isa_ok($DATUM, 'Debian::LicenseReconcile::CopyrightDatum'); cmp_deeply($DATUM->as_hash, { 'Free Software Foundation, Inc' => methods(min=>1992,max=>2005,size=>14), }); my $filter = Debian::LicenseReconcile::Filter::Rules->new( directory=>'t/data/', config=>{ rules=>[ {}, ], }, files_remaining=>[ 'rltty.c', ], licensecheck=>$LICENSECHECK, name=>'Rules3', ); isa_ok($filter, 'Debian::LicenseReconcile::Filter'); isa_ok($filter, 'Debian::LicenseReconcile::Filter::Rules'); my @data = $filter->get_info; cmp_deeply(\@data, [{ file=>'rltty.c', license=>'GPL-2+', test=>'Rules3', copyright=>['Copyright: 1992-2005 Free Software Foundation, Inc'], }]); $filter = Debian::LicenseReconcile::Filter::Rules->new( directory=>'t/data/', config=>{ rules=>[ { License=>'Apache-2.0', }, ], }, files_remaining=>[ 'rltty.c', ], licensecheck=>$LICENSECHECK, name=>'Rules4', ); isa_ok($filter, 'Debian::LicenseReconcile::Filter'); isa_ok($filter, 'Debian::LicenseReconcile::Filter::Rules'); @data = $filter->get_info; cmp_deeply(\@data, [{ file=>'rltty.c', license=>'Apache-2.0', test=>'Rules4', copyright=>['Copyright: 1992-2005 Free Software Foundation, Inc'], }]); license-reconcile-0.4/t/04-parse.t0000644000000000000000000000213212207662275013620 0ustar #!/usr/bin/perl use Test::More tests => 5; use Test::Deep; use Debian::LicenseReconcile::Errors; use Debian::LicenseReconcile::CopyrightTarget; use File::Slurp; is(Debian::LicenseReconcile::Errors->how_many,0,'how many'); my @list = Debian::LicenseReconcile::Errors->list; cmp_deeply(\@list, [], 'initial state'); my $copyright = Debian::LicenseReconcile::CopyrightTarget->new; isa_ok($copyright, 'Debian::LicenseReconcile::CopyrightTarget'); isa_ok($copyright->parse(scalar read_file('t/data/copyright')),'Debian::LicenseReconcile::CopyrightTarget'); my $data = { copyright=>' 2010-2011, Nicholas Bamber ', license=>'Artistic or GPL-2+', pattern=>'*', }; cmp_deeply($copyright->map_directory('t/data/example'), { 'a/0.h'=>$data, 'a/1.h'=>$data, 'a/2.h'=>$data, 'a/3.h'=>$data, 'a/base'=>$data, 'a/g/blah'=>$data, 'a/g/scriggs.t'=>$data, 'a/scriggs.g'=>$data, 'base'=>$data, 'base.h'=>$data, 'sample.png'=>$data, 'debian/changelog'=>$data, 'debian/control'=>$data, 'debian/copyright'=>$data, }, 'directory mapping'); license-reconcile-0.4/t/14-rules-mmagic.t0000644000000000000000000000256012207662275015101 0ustar #!/usr/bin/perl use Test::More tests => 3; use Test::Deep; use Debian::LicenseReconcile::Utils qw(get_files); use Debian::LicenseReconcile::Filter::Rules; use Readonly; Readonly my $DIR => 't/data/example'; my @files = get_files($DIR); my $filter = Debian::LicenseReconcile::Filter::Rules->new( directory=>$DIR, name=>'Rules5', config=>{ rules=>[ { MMagic=>'application/octet-stream', License=>'BSD', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, { Glob=>'b*s?', MMagic=>'text/plain', License=>'GPL-1', Copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ], }, files_remaining=>\@files, ); isa_ok($filter, 'Debian::LicenseReconcile::Filter'); isa_ok($filter, 'Debian::LicenseReconcile::Filter::Rules'); my @data = sort { $a->{file} cmp $b->{file} } $filter->get_info; cmp_deeply(\@data, [ { file=>'base', license=>'GPL-1', test=>'Rules5', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, { file=>'sample.png', license=>'BSD', test=>'Rules5', copyright=>'[Copyright: 2012, Periapt Technologies. All rights reserved]', }, ]); license-reconcile-0.4/Makefile.PL0000644000000000000000000000114712207662275013614 0ustar # Note: this file was auto-generated by Module::Build::Compat version 0.40 require 5.006; use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'Debian::LicenseReconcile', 'VERSION_FROM' => 'lib/Debian/LicenseReconcile/FormatSpec.pm', 'PREREQ_PM' => { 'Debian::Copyright' => '0.2', 'File::Slurp' => 0, 'Test::Compile' => 0, 'Test::More' => 0, 'Tree::RedBlack' => 0 }, 'INSTALLDIRS' => 'site', 'EXE_FILES' => [ 'bin/license-reconcile' ], 'PL_FILES' => {} ) ; license-reconcile-0.4/TODO0000644000000000000000000000237112207662275012332 0ustar *.) Need useful information in verbose mode *.) could have a Perl specific filter. It might operate just like Rules but extract likely looking Pod sections into a temp file and run stuff on that. Or could be incorporated into Rules. *) should exclude swap files etc 4.) test coverage *) config should be below debian/source actually and we should be cleverer about the name. *.) Max relative width should be configurable 4.) Need a Dh_Sequence as well. 11.) exclude files from mapping configurably 6.) Could do with a man page for the config file format. 13.) floundered on bwctl format spec - double space after the colon. *) expose --check and --exclude licensecheck options *) file permissions rule clause *) allow rules to read only the first N bytes - but benchmark *) Look at alternatives to Text::LevenshteinXS and Set::IntSpan such as Set::IntSpan::Fast::XS and benchmark. Use Class::Load::load_first_existing_class and thank mst. or Class::Load::XS 9.) allow the filter sequence to be explicitly set in the config file. *) Should also allow these classes to be configured. This would require a Debian::LicenseReconcile::CopyrightDatum::Config (to be loaded first) and Debian::LicenseReconcile::CopyrightDatum only to be loaded when needed (which is good anyway).