Saturday, 17 November 2007

Package a Perl module

First check if somebody did already the job, e.g. on artfiles.org RPMS (SRPMS) or just for RPMS: RPMPan or this search site: Linux Software Directory .

You need to install perl-Archive-Tar-1.08-2.noarch.rpm and perl-RPM-Specfile-1.17-1.noarch.rpm.
A description of the module perl-RPM-Specfile can be found on cpan.
Download this perl script, called cpan-to-rpm.pl. It is described as followed: "Grab a module from CPAN and sock it into an RPM using cpanflute2"
Call it this way:
perl cpan-to-rpm.pl \
authors/id/M/MU/MUIR/modules/Net-Netmask-1.9011.tar.gz
perl cpan-to-rpm.pl \
authors/id/D/DJ/DJKERNEN/Mail-IMAPClient-2.2.9.tar.gz

That will create
/usr/src/redhat/SRPMS/perl-Net-Netmask-1.9011-1.src.rpm
If you install it with
rpm -i /usr/src/redhat/SRPMS/perl-Net-Netmask-1.9011-1.src.rpm
you can build the rpm from it with
rpmbuild -ba /usr/src/redhat/SPECS/perl-Net-Netmask.spec
to see what an rpm provides: rpm -qlp --provides perl-LDAP-0.31-4.noarch.rpm

No comments: