[CentOS] How to handle updates after rebuilding PHP?

Tue Apr 29 10:25:41 UTC 2008
Johnny Hughes <johnny at centos.org>

Niki Kovacs wrote:
> Hi,
> 
> One of our applications has some very specific requirements regarding 
> PHP, so I had to rebuild it to add some functionality that's not 
> included in the default configuration.
> 
> First thing I removed every PHP-related package that was installed on 
> the system:
> 
> # yum remove `rpm -qa | grep php`
> 
> Then I downloaded the PHP SRPM from 
> http://mirror.centos.org/centos/5.1/os/SRPMS/ and installed it.
> 
> Next I installed all the build dependencies using yum-builddep.
> 
> I edited php.spec according to my needs and then built PHP:
> 
> # rpmbuild -bb --clean php.spec
> 
> Finally, I installed the resulting packages using 'rpm -ivh', in that 
> order:
> 
> - php-common
> - php-cli
> - php
> - php-ldap
> 
> Problem: when I run 'yum check-update', Yum wants to update these php 
> packages immediately, with some packages coming from [base] (not from 
> [updates]). I'm puzzled, because PHP is not in [updates], only in [base].
> 
> Now I know I could simply add a line to /etc/yum.conf, something like:
> 
> exclude=php-*
> 
> But I *do* want to be notified somehow in case there's an update to PHP, 
> so I can download the new SRPM from the updates/ directory and then 
> rebuild it again.
> 
> Any suggestions about this?
> 
> Niki
> 
> PS: on my desktop I use Arch Linux, where I have some individually 
> rebuilt packages. When I do this, I simply increase the build number, so 
> my packages don't get squashed, but I get an update notification when a 
> new version is available. Maybe this is the way to go, but I don't know 
> how I would do this with RPM.

Well ... to increase the build number is easy ... you just edit the spec 
and increase the "Release" to whatever you want it to be. (Change the 15 
to 16 in this case) ... unless they release a 16 you are OK They could 
release 5.1.6-16 though (or even 5.1.6-15.el5.1), so this is not the 
BEST solution.

If the release number is the same as the original, then it should not 
try to replace the RPMS in question.  What that probably means is that 
the "%dist" was not defined in your build, so we have:

php-5.1.6-15.el5.i386.rpm

and you probably have:

php-5.1.6-15.i386.rpm

Notice the .el5 in our (and RedHat's) build.  The one with a .el5 is 
"greater than" the one without .el5, so RPM wants to replace the lower 
version (yours, without the .el5) with the higher version (ours, with .el5).

What you need to do (if there is a %{?dist} in the "Release" string) is 
to create a .rpmmacros file in the "home" directory of the user that you 
use to build RPMS with, and in that file, use a "dist" tag that starts 
with something that is "greater than" .el5  ... it could be .kv, .kovac, 
or .el5.kv ... etc.

The line would look like:

%dist .el5.kv

If you are building as root, you also want to probably change that as 
bad things can happen as root if an RPM is not properly written (bad 
things as in it can install things to the system when it builds).  Here 
is an example of how to build as a non root user:

http://www.owlriver.com/tips/non-root/


Thanks,
Johnny Hughes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos/attachments/20080429/97ac307a/attachment-0005.sig>