[CentOS] an rpm howto question

Thu Jun 30 15:51:11 UTC 2005
Dan Pritts <danno at internet2.edu>

On Wed, Jun 29, 2005 at 05:21:10PM -0400, Nielsen, Steve wrote:
> I am in a precarious spot....
> 
> I run centos 4.0. I upgraded my mod_perl RPM to mod_perl 2.0.1. CGI.pm 3.10 (3.05 comes with centos 4.0) fixes some namespace issues with mod_perl vs mod_perl 2.0.1. I need to upgrade to it to 3.10. Yet that file belongs to the perl rpm that comes with centos.
> 
> What do people generally do in this type of situation?

What I generally do is install the new perl module with CPAN and overwrite
the one that came in the RPM.  When you do this you need to make darn sure
you remember it when upgrade time comes or you'll be very sad.

It occurs to me that you could create a fake rpm package for cgi.pm that
depends on an explicit version of perl, so any upgrade to perl will fail
due to that dependency.  

I've attached a spec file that i think will do this (for perl version
5.8.5-12.1, which is what i had installed on my system).

To create an RPM with it, you'll need to create an empty tar.gz file
fakecgipm-3.10.tar.gz and put it in /usr/src/redhat/SOURCES, put the
spec in /usr/src/redhat/SPECS, then do rpmbuild -bb on the spec file.

Then install the resulting RPM.

Next time you upgrade perl you'll have to remove this RPM first, 
or build a new one that requires the new version of perl and install
it with the new perl rpm, and then go back in with cpan and reinstall
the module.  Not a seamless upgrade but easier than rolling your own
perl each time.

danno
--
dan pritts - systems administrator - internet2
734/352-4953 office        734/834-7224 mobile
-------------- next part --------------
%define name fakecgipm
%define version 3.10
%define release 1

Vendor: danno
Packager: danno
Distribution: dannoOS
URL: http://www.internet2.edu

BuildArchitectures: noarch

Summary: A fake package so that rpm thinks we have "java"
Name: %{name}
Version: %{version}
Release: %{release}
Group: internet2
Source: %{name}-%{version}.tar.gz
BuildRoot: /tmp/%{name}-%{version}
License: GPL

Provides: cgi.pm = 3.10

Requires: perl = 5.8.5-12.1


%description
A placeholder package to tell RPM that we have installed our own
CGI.pm version - this should prevent future perl upgrades from
installing and overwriting it since we depend on a specific version
of perl. 

To upgrade perl, you'll need to rebuild this RPM with a new spec file
containing the appropriate version of perl, then upgrade perl, then
rerun CPAN to install CGI.pm.

%prep

%setup

%build

%install

%clean
#/bin/rm fakejava-install-a-file-for-me

%files
#%defattr(0755,root,root)
#/fakejava-install-a-second-file

%pre

%post

%preun

%postun

%changelog