develooper Front page | perl.perl5.porters | Postings from October 2003

[PATCH] SIGN => 1 support for MakeMaker

Thread Next
From:
Autrijus Tang
Date:
October 14, 2003 04:08
Subject:
[PATCH] SIGN => 1 support for MakeMaker
Message ID:
1066127547.65845.35.camel@localhost
Below please find the promised patches to allow SIGN => 1 to be passed
to WriteMakefile, which generates SIGNATURE using "cpansign -s" and add
that file to MANIFEST, as part of the distdir action, right after
META.yml is being written.

This solves a major annoyance on using cpansign with modern MakeMaker,
as noted by Andreas in CPAN-1.76/Makefile.PL:

    # if we make sign first and make dist then, then any change to
    # META.yml will ruin the signature
    # if we make dist first and make sign then, then the correct signature
    # will not be part of the tarball

Thanks,
/Autrijus/

diff -dur /var/perl-5.8.1/lib/ExtUtils/MM_Any.pm ExtUtils/MM_Any.pm
--- /var/perl-5.8.1/lib/ExtUtils/MM_Any.pm	Tue Sep 16 16:00:37 2003
+++ ExtUtils/MM_Any.pm	Tue Oct 14 17:39:59 2003
@@ -607,6 +607,32 @@
 }
 
 
+=item signature_target
+
+    my $target = $mm->signature_target;
+
+Generate the signature target.
+
+Writes the file SIGNATURE with "cpansign -s".
+
+=cut
+
+sub signature_target {
+    my $self = shift;
+
+    return <<'MAKE_FRAG' if !$self->{SIGN};
+signature:
+	$(NOECHO) $(NOOP)
+MAKE_FRAG
+
+    return <<'MAKE_FRAG';
+signature:
+	cpansign -s
+MAKE_FRAG
+
+}
+
+
 =item metafile_addtomanifest_target
 
   my $target = $mm->metafile_addtomanifest_target
@@ -630,6 +656,35 @@
 
     return sprintf <<'MAKE_FRAG', $add_meta;
 metafile_addtomanifest:
+	$(NOECHO) %s
+MAKE_FRAG
+
+}
+
+
+=item signature_addtomanifest_target
+
+  my $target = $mm->signature_addtomanifest_target
+
+Adds the META.yml file to the MANIFEST.
+
+=cut
+
+sub signature_addtomanifest_target {
+    my $self = shift;
+
+    return <<'MAKE_FRAG' if !$self->{SIGN};
+signature_addtomanifest:
+	$(NOECHO) $(NOOP)
+MAKE_FRAG
+
+    my $add_sign = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']);
+eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) } 
+    or print "Could not add SIGNATURE to MANIFEST: $${'@'}\n"
+CODE
+
+    return sprintf <<'MAKE_FRAG', $add_sign;
+signature_addtomanifest:
 	$(NOECHO) %s
 MAKE_FRAG
 
diff -dur /var/perl-5.8.1/lib/ExtUtils/MM_Unix.pm ExtUtils/MM_Unix.pm
--- /var/perl-5.8.1/lib/ExtUtils/MM_Unix.pm	Sun Sep 21 19:08:27 2003
+++ ExtUtils/MM_Unix.pm	Tue Oct 14 17:40:48 2003
@@ -953,7 +953,7 @@
     my($self) = shift;
 
     return <<'MAKE_FRAG';
-distdir : metafile metafile_addtomanifest
+distdir : metafile metafile_addtomanifest signature signature_addtomanifest
 	$(RM_RF) $(DISTVNAME)
 	$(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
 		-e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
diff -dur /var/perl-5.8.1/lib/ExtUtils/MakeMaker.pm ExtUtils/MakeMaker.pm
--- /var/perl-5.8.1/lib/ExtUtils/MakeMaker.pm	Tue Sep 16 16:00:37 2003
+++ ExtUtils/MakeMaker.pm	Tue Oct 14 17:49:33 2003
@@ -226,7 +226,7 @@
     PERL_SRC PERM_RW PERM_RWX
     PL_FILES PM PM_FILTER PMLIBDIRS POLLUTE PPM_INSTALL_EXEC
     PPM_INSTALL_SCRIPT PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ
-    SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
+    SIGN SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
     XS_VERSION clean depend dist dynamic_lib linkext macro realclean
     tool_autosplit
 
@@ -265,6 +265,7 @@
  installbin subdirs
  clean_subdirs clean realclean_subdirs realclean 
  metafile metafile_addtomanifest
+ signature signature_addtomanifest
  dist_basics dist_core distdir dist_test dist_ci
  install force perldepend makefile staticmake test ppd
 
@@ -1990,6 +1991,16 @@
 $Config{installprefix} will be used.
 
 Overridable by PREFIX
+
+=item SIGN
+
+When true, perform the generation and addition to the MANIFEST of
+the SIGNATURE file during 'make distdir', via 'cpansign -s'.
+
+Note that you need to install the Module::Signature module to
+perform this operation.
+
+Defaults to false.
 
 =item SKIP
 


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About