Re: Extension Packaging

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Extension Packaging
Date: 2011-04-21 03:29:44
Message-ID: D34C90FC-F5AF-43CD-AACA-C943EE56E2DF@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Apr 20, 2011, at 8:04 PM, Daniele Varrazzo wrote:

> Specifically, I parse the version from the control file using:
>
> PGMP_VERSION=$(shell grep default_version pgmp.control | sed -e
> "s/default_version = '\(.*\)'/\1/")

Oh, that's not bad. Thanks.

> so the Makefile doesn't have to be maintained for it. To tell apart <
> 9.1 and >= 9.1 I've used instead:
>
> PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" &&
> echo pre91 || echo 91)
> ifeq ($(PG91),91)
> ...
> else
> ...

Oh, definitely better and more future-proof than what I had. Mind if I poach these examples and document them for PGXN distribution?

> For my extension I'm less concerned by having the install sql named in
> different ways or by the upgrade sql as all these files are generated
> by scripts. You may find useful this one
> <https://github.com/dvarrazzo/pgmp/blob/master/tools/sql2extension.py>
> to generate the upgrade sql from the install sql. For my extension I
> require Python and have all the sql files generated by the Makefile at
> install time; if you don't want this dependency you ma

Yeah, I recently started using Perl to break up pgTAP into multiple files. I struggled for a while over whether or not to require it or to build the files at distribution time. I finally settled for having it run at install time, but it's not required: you just wouldn't get the broken-up files without it, only the great big one. I guess one could do the same with your script: If you don't have python, you don't get the unpackaged migration scripts.

Thanks again,

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-04-21 03:37:04 Re: pg_dump --binary-upgrade vs. ALTER TYPE ... DROP ATTRIBUTE
Previous Message David E. Wheeler 2011-04-21 03:25:26 Re: Extension Packaging