Skip to content

Commit

Permalink
Package for 9.1 and 9.2 as a proper extension.
Browse files Browse the repository at this point in the history
This extensions used to be packaged primarily as an old-style extension and
is now primarily packaged as a new-style extension, with full support for
CREATE EXTENSION and ALTER EXTENSION UPDATE.

As a result, update debian packaging and documentation.
  • Loading branch information
dimitri committed Oct 15, 2012
1 parent 6d09c67 commit b289d0f
Show file tree
Hide file tree
Showing 20 changed files with 158 additions and 95 deletions.
53 changes: 7 additions & 46 deletions Makefile
Expand Up @@ -2,16 +2,10 @@ PKGNAME = prefix
PKGVERS = $(shell dpkg-parsechangelog | awk -F '[:-]' '/^Version:/ { print substr($$2, 2) }')
EXTVERS = $(shell awk -F "[= ']" '/default_version/ {print $$5}' prefix.control)

DEBDIR = /tmp/$(PKGNAME)
EXPORT = $(DEBDIR)/export/$(PKGNAME)-$(PKGVERS)
ORIG = $(DEBDIR)/export/$(PKGNAME)_$(PKGVERS).orig.tar.gz
ARCHIVE= $(DEBDIR)/export/$(PKGNAME)-$(PKGVERS).tar.gz
DEBEXTS= {gz,changes,build,dsc}

EXTENSION = prefix
MODULES = prefix
DATA = prefix--1.2.0.sql
DOCS = $(wildcard *.txt)
DATA = prefix--1.2.0.sql prefix--1.1.sql prefix--1.1--1.2.0.sql
DOCS = $(wildcard *.md)

# support for 8.1 which didn't expose PG_VERSION_NUM -- another trick from ip4r
PREFIX_PGVER = $(shell echo $(VERSION) | awk -F. '{ print $$1*100+$$2 }')
Expand All @@ -21,41 +15,8 @@ PG_CONFIG ?= pg_config
PGXS = $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

.PHONY: html site deb

html: ${DOCS:.txt=.html}

%.html:%.txt
asciidoc -a toc $<

site: html
scp ${DOCS:.txt=.html} cvs.pgfoundry.org:/home/pgfoundry.org/groups/prefix/htdocs

deb:
# working copy from where to make the .orig archive
rm -rf $(DEBDIR)
mkdir -p $(DEBDIR)/$(PKGNAME)-$(PKGVERS)
mkdir -p $(EXPORT)
rsync -Ca . $(EXPORT)

# get rid of temp and build files
for n in ".#*" "*~" "build-stamp" "configure-stamp" "prefix.so"; do \
find $(EXPORT) -name "$$n" -print0|xargs -0 rm -f; \
done

# prepare the .orig without the debian/ packaging stuff
rsync -Ca $(EXPORT) $(DEBDIR)
rm -rf $(DEBDIR)/$(PKGNAME)-$(PKGVERS)/debian
(cd $(DEBDIR) && tar czf $(ORIG) $(PKGNAME)-$(PKGVERS))

# have a copy of the $$ORIG file named $$ARCHIVE for non-debian packagers
cp $(ORIG) $(ARCHIVE)

# build the debian package and copy them to ..
(cd $(EXPORT) && touch debian/control.in && debuild)

