[license-reconcile] 01/01: Added support for Artistic-2.0, GPL-3 and GPL-3+
Nicholas Bamber
periapt at moszumanska.debian.org
Mon Nov 16 17:27:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
periapt pushed a commit to branch master
in repository license-reconcile.
commit 91f29bac653d815bf0c930de05eecca155563016
Author: Nicholas Bamber <nicholas at periapt.co.uk>
Date: Mon Nov 16 17:23:45 2015 +0000
Added support for Artistic-2.0, GPL-3 and GPL-3+
* Added support for Artistic-2.0, GPL-3 and GPL-3+
* Added --suggest-stanzas option
---
bin/license-reconcile | 14 +++++++--
debian/changelog | 3 +-
debian/license-reconcile.bash-completion | 53 ++++++++++++++++++++++++++++++++
lib/Debian/LicenseReconcile/App.pm | 27 ++++++++++++++--
4 files changed, 91 insertions(+), 6 deletions(-)
diff --git a/bin/license-reconcile b/bin/license-reconcile
index 054a294..eeeb989 100755
--- a/bin/license-reconcile
+++ b/bin/license-reconcile
@@ -11,9 +11,13 @@ my $help = 0;
# If this is set we don't actually report errors
# at all, but merely succeed or fail.
-# TODO: abstract output to allow flexibility of reporting
my $quiet = 0;
+# If set output suggested DEP-5 Stanzas
+my $suggest_stanzas = 0;
+
+# TODO: abstract output to allow flexibility of reporting
+
# TODO: What's this again?
my $display_mapping = 0;
my $check_copyright = 1;
@@ -45,6 +49,7 @@ GetOptions(
'config-file=s' => \$config_file,
'changelog-file=s' => \$changelog_file,
'check-copyright!' => \$check_copyright,
+ 'suggest-stanzas!' => \$suggest_stanzas,
'filters=s@' => sub {
shift; # name of option
my $value = shift;
@@ -74,6 +79,7 @@ my $app = Debian::LicenseReconcile::App->new(
filters => \@filters,
format_spec => $format_spec,
files => $files,
+ suggest_stanzas => $suggest_stanzas,
);
exit($app->run);
@@ -94,7 +100,7 @@ license-reconcile - reconcile debian/copyright against source
B<license-reconcile> B<--help>|B<--man>
-B<license-reconcile> [B<--copyright-file=>I<file>] [B<--no-check-copyright>] [B<--no-format-spec>] [B<--quiet>] [B<--display-mapping>] [B<--directory=>I<directory>] [B<--filters=>I<module1 module2 ...>] [B<--config-file=>I<file>] [B<--changelog-file=>I<file>] [I<files...>]
+B<license-reconcile> [B<--copyright-file=>I<file>] [B<--no-check-copyright>] [B<--suggest-stanzas>] [B<--no-format-spec>] [B<--quiet>] [B<--display-mapping>] [B<--directory=>I<directory>] [B<--filters=>I<module1 module2 ...>] [B<--config-file=>I<file>] [B<--changelog-file=>I<file>] [I<files...>]
=head1 DESCRIPTION
@@ -241,6 +247,10 @@ The Debian changelog file which defaults to C<debian/changelog>. The Rules filte
uses this to get the current version and the ChangeLog filter gets its data
from it.
+=head2 B<--suggest-stanzas>
+
+If set print out the license and copyright data in DEP-5 format.
+
=head1 Filters
By default the filters are processed in the order below. Once a file has been
diff --git a/debian/changelog b/debian/changelog
index ce38cc1..36a1369 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ license-reconcile (0.9) UNRELEASED; urgency=medium
* Code reviewed: bin/license-reconcile [in progress]
* Allow file aguments to restrict activity to stated files
* Added bash completion file
+ * Added support for Artistic-2.0, GPL-3 and GPL-3+
+ * Added --suggest-stanzas option
-- Nicholas Bamber <nicholas at periapt.co.uk> Sat, 07 Nov 2015 23:55:16 +0000
@@ -25,7 +27,6 @@ license-reconcile (0.8) unstable; urgency=medium
* Corrected sequence of filters and commented
* Replaced examples directory with list of projects in the documentation
* Updated debian/license-reconcile.yml
- * Added support for Artistic-2.0, GPL-3 and GPL-3+
-- Nicholas Bamber <nicholas at periapt.co.uk> Thu, 05 Nov 2015 15:44:47 +0000
diff --git a/debian/license-reconcile.bash-completion b/debian/license-reconcile.bash-completion
new file mode 100644
index 0000000..3ba7fa5
--- /dev/null
+++ b/debian/license-reconcile.bash-completion
@@ -0,0 +1,53 @@
+_license_reconcile()
+{
+ local cur prev words cword _DC_FILE
+ _init_completion || return
+
+ case $prev in
+ --copyright-file)
+ _DC_FILE=debian/copyright
+ if [[ -r $_DC_FILE && $_DC_FILE =~ ^$cur ]]
+ then
+ COMPREPLY=( $_DC_FILE )
+ return 0
+ fi
+ _filedir
+ return 0
+ ;;
+ --changelog-file)
+ _DC_FILE=debian/changelog
+ if [[ -r $_DC_FILE && $_DC_FILE =~ ^$cur ]]
+ then
+ COMPREPLY=( $_DC_FILE )
+ return 0
+ fi
+ _filedir
+ return 0
+ ;;
+ --config-file)
+ _DC_FILE=debian/license-reconcile.yml
+ if [[ -r $_DC_FILE && $_DC_FILE =~ ^$cur ]]
+ then
+ COMPREPLY=( $_DC_FILE )
+ return 0
+ fi
+ _filedir
+ return 0
+ ;;
+ --directory)
+ _filedir -d
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--copyright-file --no-check-copyright
+ --no-format-spec --quiet --suggest-stanzas --display-mapping --directory --filters
+ --config-file --changelog-file' -- "$cur" ) )
+ else
+ _filedir
+ fi
+
+ return 0
+}
+complete -F _license_reconcile license-reconcile
diff --git a/lib/Debian/LicenseReconcile/App.pm b/lib/Debian/LicenseReconcile/App.pm
index 5c3ff20..03085a3 100644
--- a/lib/Debian/LicenseReconcile/App.pm
+++ b/lib/Debian/LicenseReconcile/App.pm
@@ -16,6 +16,7 @@ use Class::XSAccessor
filters => 'filters',
format_spec => 'format_spec',
files=>'files',
+ suggest_stanzas=> 'suggest_stanzas',
},
;
use File::Slurp;
@@ -118,6 +119,7 @@ sub run {
Readonly my $CONFIG => $self->_parse_config;
Readonly my $LICENSECHECK => $self->_build_licensecheck($CONFIG);
Readonly my $COPYRIGHT_TARGET => $self->_read_copyright_file;
+ my $file_checked = {};
if ($COPYRIGHT_TARGET) {
Readonly my $FILE_MAPPING => $self->_build_file_mapping($COPYRIGHT_TARGET);
@@ -125,7 +127,6 @@ sub run {
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,
@@ -139,6 +140,26 @@ sub run {
}
}
+
+ if ($self->suggest_stanzas) {
+ foreach my $f (sort keys %$file_checked) {
+ print "Files: $f\n";
+ if ($self->check_copyright) {
+ my @copyright = @{$file_checked->{$f}->{copyright}};
+ if (1 == scalar @copyright) {
+ print "Copyright: $copyright[0]\n";
+ }
+ else {
+ foreach my $line (@copyright) {
+ print " $line\n";
+ }
+ }
+ }
+ print "License: $file_checked->{$f}->{license}\n";
+ print "\n";
+ }
+ }
+
return $self->_report_errors;
}
@@ -172,7 +193,7 @@ sub _run_filter {
foreach my $titbit ($test->get_info) {
next if $file_checked->{$titbit->{file}};
next if $self->files and not exists $self->files->{$titbit->{file}};
- $file_checked->{$titbit->{file}} = 1;
+ $file_checked->{$titbit->{file}} = $titbit;
if (exists $file_mapping->{$titbit->{file}}) {
$reconcile->check(
$titbit,
@@ -270,7 +291,7 @@ Nicholas Bamber, C<< <nicholas at periapt.co.uk> >>
=head1 LICENSE AND COPYRIGHT
-Copyright 2012, 2015, Nicholas Bamber C<< <nicholas at periapt.co.uk> >>.
+Copyright 2012, 2015, Nicholas Bamber <nicholas at periapt.co.uk> .
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
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/license-reconcile.git
More information about the Pkg-perl-cvs-commits
mailing list