CPAN spec file generator

Alex Kiernan alex.kiernan at thus.net
Wed Apr 14 08:28:54 UTC 2004


Steven Pritchard <steve at 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:
> 
>   http://www.silug.org/~steve/software/scripts/perl/cpanspec
> 

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.

-- 
Alex Kiernan, Principal Engineer, Development, THUS plc





More information about the devel mailing list