]> granicus.if.org Git - postgis/commitdiff
Draft an "update-restore" rule to update postgis_restore.pl.in
authorSandro Santilli <strk@keybit.net>
Fri, 13 Mar 2015 17:05:24 +0000 (17:05 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 13 Mar 2015 17:05:24 +0000 (17:05 +0000)
It updates the list of known PostGIS signatures from the enabler
and cleanup scripts.

git-svn-id: http://svn.osgeo.org/postgis/trunk@13333 b70326c6-7e19-0410-871a-916f4a2858ee

utils/Makefile.in

index 86c736a997b7f1c47c0aaf683650f97ba68b5af9..2f551afacc9be93048884beccc444d9b10233ac3 100644 (file)
@@ -44,6 +44,32 @@ SRID_USER_MAXIMUM = @SRID_USR_MAX@
 all: postgis_restore.pl
        chmod +x $(SCRIPTS)
 
+DROP_FILES = \
+  ../raster/rt_pg/rtpostgis_upgrade_cleanup.sql.in \
+  ../raster/rt_pg/rtpostgis_drop.sql.in \
+  ../postgis/postgis_drop_after.sql \
+  ../postgis/postgis_drop_before.sql
+
+update-restore:
+       tac postgis_restore.pl.in | sed '/^__END__/q' | grep -v '^__END__' \
+    > postgis_restore_data
+       grep '^DROP FUNCTION IF EXISTS' $(DROP_FILES) | \
+    cut -d: -f2 | sed 's/^DROP FUNCTION IF EXISTS //' | \
+    sed 's/ *, */,/g' | \
+    sed 's/ *( */(/g' | \
+    sed 's/ *) */)/g' | \
+    tr '[A-Z]' '[a-z]' | \
+    sed 's/varchar/character varying/g' | \
+    sed 's/float8/double precision/g' | \
+    sed 's/\<int\>/integer/g' | \
+    sed 's/\<int4\>/integer/g' | \
+    sed 's/\<int8\>/bigint/g' | \
+    sed 's/\(.*\); *\(--.*\)\?/FUNCTION \1/' >> postgis_restore_data
+       cat postgis_restore.pl.in | sed '/^__END__/q' > postgis_restore.pl.in.new
+       cat postgis_restore_data | sort -u >> postgis_restore.pl.in.new
+       mv postgis_restore.pl.in.new postgis_restore.pl.in
+       rm -f postgis_restore_data
+
 postgis_restore.pl: postgis_restore.pl.in
        sed 's,@SRID_MAXIMUM@,$(SRID_MAXIMUM),g;s,@SRID_USER_MAXIMUM@,$(SRID_USER_MAXIMUM),' $< >$@