cp $(EXPORT)/debian/control debian
cp -a $(DEBDIR)/export/*.deb ..
find $(DEBDIR)/export -name "*.$(DEBEXTS)" -print0| xargs -0 -I% cp -a % ..
cp -a $(ARCHIVE) ..
cp -a $(ORIG) ..
deb: clean
make -f debian/rules debian/control
dh clean
make -f debian/rules orig
debuild -us -uc -sa
24 changes: 20 additions & 4 deletions README.md
Expand Up @@ -21,17 +21,33 @@ will try to match a phone number to the longest prefix in the table:

## Installation

### debian and ubuntu packages

apt-get install postgresql-9.2-prefix
psql ...
=# create extension prefix;

### from sources

Check `$PATH`, then

make
make install
psql <connection string> -c 'CREATE EXTENSION prefix;'

The `make install` step might have to be done as `root`, and the psql one
has to be done as a PostgreSQL *superuser*. If you're running a very old
PostgreSQL version such as `8.3`, `8.4` of `9.0` you can still install this
extension by manually running the `prefix.sql` file from your `psql`
console (either using `-f` or `\i`).
has to be done as a PostgreSQL *superuser*.

### before 9.1 (consider an upgrade)

If you're running a very old PostgreSQL version such as `8.3`, `8.4` of
`9.0` you can still install this extension manually:

psql ...
=# \i /usr/share/postgresql/X.Y/extension/prefix--1.2.0.sql

You still have to edit this example to replace X.Y with your local
PostgreSQL version number, such as `8.4`.

## Uninstall

Expand Down
8 changes: 8 additions & 0 deletions debian/changelog
@@ -1,3 +1,11 @@
prefix (1.2.0-1) unstable; urgency=low

* Fix GiST consisten function in non-leaf nodes (Closes: #690160)
* Refactors as a real PostgreSQL Extension
* Add explicit compatibility with PostgreSQL 9.2 and 9.3devel

-- Dimitri Fontaine <dim@tapoueh.org> Mon, 15 Oct 2012 11:52:44 +0200

prefix (1.1.1-1) unstable; urgency=low

* Test against 9.0 and 9.1
Expand Down
2 changes: 1 addition & 1 deletion debian/control.in
Expand Up @@ -2,7 +2,7 @@ Source: prefix
Section: database
Priority: extra
Maintainer: Dimitri Fontaine <dim@tapoueh.org>
Build-Depends: debhelper (>= 7), postgresql-server-dev-all
Build-Depends: debhelper (>= 7.0.50~), postgresql-server-dev-all
Standards-Version: 3.9.2

Package: postgresql-PGVERSION-prefix
Expand Down
4 changes: 3 additions & 1 deletion debian/pgversions
Expand Up @@ -3,4 +3,6 @@
8.3
8.4
9.0
9.1
9.1
9.2
9.3
3 changes: 2 additions & 1 deletion debian/postgresql-8.3-prefix.docs
@@ -1 +1,2 @@
README.txt
README.md
TESTS.md
2 changes: 1 addition & 1 deletion debian/postgresql-8.3-prefix.install
@@ -1,2 +1,2 @@
debian/prefix-8.3/prefix.so usr/lib/postgresql/8.3/lib
prefix.sql usr/share/postgresql/8.3/contrib
prefix--1.2.0.sql usr/share/postgresql/8.3/contrib
3 changes: 2 additions & 1 deletion debian/postgresql-8.4-prefix.docs
@@ -1 +1,2 @@
README.txt
README.md
TESTS.md
2 changes: 1 addition & 1 deletion debian/postgresql-8.4-prefix.install
@@ -1,2 +1,2 @@
debian/prefix-8.4/prefix.so usr/lib/postgresql/8.4/lib
prefix.sql usr/share/postgresql/8.4/contrib
prefix--1.2.0.sql usr/share/postgresql/8.4/contrib
3 changes: 2 additions & 1 deletion debian/postgresql-9.0-prefix.docs
@@ -1 +1,2 @@
README.txt
README.md
TESTS.md
2 changes: 1 addition & 1 deletion debian/postgresql-9.0-prefix.install
@@ -1,2 +1,2 @@
debian/prefix-9.0/prefix.so usr/lib/postgresql/9.0/lib
prefix.sql usr/share/postgresql/9.0/contrib
prefix--1.2.0.sql usr/share/postgresql/9.0/contrib
3 changes: 2 additions & 1 deletion debian/postgresql-9.1-prefix.docs
@@ -1 +1,2 @@
README.txt
README.md
TESTS.md
5 changes: 4 additions & 1 deletion debian/postgresql-9.1-prefix.install
@@ -1,4 +1,7 @@
debian/prefix-9.1/prefix.so usr/lib/postgresql/9.1/lib
prefix.control usr/share/postgresql/9.1/extension
prefix.sql usr/share/postgresql/9.1/extension
prefix--1.1.sql usr/share/postgresql/9.1/extension
prefix--1.2.0.sql usr/share/postgresql/9.1/extension
prefix--1.1--1.2.0.sql usr/share/postgresql/9.1/extension
prefix--unpackaged--1.1.sql usr/share/postgresql/9.1/extension
prefix--unpackaged--1.2.0.sql usr/share/postgresql/9.1/extension
1 change: 0 additions & 1 deletion debian/postgresql-9.1-prefix.links

This file was deleted.

2 changes: 2 additions & 0 deletions debian/postgresql-9.2-prefix.docs
@@ -0,0 +1,2 @@
README.md
TESTS.md
7 changes: 7 additions & 0 deletions debian/postgresql-9.2-prefix.install
@@ -0,0 +1,7 @@
debian/prefix-9.2/prefix.so usr/lib/postgresql/9.2/lib
prefix.control usr/share/postgresql/9.2/extension
prefix--1.1.sql usr/share/postgresql/9.2/extension
prefix--1.2.0.sql usr/share/postgresql/9.2/extension
prefix--1.1--1.2.0.sql usr/share/postgresql/9.2/extension
prefix--unpackaged--1.1.sql usr/share/postgresql/9.2/extension
prefix--unpackaged--1.2.0.sql usr/share/postgresql/9.2/extension
10 changes: 10 additions & 0 deletions prefix--1.1--1.2.0.sql
@@ -0,0 +1,10 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "ALTER EXTENSION prefix UPDATE TO '1.2.0'" to load this file. \quit

-- version 1.2.0 adds restrict and join properties to the operator <@
-- (prefix_range, prefix_range), but don't automatically update that here:
--
-- due to dependencies, that would mean dropping all your prefix_range
-- columns and having to install the extension all over again. please
-- consider doing so yourself if you need it.

0 comments on commit b289d0f

Please sign in to comment.