Add per-version subdirectories to the structure

This commit is contained in:
Javier Goizueta 2016-02-15 19:00:45 +01:00
parent 77086a1ec4
commit c4df227258
9 changed files with 32 additions and 6 deletions

View File

@ -1,6 +1,6 @@
### Complete the structure:
* Support versioning
* [x] Support versioning
* Test use of `pgpy` from python Package
* Add integration tests
* Add `pysal` dependency and wrapper

View File

@ -1,20 +1,36 @@
# Makefile to generate the extension out of separate sql source files.
# Once a version is released, it is not meant to be changed. E.g: once version 0.0.1 is out, it SHALL NOT be changed.
EXTENSION = crankshaft
EXTVERSION = $(shell grep default_version $(EXTENSION).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
DATA = dist/$(EXTENSION)--$(EXTVERSION).sql
# The new version to be generated from templates
NEW_EXTENSION_ARTIFACT = dist/$(EXTENSION)--$(EXTVERSION).sql
SOURCES_DATA_DIR = sql
# DATA is a special variable used by postgres build infrastructure
# These are the files to be installed in the server shared dir,
# for installation from scratch, upgrades and downgrades.
# @see http://www.postgresql.org/docs/current/static/extend-pgxs.html
DATA = $(NEW_EXTENSION_ARTIFACT)
SOURCES_DATA_DIR = sql/$(EXTVERSION)
SOURCES_DATA = $(wildcard sql/$(EXTVERSION)/*.sql)
dist/$(EXTENSION)--$(EXTVERSION).sql: $(SOURCES_DATA)
# The extension installation artifacts are stored in the dist subdirectory
$(NEW_EXTENSION_ARTIFACT): $(SOURCES_DATA)
rm -f $@
cat $(SOURCES_DATA_DIR)/*.sql >> $@
# The PGXS build infraestructure takes the control file from this
# directory, but for consistency we will copy the control file to
# the dist subdirectory too.
dist/$(EXTENSION).control: $(EXTENSION).control
cp $< $@
REGRESS = $(notdir $(basename $(wildcard test/sql/*test.sql)))
TEST_DIR = test
all: dist/$(EXTENSION).control
REGRESS = $(notdir $(basename $(wildcard test/$(EXTVERSION)/sql/*test.sql)))
TEST_DIR = test/$(EXTVERSION)
REGRESS_OPTS = --inputdir='$(TEST_DIR)' --outputdir='$(TEST_DIR)'
PG_CONFIG = pg_config

View File

@ -0,0 +1,4 @@
-- Install dependencies
CREATE EXTENSION plpythonu;
-- Install the extension
CREATE EXTENSION crankshaft;

View File

@ -0,0 +1,6 @@
SELECT cdb_crankshaft.cdb_poc_xyz();
cdb_poc_xyz
-------------
xyz-result
(1 row)