Skip Menu |

This queue is for tickets about the cpan2rpm CPAN distribution.

Report information
The Basics
Id: 25034
Status: open
Priority: 0/
Queue: cpan2rpm

People
Owner: Nobody in particular
Requestors: wyant [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.028
Fixed in: (no value)



Subject: Apparant problem with Module::Build distributions
It has been reported to me that cpan2rpm is unable to detect the version number for the Astro-satpass distribution (see http://search.cpan.org/dist/Astro-satpass/). My investigation suggests that cpan2rpm does not correctly field the information passed to Module::Build::new. The attached .patch file contains a suggested correction for this and a couple other issues that came up in the course of the investigation. Discussion follows, along with expansion on the weasel words "Apparant" and "suggests". The main problem appears to be that the same code is used to field the arguments to both Module::Build::new and ExtUtils::MakeMaker::WriteMakeFile. But Module::Build::new is called O-O style, and has the class name on the front of the argument list. This has the effect of inverting the values stored into the %meta hash, turning values into keys and keys into values. The bulk of the patch (starting about line 425) attempts to deal with this by using different code to field the Module::Build::new arguments. The first of the "other issues" is that it appears that if a module is based on Module::Build, ExtUtils::MakeMaker does not get loaded, so that if the module's version is specified by 'version_from', the call to ExtUtils::MM_Unix->parse_version fails. The two lines around line 565 are one way to deal with this. The second (and last) of the "other issues" is that around January 20 2006, Pod::Text was completely rewritten, and no longer inherits anything from Pod::Parser, which is where the interpolate() method comes from. The patch file substitutes Pod::PlainText, but there are a couple problems with this: - first, the interpolate() method does not seem to do what I expected - the B<...>, L<...> etc sequences still appear in the output. - second, I'm not sure when this class was introduced; it might be necessary to do something semi-ugly like my $pod_parser_new = eval {require Pod::PlainText; sub {Pod::PlainText->new}} || do {require Pod::Text; sub {Pod::Text->new}}; There are a couple other minor patches: one because my religion requires me to change the version number when I change code, the other to pick up a couple more chunks of data from Module::Build::new. And now the weasel words: I do not, at this point, have access to a Linux system, and have so far been unable to build rpm under Mac OS X. What I have done is to create a stub rpm (in Perl) which is just smart enough to supply the data needed to populate the %RPMDIR hash (and the directories the hash points to), and tested against this. The .spec files generated by cpan2rpm using this fake rpm are not obviously garbage, but neither am I competent to say that they are correct. I also have not regression-tested my code against a module that supplies only Makefile.PL, nor against a year-and-a-half-old version of Pod::PlainText, if such exists. System information is appended. Thank you very much for your time and trouble. Tom Wyant $ perl -v This is perl, v5.8.8 built for darwin-2level Copyright 1987-2006, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. $ uname -a Darwin system_name_obfuscated.local 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh powerpc
Subject: cpan2rpm.patch
--- cpan2rpm.old Sat Jun 18 01:06:54 2005 +++ cpan2rpm Mon Feb 19 10:36:22 2007 @@ -20,7 +20,7 @@ # use vars qw($VERSION $VX); -$VERSION = "2.028"; +$VERSION = "2.028_01"; # TRW # --- prologue ---------------------------------------------------------------- @@ -28,7 +28,7 @@ use warnings; use Getopt::Long; use Sys::Hostname; -use Pod::Text; +use Pod::PlainText; # TRW my ($ME, $RPM, $TMPDIR, %RPMDIR, $CWD, %info, %meta, $ARGS); @@ -359,7 +359,7 @@ sub get_meta { my $info = shift || $_; local $_; - my $pod = Pod::Text->new(); + my $pod = Pod::Parser->new(); # TRW print "Metadata retrieval\n"; @@ -424,16 +424,26 @@ # grab parameters to function e.g. WriteMakefile() - my $PLFN = "ExtUtils::MakeMaker::WriteMakefile"; - $PLFN = "Module::Build::new" if $info->{PL} =~ /^Build/; - - eval qq/*${PLFN}_orig = \\&$PLFN/; - eval qq/*$PLFN = sub { - die "SAFETY ABORT!" if \$ENV{_DEEP_RECURSION}++ > 10; - %meta = \@_ unless %meta; - *$PLFN = \\&${PLFN}_orig; - goto &$PLFN; - };/; + my $PLFN; # TRW vvvv + if ($info->{PL} =~ /^Build/) { + $PLFN = "Module::Build::new"; + eval qq/*${PLFN}_orig = \\&$PLFN/; + eval qq/*$PLFN = sub { + die "SAFETY ABORT!" if \$ENV{_DEEP_RECURSION}++ > 10; + %meta = \@_[1 .. \$#_] unless %meta; + *$PLFN = \\&${PLFN}_orig; + goto &$PLFN; + };/; + } else { + $PLFN = "ExtUtils::MakeMaker::WriteMakeFile"; + eval qq/*${PLFN}_orig = \\&$PLFN/; + eval qq/*$PLFN = sub { + die "SAFETY ABORT!" if \$ENV{_DEEP_RECURSION}++ > 10; + %meta = \@_ unless %meta; + *$PLFN = \\&${PLFN}_orig; + goto &$PLFN; + };/; + } # TRW ^^^^ local @ARGV = (); local $0 = $t; @@ -463,6 +473,8 @@ dist_author AUTHOR dist_version VERSION dist_version_from VERSION_FROM + dist_abstract ABSTRACT + dist_name DISTNAME /; $meta{$b2m{$_}} = $meta{$_} for keys %b2m; } @@ -565,6 +577,8 @@ $info->{version} ||= $meta{VERSION}; unless ($info->{version}) { + require ExtUtils::MakeMaker # TRW + unless ExtUtils::MM_Unix->can ('parse_version'); # TRW $info->{version} = ExtUtils::MM_Unix->parse_version($from) if $from = $meta{VERSION_FROM}; trim($info->{version}); # parse_version() returns spaces
Subject: PS - Apparant problem with Module::Build distributions
PS - The command used to invoke cpan2rpm was blib/script/cpan2rpm Astro-satpass My correspondant was also concerned about the name of the package not matching any of the contained modules, but I can not address that until I find out exactly how cpan2rpm was invoked. In the meantime, I did what I thought was the most natural thing to test the version acquisition problem.