Detecting Postgres version during build

Gianluca Sforna giallu at gmail.com
Wed Mar 7 10:22:47 UTC 2012


Hi Richard, I'll add some more context.

The package I'm preparing is for rdkit (http://rdkit.org), a
cheminformatic software with several components (a library, python
bindings, and Postgres chemical cartridge).

The current files I'm working on are here:
http://giallu.fedorapeople.org/rdkit.spec
http://giallu.fedorapeople.org/rdkit-2011.12-1.fc16.src.rpm

On Tue, Mar 6, 2012 at 4:00 PM, Richard W.M. Jones <rjones at redhat.com> wrote:
> If you BuildRequire the database itself (likely you don't) then
> postgres --version + some scripting seems to do what you want:
>
> $ postgres --version | awk '{print $3}'
> 9.1.2

I'm requiring postgresql-devel and I just checked mock logs and it
seems it pulls in postgresql, so I guess I can use this method.


>
> I suspect this isn't going to do what your users need.  What happens
> if they connect to a remote PostgreSQL database?  I'm guessing they
> could use either cartridge depending on the remote version, so you
> probably want to build and install both of them, if that is possible.

I am not sure this is going to work (at least in the present case):
the package includes some SQL code along with a shared object that
pgsql server runs to provide the chemical functions. AFAICT setting
this up is completely server side (see
http://code.google.com/p/rdkit/wiki/BuildingTheCartridge for details)
and unless we have both 8.x and 9.x in any EL or Fedora branch you
just want to pick and install the one that is provided by the package.

G.


-- 
Gianluca Sforna

http://morefedora.blogspot.com
http://identi.ca/giallu - http://twitter.com/giallu


More information about the devel mailing list