I've been working off and on for the last few weeks on a script for generating a spec file for Perl modules from CPAN. The current version is here:
http://www.silug.org/~steve/software/scripts/perl/cpanspec
I started noticing that source rpms generated by cpanflute2 needed a lot of very redundant cleanup, although they would almost always build. This script goes for the opposite approach. The spec file generated is meant to be clean and correct (suitable for submitting to fedora.us), since fixing build problems is usually fairly trivial.
This script currently does the following:
* Gets the name and version from the tar file name. (This probably works for 99% of the modules on CPAN, but there are a few notable exceptions.) * Parses any README files for something suitable for %description. (I have a plan to make the guesses a bit better, but the current code works on a lot of modules.) * Guesses at what files should be included as %doc. * Gets BuildRequires from PREREQ_PM in Makefile.PL. * Sets URL and Source0 to actual (probably correct) URLs.
And there's probably other things I'm forgetting. :-)
Of course, the idea is to eventually either migrate these features into cpanflute2 or obsolete it by moving its features into this script. (I don't really care either way.)
To run the script, just provide the path to one or more tar files from CPAN on the command line. I haven't implemented any usage message (yet), so if you don't give it a list, it just won't do anything.
This message is all of the documentation that exists at the moment, but if anyone other than me finds it useful, I'll fix that. :-)
Steve
On Sun, Mar 21, 2004 at 06:44:59PM -0600, Steven Pritchard wrote:
- Parses any README files for something suitable for %description. (I have a plan to make the guesses a bit better, but the current code works on a lot of modules.)
You could also look for POD docs in the module itself. Maybe use
Of course, the idea is to eventually either migrate these features into cpanflute2 or obsolete it by moving its features into this script. (I don't really care either way.)
cpanflute3. :)
On Sun, Mar 21, 2004 at 10:25:46PM -0500, Matthew Miller wrote:
You could also look for POD docs in the module itself.
Yeah, that would work too. I've run across a few modules that have no README, but if we did pod2text on the right module, we could pull the description from that.
How to figure out which module and all that is what hasn't clicked in my head yet.
Steve
rpпн, 2004-03-22 у 02:44, Steven Pritchard написав:
I've been working off and on for the last few weeks on a script for generating a spec file for Perl modules from CPAN.
http://freshmeat.net/projects/rpmpan/
On Mon, Mar 22, 2004 at 01:08:17PM +0200, Volodymyr M. Lisivka wrote:
I'm aware of that. While it's a great resource, I doubt any of those packages will make it past fedora.us QA. They are just generated using cpanflute2.
Steve
On Mon, Mar 22, 2004 at 09:01:50AM -0600, Steven Pritchard wrote:
I'm aware of that. While it's a great resource, I doubt any of those packages will make it past fedora.us QA. They are just generated using cpanflute2.
Oh, and in case it wasn't clear from my earlier message -- I'm really looking forward to seeing this.
Steven Pritchard steve@silug.org writes:
I've been working off and on for the last few weeks on a script for generating a spec file for Perl modules from CPAN. The current version is here:
I've found this very handy, but I ran into a few problems when trying to move stuff across to x86-64. I think this fixes the problems I've seen (the problem being that on x86-64, _libdir is /usr/lib64, whereas noarch stuff actually gets installed into /usr/lib/perl5/...):
--- cpanspec.orig 2004-03-28 19:59:30.000000000 +0100 +++ cpanspec 2004-04-14 09:19:11.813626813 +0100 @@ -136,7 +136,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root END
- print $spec "BuildArch: noarch\n" if (!grep /.(c|xs)$/i, @files); + my $noarch = (!grep /.(c|xs)$/i, @files); + print $spec "BuildArch: noarch\n" if $noarch;
# This is an ugly hack to parse any PREREQ_PM in Makefile.PL. if (open(CHILD, "-|") == 0) { @@ -178,6 +179,13 @@ } }
+ my $lib; + if ($noarch) { + $lib = "%{perl_vendorlib}"; + } else { + $lib = "%{perl_vendorarch}"; + } + print $spec <<END; Requires: perl(:MODULE_COMPAT_%(%{__perl} -MConfig -e 'print $Config{version}'))
@@ -211,7 +219,7 @@ %files %defattr(-,root,root,-) %doc @doc -%{_libdir}/perl*/* +$lib/* %{_mandir}/man3/*
%changelog
I'm not sure if vendorlib and vendorarch get used at the same time - picking some likely candidates, I've only seen one or the other.
On Wed, Apr 14, 2004 at 09:28:54AM +0100, Alex Kiernan wrote:
Steven Pritchard steve@silug.org writes:
I've been working off and on for the last few weeks on a script for generating a spec file for Perl modules from CPAN. The current version is here:
I've found this very handy, but I ran into a few problems when trying to move stuff across to x86-64. I think this fixes the problems I've seen (the problem being that on x86-64, _libdir is /usr/lib64, whereas noarch stuff actually gets installed into /usr/lib/perl5/...):
I've integrated that change. Hopefully in a week or two I'll have a box I can test this sort of thing with (again, but permanently this time :).
Has anyone else tried my script out? I'd love to get some feedback...
Steve
devel@lists.stg.fedoraproject.org