tags:

views:

123

answers:

1

We are using rpm to deploy our web applications internally. The rpm installs the files, configures apache, cron, logging and so on.

I would like to build a test version of the rpm that installs in a different location with a different configuration for apache, cron and logging. It should be possible to install both the production and test rpm on the same machine.

With both rpms installed i would have something like

/opt/app/www/...
/opt/app-test/www/...
/etc/httpd/conf.d/app.conf
/etc/httpd/conf.d/app-test.conf
/etc/cron.d/app
/etc/cron.d/app-test
/etc/init.d/app
/etc/init.d/app-test

What would be a good way to achieve this?

  • Copy the spec and rename everything to "test"?
  • Create different subpackages for prod/test?
  • Use rpm macros to alter the location and names in the spec?
  • Use rpm --relocate?

Is there any existing rpm that tries to do this that i can look at?

A: 

In my spec files, I use the built-in macros and then, with a test account (not root) and a customized ~/.rpmmacros, I change the default prefix:

%_prefix %{_home}

Works fine.

You can even create a test rpm database:

$ rpmdb --initdb --dbpath /home/test/var/lib/rpm

and put this in your .rpmmacros:

%_dbpath /home/test/var/lib/rpm
%_rpmlock_path %{_dbpath}/__db.000
Alexandre Pauzies
we decided to use virtualization instead and ignore the problem. the rpmdb tip lookus useful though, thanks.
Serbaut