Re: Detecting Postgres version during build

2012-03-07 Thread Tom Lane
Well, what you need to build against is Postgres 9.1.x, because that is
what is in current Fedora releases.  I think you should just do -DPG91
and be done with it.  You could BuildRequire postgresql-devel >= 9.1.0
if that makes you feel better.

regards, tom lane
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel

Re: Detecting Postgres version during build

2012-03-07 Thread Tom Hughes

On 07/03/12 10:45, Gianluca Sforna wrote:


On Wed, Mar 7, 2012 at 11:32 AM, Tom Hughes  wrote:

It might be worth looking at how something like the postgis package handles
this, as it also contains a Postgres extension.


Yeah. useful:
http://pkgs.fedoraproject.org/gitweb/?p=postgis.git;a=blob;f=postgis.spec;h=53c558366da23ea5afdec41331b3ed40b0138c72;hb=HEAD

It seems it uses an approach similar to what Rich suggested to check
version. It also seems to build for/against a single postgresql
version, adding an explicit require for the same version (not sure how
you can end up with a mismatch tough, maybe on upgrades?)


Postgis does include 3GL functions that are installed into postgres so 
will be fairly closely tied to the postgres version it was compiled 
against anyway.


If what you're dealing with is pure SQL then it may be less closely tied 
to a specific version that postgis is.


Tom

--
Tom Hughes (t...@compton.nu)
http://compton.nu/
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel

Re: Detecting Postgres version during build

2012-03-07 Thread Gianluca Sforna
On Wed, Mar 7, 2012 at 11:32 AM, Tom Hughes  wrote:
> It might be worth looking at how something like the postgis package handles
> this, as it also contains a Postgres extension.

Yeah. useful:
http://pkgs.fedoraproject.org/gitweb/?p=postgis.git;a=blob;f=postgis.spec;h=53c558366da23ea5afdec41331b3ed40b0138c72;hb=HEAD

It seems it uses an approach similar to what Rich suggested to check
version. It also seems to build for/against a single postgresql
version, adding an explicit require for the same version (not sure how
you can end up with a mismatch tough, maybe on upgrades?)


-- 
Gianluca Sforna

http://morefedora.blogspot.com
http://identi.ca/giallu - http://twitter.com/giallu
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel

Re: Detecting Postgres version during build

2012-03-07 Thread Tom Hughes

On 07/03/12 10:22, Gianluca Sforna wrote:


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.


It might be worth looking at how something like the postgis package 
handles this, as it also contains a Postgres extension.


Tom

--
Tom Hughes (t...@compton.nu)
http://compton.nu/
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel

Re: Detecting Postgres version during build

2012-03-07 Thread Gianluca Sforna
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  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
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel

Re: Detecting Postgres version during build

2012-03-06 Thread Richard W.M. Jones
On Tue, Mar 06, 2012 at 01:13:24AM +0100, Gianluca Sforna wrote:
> I am trying to build a package that provides a Postegres cartridge
> compatible with 8.x and 9.x. Unfortunately the cartridge related files
> are not installed in the same path for both version so I am looking
> for a way to query the version against I'm building and pick the
> correct path.
> 
> Is there any standard mean for doing what I need?

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 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.

More context could help, including knowing which package you are
trying to build and what this "cartridge" actually does.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel