Hi, first, I'd like to stress that my motivation is making clear for myself several important (from my point of view) points and improvement of dh-make-elpa.
The point I'd like to focus attention to is licensing of dh-make-elpa. Currently, it is licensed under GPL-3+. It is based (and I'd say heavily based) on dh-make-perl, which is licensed under GPL-2-only. I've asked Sean Whitton about it on IRC and got the following answer: 23:45 < spwhitton> dogsleg: we don't actually derive code from dh-make-perl -- dh-make-perl's code is included as a library. so I think the licensing is okay. 23:45 < spwhitton> dogsleg: there are very small number of lines that are actually copied directly; probably less than copyrightable. I cannot agree with this summing-up. Namely, I cannot understand what proportion of code should be to be considered copyrightable. As it is put in manpages of dh-make-elpa(1), "a great deal of the library code used by dh-make-elpa, and its object-oriented structure, comes from dh-make-perl(1), written and maintained by the Debian Perl Group." First, it is not clear what constitutes a library here. In case a library is contents of lib/ directory, then almost all code of dh-make-elpa is a library, right? Since dh-make-elpa itself contains 114 lines, where only about 10 lines are code (including some empty lines for better readability). And even these lines of code are essentially the same as in dh-make-perl minus Perl/ELPA difference. Second, classes from DhMakePerl are in fact used in DhMakeELPA (as base classes): $ rgrep DhMakePerl lib/DhMakeELPA/Config.pm:use base 'DhMakePerl::Config'; lib/DhMakeELPA/Command/Packaging.pm:use base 'DhMakePerl::Command::Packaging'; Nevertheless, let's take a look into some code. For example, DhMakeELPA.pm. It contains only one subroutine, run, and the difference with the same subroutine from DhMakePerl.pm is as follows: sub run { my ( $class, %c ) = @_; unless ( $c{cfg} ) { - my $cfg = DhMakeELPA::Config->new; + my $cfg = DhMakePerl::Config->new; $cfg->parse_command_line_options; + $cfg->parse_config_file; $c{cfg} = $cfg; } my $cmd_mod = $c{cfg}->command; $cmd_mod =~ s/-/_/g; - require "DhMakeELPA/Command/$cmd_mod.pm"; + require "DhMakePerl/Command/$cmd_mod.pm"; $cmd_mod =~ s{/}{::}g; - $cmd_mod = "DhMakeELPA::Command::$cmd_mod"; + $cmd_mod = "DhMakePerl::Command::$cmd_mod"; my $self = $cmd_mod->new( \%c ); return $self->execute; } So, since almost the whole DhMakeELPA.pm is an edited copy of DhMakePerl, is this part of code copyrightable? If so, then it should come under GPL-2-only umbrella, not GPL-3+. One can find the same situation for other subroutines, which are not ELPA-specific, e. g. parse_command_line_options from DhMakeELPA/Config.pm. Let me stress that I'd consider ELPA-specific code as original though. Let me be clear on my motivation. Because of object-oriented structure of dh-make-elpa the most straightforward way to fix #903164 in a proper way would be to copy help.pm (s/Perl/ELPA/g and s/perl/elpa/g) and relevant parts of DhMakePerl/Config.pm, as it done in the attached patch. The main problem for me is that I just cannot take the code from GPL-2-only software and paste it almost without changes in GPL-3+ software. I agree that it is possible to implement help command and, say, refresh command in some other way (or even ways), but it will create a non-necessary delta between dh-make-elpa and dh-make-perl, will not be that relevant to the current object-oriented structure of dh-make-elpa, and will require investing additional time where it is not needed. I would love to contribute to dh-make-elpa, but what I consider a license conflict stops me from this. Regards, Lev Lamberov ===File /home/dogsleg/freedom/packaging/elpa/WIP/dh-make-elpa/0001-Copy-edit-help-implementation-from-dh-make-perl-Clos.patch=== >From fab6476fb076a03e73aa190cd9e80f45ecb16551 Mon Sep 17 00:00:00 2001 From: Lev Lamberov <dogs...@debian.org> Date: Mon, 20 Aug 2018 15:24:05 +0500 Subject: [PATCH] Copy-edit help implementation from dh-make-perl (Closes: #903164) --- dh-make-elpa | 2 ++ lib/DhMakeELPA/Command/help.pm | 62 ++++++++++++++++++++++++++++++++++ lib/DhMakeELPA/Config.pm | 37 ++++++++++++++++++-- 3 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 lib/DhMakeELPA/Command/help.pm diff --git a/dh-make-elpa b/dh-make-elpa index a8d0647..c1d4ebb 100755 --- a/dh-make-elpa +++ b/dh-make-elpa @@ -21,6 +21,8 @@ __END__ =item dh-make-elpa [--pkg-emacsen] [make] +=item dh-make-elpa help + =back =head1 DESCRIPTION diff --git a/lib/DhMakeELPA/Command/help.pm b/lib/DhMakeELPA/Command/help.pm new file mode 100644 index 0000000..a790091 --- /dev/null +++ b/lib/DhMakeELPA/Command/help.pm @@ -0,0 +1,62 @@ +package DhMakeELPA::Command::help; + +=head1 NAME + +DhMakeELPA::Command::help - dh-make-elpa help implementation + +=head1 DESCRIPTION + +This module implements the I<help> command of L<dh-make-elpa(1)>. + +=cut + +use strict; +use warnings; + +use base 'DhMakeELPA'; +use Pod::Usage; + +=head1 METHODS + +=over + +=item execute + +Provides I<help> command implementation. + +=cut + +sub execute { + my $self = shift; + + # Help requested? Nice, we can just die! Isn't it helpful? + die pod2usage( -message => "See `man 1 dh-make-elpa' for details.\n" ) +} + +=back + +=cut + +1; + +=head1 COPYRIGHT & LICENSE + +=over + +=item Copyright (C) 2008, 2009, 2010 Damyan Ivanov <d...@debian.org> + +=back + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License version 2 as published by the Free +Software Foundation. + +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 +Street, Fifth Floor, Boston, MA 02110-1301 USA. + +=cut diff --git a/lib/DhMakeELPA/Config.pm b/lib/DhMakeELPA/Config.pm index 7820191..275bc2d 100644 --- a/lib/DhMakeELPA/Config.pm +++ b/lib/DhMakeELPA/Config.pm @@ -17,7 +17,7 @@ DhMakeELPA::Config - dh-make-elpa configuration class my @OPTIONS = ( 'pkg-emacsen!', 'version=s' ); -my @COMMANDS = ( 'make' ); +my @COMMANDS = ( 'make', 'help' ); # black magic from dh-make-perl: __PACKAGE__->mk_accessors( @@ -56,8 +56,39 @@ sub parse_command_line_options { $self->_explicitly_set->{$k} = 1; } - # TODO - $self->command("make"); + %opts = (); + Getopt::Long::Configure('no_pass_through'); + GetOptions( \%opts, @COMMANDS ) + or die "Error parsing command-line options\n"; + + if (%opts) { + my $cmd = ( keys %opts )[0]; + warn "WARNING: please, don't use double dashes in front of sub-commands\n"; + } + else { + my %cmds; + for (@COMMANDS) { + my $c = $_; + $c =~ s/\|.+//; + $cmds{$c} = 1; + } + + # treat the first non-option as command + # if it looks like one + $opts{ shift(@ARGV) } = 1 + if $ARGV[0] + and $cmds{ $ARGV[0] }; + + # by default, create source package + $opts{make} = 1 unless %opts; + } + + if ( scalar( keys %opts ) > 1 ) { + die "Only one of " . + join(', ', @COMMANDS ) . " can be specified\n"; + } + + $self->command( ( keys %opts )[0] ); } 1; -- 2.18.0 ============================================================