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 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.
-----Original Message----- From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf Of Niki Kovacs Sent: Tuesday, April 29, 2008 5:02 AM To: centos at centos.org Subject: [CentOS] How to handle updates after rebuilding PHP? 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 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. ----------------------------------- ----------------------------------- I think Yum is doing what is called replacing the package because it thinks it is not a centos built rpm. This does infact happen if when RHEL OS is pointed to use and update from the centos repo. Even the base packages get replaced with the centos one even though they are the same build binary and by version number. Maybe an option for updated source rpms is point yum to the sources repo instead of binary. Optionally you could specify wget with the file list option to fetch the named src.rpm new version then attach that to a cron job. Maybe someone else has an easier way of doing this? John Stanley _______________________________________________ CentOS mailing list CentOS at centos.org lists.centos.org/mailman/listinfo/centos
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 > 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: 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: <lists.centos.org/pipermail/centos/attachments/20080429/97ac307a/attachment-0001.sig>
Johnny Hughes a ?crit :> 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.kvThank you very much for your detailed explanation. I tried out what you suggested, and it works as expected!> > 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: > > owlriver.com/tips/non-rootUsually - on my Arch system - I build things as normal user. But if it's only for rebuilding CentOS SRPMS from [base], I don't bother to setup a build environment for a normal user. But I know what you mean: I've been using Slackware for a few years, where my habit was to write and use SlackBuild scripts as root... I remember very well how it felt doing an rm -rf $TMP/ with an unset TMP variable :oD Niki