[postgis-tickets] r16730 - Split a postgis_raster extension out of the postgis one
Sandro Santilli
strk at kbt.io
Tue Sep 11 02:18:26 PDT 2018
Author: strk
Date: 2018-09-11 02:18:26 -0700 (Tue, 11 Sep 2018)
New Revision: 16730
Added:
trunk/extensions/postgis_raster/
trunk/extensions/postgis_raster/Makefile.in
trunk/extensions/postgis_raster/postgis_raster.control.in
Modified:
trunk/.gitignore
trunk/configure.ac
trunk/extensions/Makefile.in
trunk/extensions/postgis/Makefile.in
trunk/regress/run_test.pl
Log:
Split a postgis_raster extension out of the postgis one
Tweaks run_test.pl to create raster extension when needed.
Modified: trunk/.gitignore
===================================================================
--- trunk/.gitignore 2018-09-11 06:19:49 UTC (rev 16729)
+++ trunk/.gitignore 2018-09-11 09:18:26 UTC (rev 16730)
@@ -53,6 +53,8 @@
extensions/postgis/postgis.control
extensions/postgis/sql/
extensions/postgis/sql_bits/*.sql
+extensions/postgis_raster/Makefile
+extensions/postgis_raster/postgis_raster.control
extensions/postgis_sfcgal/Makefile
extensions/postgis_sfcgal/postgis_sfcgal.control
extensions/postgis_sfcgal/sql/
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2018-09-11 06:19:49 UTC (rev 16729)
+++ trunk/configure.ac 2018-09-11 09:18:26 UTC (rev 16730)
@@ -1453,6 +1453,7 @@
AC_OUTPUT([GNUmakefile
extensions/Makefile
extensions/postgis/Makefile
+ extensions/postgis_raster/Makefile
extensions/postgis_sfcgal/Makefile
extensions/postgis_topology/Makefile
extensions/postgis_tiger_geocoder/Makefile
Modified: trunk/extensions/Makefile.in
===================================================================
--- trunk/extensions/Makefile.in 2018-09-11 06:19:49 UTC (rev 16729)
+++ trunk/extensions/Makefile.in 2018-09-11 09:18:26 UTC (rev 16730)
@@ -9,8 +9,11 @@
#
#############################################################################
-SUBDIRS = postgis
-SUBDIRS += postgis_tiger_geocoder
+SUBDIRS = postgis
+SUBDIRS += postgis_tiger_geocoder
+ifeq (@RASTER@,raster)
+ SUBDIRS += postgis_raster
+endif
ifeq (@TOPOLOGY@,topology)
SUBDIRS += postgis_topology
endif
Modified: trunk/extensions/postgis/Makefile.in
===================================================================
--- trunk/extensions/postgis/Makefile.in 2018-09-11 06:19:49 UTC (rev 16729)
+++ trunk/extensions/postgis/Makefile.in 2018-09-11 09:18:26 UTC (rev 16730)
@@ -34,9 +34,7 @@
EXTENSION_SCRIPTS = \
sql_bits/postgis.sql \
sql_bits/postgis_comments.sql \
- sql_bits/rtpostgis.sql \
sql_bits/spatial_ref_sys_config_dump.sql \
- sql_bits/raster_comments.sql \
sql_bits/spatial_ref_sys.sql
# Scripts making up the extension minor upgrade file
@@ -44,8 +42,6 @@
EXTENSION_UPGRADE_SCRIPTS = \
../postgis_extension_helper.sql \
sql_bits/postgis_upgrade.sql \
- sql_bits/rtpostgis_upgrade.sql \
- ../../doc/raster_comments.sql \
../../doc/postgis_comments.sql \
../postgis_extension_helper_uninstall.sql
@@ -52,8 +48,7 @@
# Scripts making up the extension upgrade-from-unpackaged file
# NOTE: order matters
EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS = \
- sql_bits/postgis.sql \
- sql_bits/rtpostgis.sql
+ sql_bits/postgis.sql
#DOCS = $(wildcard ../../doc/html/*.html)
PG_CONFIG = @PG_CONFIG@
@@ -111,26 +106,13 @@
sql_bits/postgis_comments.sql: ../../doc/postgis_comments.sql | sql_bits
cp $< $@
-#strip BEGIN/COMMIT since these are not allowed in extensions
-sql_bits/rtpostgis.sql: ../../raster/rt_pg/rtpostgis_for_extension.sql | sql_bits
- mkdir -p sql
- $(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' $< > $@
-
sql_bits/spatial_ref_sys_config_dump.sql: ../../spatial_ref_sys.sql ../../utils/create_spatial_ref_sys_config_dump.pl | sql_bits
$(PERL) ../../utils/create_spatial_ref_sys_config_dump.pl $< > $@
-sql_bits/rtpostgis_upgrade.sql: ../../raster/rt_pg/rtpostgis_upgrade_for_extension.sql | sql_bits
- $(PERL) -pe "s/BEGIN\;//g ; s/COMMIT\;//g; s/^(DROP .*)\;/SELECT postgis_extension_drop_if_exists('$(EXTENSION)', '\1');\n\1\;/" $< > $@
-
sql_bits/postgis_upgrade.sql: ../../postgis/postgis_upgrade_for_extension.sql | sql_bits
$(PERL) -pe "s/BEGIN\;//g ; s/COMMIT\;//g; s/^(DROP .*)\;/SELECT postgis_extension_drop_if_exists('$(EXTENSION)', '\1');\n\1\;/" $< > $@
-../../doc/raster_comments.sql:
- $(MAKE) -C ../../doc comments
-sql_bits/raster_comments.sql: ../../doc/raster_comments.sql | sql_bits
- cp $< $@
-
#postgis_extension_upgrade_minor.sql is the one that contains both postgis AND raster
sql/$(EXTENSION)--ANY--$(EXTVERSION).sql: $(EXTENSION_UPGRADE_SCRIPTS) | sql
printf '\\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \\quit\n' > $@
Copied: trunk/extensions/postgis_raster/Makefile.in (from rev 16729, trunk/extensions/postgis/Makefile.in)
===================================================================
--- trunk/extensions/postgis_raster/Makefile.in (rev 0)
+++ trunk/extensions/postgis_raster/Makefile.in 2018-09-11 09:18:26 UTC (rev 16730)
@@ -0,0 +1,130 @@
+include ../upgradeable_versions.mk
+
+EXTENSION = postgis_raster
+EXTVERSION = @POSTGIS_LIB_VERSION@
+MINORVERSION = @POSTGIS_MAJOR_VERSION at .@POSTGIS_MINOR_VERSION@
+MODULEPATH = $$libdir/$(EXTENSION)-$(MINORVERSION)
+GREP = @GREP@
+PERL = @PERL@
+
+MICRO_NUMBER = $(shell echo $(EXTVERSION) | \
+ $(PERL) -pe 's/\d.\d.(\d+)[a-zA-Z]*\d*/$1/'
+
+PREREL_NUMBER = $(shell echo $(EXTVERSION) | \
+ $(PERL) -pe 's/\d\.\d\.(.*)/\1/' | \
+ $(GREP) "[a-zA-Z]" | \
+ $(PERL) -pe 's/\d+[a-zA-Z]+(\d+)/\1/'
+
+MICRO_PREV = $(shell if test "$(MICRO_NUMBER)x" != "x"; then expr $(MICRO_NUMBER) - 1; fi)
+PREREL_PREV = $(shell if test "$(PREREL_NUMBER)x" != "x"; then expr $(PREREL_NUMBER) - 1; fi)
+
+PREREL_PREFIX = $(shell echo $(EXTVERSION) | \
+ $(PERL) -pe 's/\d\.\d\.(.*)/\1/' | \
+ $(GREP) "[a-zA-Z]" | \
+ $(PERL) -pe 's/(\d+[a-zA-Z]+)\d*/\1/'
+
+DATA_built = \
+ $(EXTENSION).control \
+ sql/$(EXTENSION)--$(EXTVERSION).sql \
+ sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql \
+ $(NULL)
+
+# Scripts making up the extension file
+# NOTE: order matters
+EXTENSION_SCRIPTS = \
+ sql/rtpostgis.sql \
+ sql/raster_comments.sql
+
+# Scripts making up the extension minor upgrade file
+# NOTE: order matters
+EXTENSION_UPGRADE_SCRIPTS = \
+ ../postgis_extension_helper.sql \
+ sql/rtpostgis_upgrade.sql \
+ ../../doc/raster_comments.sql \
+ ../postgis_extension_helper_uninstall.sql
+
+# Scripts making up the extension upgrade-from-unpackaged file
+# NOTE: order matters
+EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS = \
+ sql/rtpostgis.sql
+
+#DOCS = $(wildcard ../../doc/html/*.html)
+PG_CONFIG = @PG_CONFIG@
+
+SQL_BITS = $(wildcard sql/*.sql)
+EXTRA_CLEAN += ${SQL_BITS} sql/*.sql
+
+CURV_big=@POSTGIS_MAJOR_VERSION@@POSTGIS_MINOR_VERSION@
+
+all: sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql
+
+sql/$(EXTENSION).sql: $(EXTENSION_SCRIPTS)
+ mkdir -p sql
+ printf '\\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \\quit\n' > $@
+ cat $^ >> $@
+
+$(EXTENSION).control: $(EXTENSION).control.in Makefile
+ cat $< \
+ | sed -e 's|@EXTVERSION@|$(EXTVERSION)|g' \
+ | sed -e 's|@EXTENSION@|$(EXTENSION)|g' \
+ | sed -e 's|@MODULEPATH@|$(MODULEPATH)|g' \
+ > $@
+
+sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
+ mkdir -p sql
+ cp $< $@
+
+sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) ../../utils/create_unpackaged.pl
+ mkdir -p sql
+ cat $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) | $(PERL) ../../utils/create_unpackaged.pl postgis > $@
+
+#strip BEGIN/COMMIT since these are not allowed in extensions
+sql/rtpostgis.sql: ../../raster/rt_pg/rtpostgis_for_extension.sql
+ mkdir -p sql
+ $(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' $< > $@
+
+sql/rtpostgis_upgrade.sql: ../../raster/rt_pg/rtpostgis_upgrade_for_extension.sql
+ $(PERL) -pe "s/BEGIN\;//g ; s/COMMIT\;//g; s/^(DROP .*)\;/SELECT postgis_extension_drop_if_exists('$(EXTENSION)', '\1');\n\1\;/" $< > $@
+
+../../doc/raster_comments.sql:
+ $(MAKE) -C ../../doc comments
+
+sql/raster_comments.sql: ../../doc/raster_comments.sql
+ cp $< $@
+
+#postgis_extension_upgrade_minor.sql is the one that contains both postgis AND raster
+sql/postgis_extension_upgrade_minor.sql: $(EXTENSION_UPGRADE_SCRIPTS)
+ printf '\\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \\quit\n' > $@
+ cat $^ >> $@
+
+EXTDIR=$(DESTDIR)$(datadir)/$(datamoduledir)
+
+install: install-upgrade-paths
+
+# The "next" lines are a cludge to allow upgrading between different
+# revisions of the same version
+install-upgrade-paths: sql/postgis_extension_upgrade_minor.sql
+ tpl='$(EXTENSION)--ANY-$(EXTVERSION).sql'; \
+ ln -fs "$${tpl}" $(EXTDIR)/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql; \
+ ln -fs "$${tpl}" $(EXTDIR)/$(EXTENSION)--$(EXTVERSION)next--$(EXTVERSION).sql; \
+ $(INSTALL_DATA) $^ "$(EXTDIR)/$${tpl}"; \
+ for OLD_VERSION in $(UPGRADEABLE_VERSIONS); do \
+ ln -fs "$${tpl}" $(EXTDIR)/$(EXTENSION)--$$OLD_VERSION--$(EXTVERSION).sql; \
+ done
+
+uninstall: uninstall-upgrade-paths
+
+INSTALLED_UPGRADE_SCRIPTS = \
+ $(wildcard $(EXTDIR)/*$(EXTVERSION).sql) \
+ $(wildcard $(EXTDIR)/*$(EXTVERSION)next.sql) \
+ $(NULL)
+
+uninstall-upgrade-paths:
+ rm -f $(INSTALLED_UPGRADE_SCRIPTS)
+
+distclean: clean
+ rm -f Makefile
+
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
+PERL = @PERL@
Added: trunk/extensions/postgis_raster/postgis_raster.control.in
===================================================================
--- trunk/extensions/postgis_raster/postgis_raster.control.in (rev 0)
+++ trunk/extensions/postgis_raster/postgis_raster.control.in 2018-09-11 09:18:26 UTC (rev 16730)
@@ -0,0 +1,5 @@
+# postgis_raster extension
+comment = 'PostGIS raster types and functions'
+default_version = '@EXTVERSION@'
+module_pathname = '@MODULEPATH@'
+relocatable = false
Modified: trunk/regress/run_test.pl
===================================================================
--- trunk/regress/run_test.pl 2018-09-11 06:19:49 UTC (rev 16729)
+++ trunk/regress/run_test.pl 2018-09-11 09:18:26 UTC (rev 16730)
@@ -1317,6 +1317,20 @@
}
}
+ if ( $OPT_WITH_RASTER )
+ {
+ my $sql = "CREATE EXTENSION postgis_raster";
+ if ( $OPT_UPGRADE_FROM ) {
+ $sql .= " VERSION '" . $OPT_UPGRADE_FROM . "'";
+ }
+ $cmd = "psql $psql_opts -c \"" . $sql . "\" $DB >> $REGRESS_LOG 2>&1";
+ $rv = system($cmd);
+ if ( $rv ) {
+ fail "Error encountered creating EXTENSION POSTGIS_RASTER", $REGRESS_LOG;
+ die;
+ }
+ }
+
if ( $OPT_WITH_SFCGAL )
{
do {
@@ -1562,6 +1576,15 @@
$ok = 0 if $rv;
}
+ if ( $OPT_WITH_RASTER )
+ {
+ $cmd = "psql $psql_opts -c \"DROP EXTENSION postgis_raster;\" $DB >> $REGRESS_LOG 2>&1";
+ $rv = system($cmd);
+ die "\nError encountered dropping EXTENSION POSTGIS_RASTER, see $REGRESS_LOG for details\n\n"
+ if $rv;
+ $ok = 0 if $rv;
+ }
+
$cmd = "psql $psql_opts -c \"DROP EXTENSION postgis\" $DB >> $REGRESS_LOG 2>&1";
$rv = system($cmd);
die "\nError encountered dropping EXTENSION POSTGIS, see $REGRESS_LOG for details\n\n"
More information about the postgis-tickets
mailing list