Subject: | EU::MM doesn't support the META.yml licence tag |
There was a discussion in late 2003
http://www.mail-archive.com/makemaker@perl.org/msg01409.html
and I've provided the attached patch, which was never applied.
Here's part of the discussion:
Show quoted text
> On Sun, Dec 14, 2003 at 01:17:49AM +0100, Marcus Holland-Moritz wrote:
Sounds reasonable.
Show quoted text> > Here's a first shot. The attached patch (against the latest repository
> > snapshot) adds a 'LICENSE' parameter to MakeMaker. It also tries to make
> > the metafile output a little more Module::Build-ish. I didn't add a
> > parameter for 'DISTRIBUTION_TYPE', since this is currently hardcoded
> > also in M::B.
> >
> > As this is my first patch to MM, please let me know if I missed anything.
>
> Looks good at first glance. My only comment would be that it would
> be nice if the license warning could happen only as the META.yml is
> generated. This will make MM forward compatible should we add more
> licenses, so if an older MM installs a module generated with a new license
> type it won't warn.
> That'll probably require moving the license check code into
> an ExtUtils::MM::Command function so the check can be done in the
> metafile target.
Updated patch attached. I also patched the C<oneliner> subs to add
a '--' at the end of the options list. This makes it possible for
oneliners to be passed arguments that start with dashes, which is
required e.g. on Win32 when doing:
ECHO = $(PERLRUN) -l -e "print qq{@ARGV}" --
[...]
metafile :
$(NOECHO) $(ECHO) "--- #YAML:1.0" > META_new.yml
This wouldn't work without the '--'.
-- Marcus
diff -ruN ExtUtils-MakeMaker-snap/lib/ExtUtils/Command/MM.pm ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/Command/MM.pm
--- ExtUtils-MakeMaker-snap/lib/ExtUtils/Command/MM.pm 2003-11-03 23:02:38.000000000 +0100
+++ ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/Command/MM.pm 2003-12-14 10:25:03.000000000 +0100
@@ -8,7 +8,7 @@
@ISA = qw(Exporter);
@EXPORT = qw(test_harness pod2man perllocal_install uninstall
- warn_if_old_packlist);
+ warn_if_old_packlist warn_if_unknown_license);
$VERSION = '0.03';
my $Is_VMS = $^O eq 'VMS';
@@ -157,6 +157,29 @@
}
+=item B<warn_if_unknown_license>
+
+ perl "-MExtUtils::Command::MM" -e warn_if_unknown_license <some_license>
+
+Displays a warning if C<some_license> is an unknown license.
+See L<ExtUtils::MakeMaker> for a list of valid licenses.
+
+=cut
+
+sub warn_if_unknown_license {
+ my $license = $ARGV[0];
+
+ # When adding/removing licenses, be sure to update the list of
+ # valid licenses in ExtUtils::MakeMaker
+ my %valid = map {$_, 1} qw(perl gpl artistic lgpl bsd open_source
+ unrestricted restrictive unknown);
+
+ unless (exists $valid{$license}) {
+ print "WARNING: Unknown license type '$license'\n";
+ }
+}
+
+
=item B<perllocal_install>
perl "-MExtUtils::Command::MM" -e perllocal_install
diff -ruN ExtUtils-MakeMaker-snap/lib/ExtUtils/MakeMaker.pm ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/MakeMaker.pm
--- ExtUtils-MakeMaker-snap/lib/ExtUtils/MakeMaker.pm 2003-11-14 02:31:29.000000000 +0100
+++ ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/MakeMaker.pm 2003-12-14 11:11:28.000000000 +0100
@@ -221,7 +221,7 @@
PERL_LIB PERL_ARCHLIB
SITELIBEXP SITEARCHEXP
- INC INCLUDE_EXT LDFROM LIB LIBPERL_A LIBS
+ INC INCLUDE_EXT LDFROM LIB LIBPERL_A LIBS LICENSE
LINKTYPE MAKEAPERL MAKEFILE MAKEFILE_OLD MAN1PODS MAN3PODS MAP_TARGET
MYEXTLIB NAME NEEDS_LINKING NOECHO NO_META NORECURS NO_VC OBJECT OPTIMIZE
PERL_MALLOC_OK PERL PERLMAINCC PERLRUN PERLRUNINST PERL_CORE
@@ -487,6 +487,8 @@
($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
+ $self->{LICENSE} ||= 'unknown';
+
$self->init_main;
$self->init_VERSION;
$self->init_dist;
@@ -1675,6 +1677,23 @@
MakeMaker will turn it into an array with one element.
+=item LICENSE
+
+The license under which the module is distributed.
+This can be one of the following:
+
+ perl
+ gpl
+ artistic
+ lgpl
+ bsd
+ open_source
+ unrestricted
+ restrictive
+ unknown
+
+The default will be 'unknown'.
+
=item LINKTYPE
'static' or 'dynamic' (default unless usedl=undef in
diff -ruN ExtUtils-MakeMaker-snap/lib/ExtUtils/MM_Any.pm ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/MM_Any.pm
--- ExtUtils-MakeMaker-snap/lib/ExtUtils/MM_Any.pm 2003-11-14 02:30:33.000000000 +0100
+++ ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/MM_Any.pm 2003-12-14 10:04:20.000000000 +0100
@@ -610,20 +610,27 @@
my $prereq_pm = '';
foreach my $mod ( sort { lc $a cmp lc $b } keys %{$self->{PREREQ_PM}} ) {
my $ver = $self->{PREREQ_PM}{$mod};
- $prereq_pm .= sprintf " %-30s %s\n", "$mod:", $ver;
+ $prereq_pm .= sprintf " %-30s %s\n", "$mod:", $ver;
}
my $meta = <<YAML;
+--- #YAML:1.0
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: $self->{DISTNAME}
-version: $self->{VERSION}
-version_from: $self->{VERSION_FROM}
-installdirs: $self->{INSTALLDIRS}
-requires:
-$prereq_pm
+name: $self->{DISTNAME}
+version: $self->{VERSION}
+version_from: $self->{VERSION_FROM}
+installdirs: $self->{INSTALLDIRS}
+license: $self->{LICENSE}
distribution_type: module
-generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
+YAML
+
+ $meta .= $prereq_pm ? "requires:\n$prereq_pm" : <<YAML;
+requires: {}
+YAML
+
+ $meta .= <<YAML;
+generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
YAML
my @write_meta = $self->echo($meta, 'META_new.yml');
@@ -631,9 +638,10 @@
compare(@ARGV) != 0 ? (mv or warn "Cannot move @ARGV: $$!\n") : unlink(shift);
CODE
- return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta), $move;
+ return sprintf <<'MAKE_FRAG', $self->{LICENSE}, join("\n\t", @write_meta), $move;
metafile :
$(NOECHO) $(ECHO) Generating META.yml
+ $(NOECHO) $(WARN_IF_UNKNOWN_LICENSE) %s
%s
-$(NOECHO) %s META_new.yml META.yml
MAKE_FRAG
diff -ruN ExtUtils-MakeMaker-snap/lib/ExtUtils/MM_Unix.pm ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/MM_Unix.pm
--- ExtUtils-MakeMaker-snap/lib/ExtUtils/MM_Unix.pm 2003-11-17 23:55:22.000000000 +0100
+++ ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/MM_Unix.pm 2003-12-14 10:53:18.000000000 +0100
@@ -1892,7 +1892,9 @@
Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH, LD,
OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, SHELL, NOOP,
FIRST_MAKEFILE, MAKEFILE_OLD, NOECHO, RM_F, RM_RF, TEST_F,
-TOUCH, CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N
+TOUCH, CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N, MAKE_APERL_FILE,
+MKPATH, EQUALIZE_TIMESTAMP, UNINST, VERBINST, MOD_INSTALL, DEV_NULL,
+DOC_INSTALL, UNINSTALL, WARN_IF_OLD_PACKLIST, WARN_IF_UNKNOWN_LICENSE
=cut
@@ -1979,6 +1981,8 @@
'$(PERLRUN) "-MExtUtils::Command::MM" -e uninstall';
$self->{WARN_IF_OLD_PACKLIST} ||=
'$(PERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist';
+ $self->{WARN_IF_UNKNOWN_LICENSE} ||=
+ '$(PERLRUN) "-MExtUtils::Command::MM" -e warn_if_unknown_license';
$self->{UMASK_NULL} ||= "umask 0";
$self->{DEV_NULL} ||= "> /dev/null 2>&1";
@@ -3613,7 +3617,7 @@
$switches = join ' ', @$switches;
- return qq{\$(PERLRUN) $switches -e $cmd};
+ return qq{\$(PERLRUN) $switches -e $cmd --};
}
@@ -3917,8 +3921,8 @@
SHELL, CHMOD, CP, MV, NOOP, NOECHO, RM_F, RM_RF, TEST_F, TOUCH,
DEV_NULL, UMASK_NULL, MKPATH, EQUALIZE_TIMESTAMP,
-WARN_IF_OLD_PACKLIST, UNINST, VERBINST, MOD_INSTALL, DOC_INSTALL and
-UNINSTALL
+WARN_IF_OLD_PACKLIST, WARN_IF_UNKNOWN_LICENSE, UNINST, VERBINST,
+MOD_INSTALL, DOC_INSTALL and UNINSTALL
init_others() initializes all these values.
@@ -3934,6 +3938,7 @@
UNINST VERBINST
MOD_INSTALL DOC_INSTALL UNINSTALL
WARN_IF_OLD_PACKLIST
+ WARN_IF_UNKNOWN_LICENSE
} )
{
next unless defined $self->{$tool};
diff -ruN ExtUtils-MakeMaker-snap/lib/ExtUtils/MM_VMS.pm ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/MM_VMS.pm
--- ExtUtils-MakeMaker-snap/lib/ExtUtils/MM_VMS.pm 2003-11-04 01:13:05.000000000 +0100
+++ ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/MM_VMS.pm 2003-12-14 10:53:20.000000000 +0100
@@ -2122,7 +2122,7 @@
# Switches must be quoted else they will be lowercased.
$switches = join ' ', map { qq{"$_"} } @$switches;
- return qq{\$(PERLRUN) $switches -e $cmd};
+ return qq{\$(PERLRUN) $switches -e $cmd --};
}
diff -ruN ExtUtils-MakeMaker-snap/lib/ExtUtils/MM_Win32.pm ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/MM_Win32.pm
--- ExtUtils-MakeMaker-snap/lib/ExtUtils/MM_Win32.pm 2003-10-30 08:38:01.000000000 +0100
+++ ExtUtils-MakeMaker-snap-mhx/lib/ExtUtils/MM_Win32.pm 2003-12-14 10:53:21.000000000 +0100
@@ -451,7 +451,7 @@
$switches = join ' ', @$switches;
- return qq{\$(PERLRUN) $switches -e $cmd};
+ return qq{\$(PERLRUN) $switches -e $cmd --};
}
diff -ruN ExtUtils-MakeMaker-snap/Makefile.PL ExtUtils-MakeMaker-snap-mhx/Makefile.PL
--- ExtUtils-MakeMaker-snap/Makefile.PL 2003-04-07 04:11:24.000000000 +0200
+++ ExtUtils-MakeMaker-snap-mhx/Makefile.PL 2003-12-14 11:13:33.000000000 +0100
@@ -66,6 +66,7 @@
ABSTRACT_FROM => "lib/$PACKAGE_FILE.pm",
AUTHOR => 'Michael G Schwern <schwern@pobox.com>',
+ LICENSE => 'perl',
);
if( !$Is_VMS && $MM->{PERL} =~ /\S\s+\S/ ) {