Skip to content

CentOS External PERL Library Packaging

Andrew R. Lake edited this page Mar 15, 2015 · 1 revision

Introduction

The goal of this page is to have a place to store all the cookbook instructions for making RPMs for software that we distribute, but aren't the maintainers of. Any patches or changes we make should be pushed to the maintainers if possible, but for some software, they will not accept the changes.

CPAN Packages

Cpanspec is a tool that reads the contents of CPAN packages and generates an RPM spec file. This file is then used with the source to create an RPM for distribution.

Use

The tool may be used as such:

  1. Download the CPAN package, I will use Net-IPTrie for this example:
wget -c http://search.cpan.org/CPAN/authors/id/C/CV/CVICENTE/Net-IPTrie-v0.4.tar.gz
  1. Run cpanspec on the package:
cpanspec --packager="Jason Zurawski" --old Net-IPTrie-v0.4.tar.gz
  1. Copy the package to the RPM build environment
cp Net-IPTrie-v0.4.tar.gz ~/rpmbuild/SOURCES/
  1. Build the RPM:
rpmbuild -ba --sign perl-Net-IPTrie.spec
  1. If succesfull, copy the resulting Spec File into svn and commit:
cp perl-Net-IPTrie.spec branches/RELEASE-_3.1/Shared/spec
svn add perl-Net-IPTrie.spec
svn commit

Spec Format

The automatically generated spec file makes some interesting decissions, here are some notes on customizations that may make things easier:

  • Add this:
Requires:       perl
  • Delete the BuildRequires lines, these are not necessary but are helpful if you are going for absolute compatibility.
  • Alter the Build/Install Path. There are several reasons for this, namely to ensure that the installed modules end up in the perl @INC by default. If left to the auto selection, the result will be deep in the vendor area, and may get glossed over on some machines due to versions.
    • Set the build string (Module::Build) to:
%{__perl} Build.PL install_base=/usr
* Set the build string (Make::Maker) to:
%{__perl} Makefile.PL INSTALL_BASE=/usr
* Change the install path (after _**%files**_, _**%defattr**_, and _**%doc**_):
%files
%defattr(-,root,root,-)
%doc README
/usr/*

Red Hat/Fedora Web100 Kernel

  • install kernel source rpm
yum-downloader --source kernel
  • download the web100 patch
  • install kernel source rpm
  • copy the web100 patch to "SOURCES" directory
  • edit the web100 patch and get rid of the Makefile section of the patch since the spec file will ignore that anyway.
  • edit the SPECS/kernel.spec and add appropriate Patch and ApplyPatch lines
    • Add "Patch4000: web100-2.6.27-2.5.22-200810130047.patch" at the end of all the "Patch" lines.
    • Add "ApplyPatch web100-2.6.27-2.5.22-200810130047.patch" at the end of all the "ApplyPatch" lines.
  • Edit the SPECS/kernel.spec and add an appropriate buildid where it's commented out:
%define buildid .web100
  • Add the web100 config to the kernel config in SOURCES/config-generic (you could also add to config-debug if you're compiling a debug kernel).
    • After all the CONFIG_TCP_* lines (mainly CONFIG_TCP_CONG), add the following (these lines are how rich compiled web100 on the NPtoolkit):
CONFIG_WEB100=y
CONFIG_WEB100_STATS=y
CONFIG_WEB100_FPERMS=384
CONFIG_WEB100_GID=0
CONFIG_WEB100_NET100=y
CONFIG_WEB100_NETLINK=y
  • Do a test to make sure the config works:
rpmbuild -bp --target=`uname -m` kernel.spec
  • If that works, try doing a compile (Note: this step takes a bit longer than forever):
rpmbuild -bb --with baseonly --without debuginfo --target=`uname -m` kernel.spec
* Note: Fixing any compile errors is beyond the scope of this document.
  • If the compile succeeds, you need to build the noarch parts to ensure that "kernel-firmware" is built, since the kernel itself will depend on it.
rpmbuild -bb --with firmware --without doc --target=noarch kernel.spec
* Note: you may have to hit enter through a config thing (not sure why)
Clone this wiki locally