Just enough to make it compile but doesn't work yet

git-svn-id: http://svn.osgeo.org/postgis/trunk@10391 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Regina Obe 2012-10-10 21:45:23 +00:00
parent 97fc6137b1
commit 83e380890d
4 changed files with 145 additions and 124 deletions

View file

@ -1,124 +1,124 @@
include ../upgradeable_versions.mk
EXTENSION = postgis_tiger_geocoder
EXTVERSION = @POSTGIS_LIB_VERSION@
MINORVERSION = 2011.@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
MICRO_NUMBER = $(shell echo $(EXTVERSION) | sed "s/[0-9]\.[0-9]\.\([0-9]*\)[a-zA-Z]*[0-9]*/\1/")
PREREL_NUMBER = $(shell echo $(EXTVERSION) | \
sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
grep "[a-zA-Z]" | \
sed "s/[0-9][a-zA-Z]\([0-9]*\)[a-zA-Z]*/\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) | \
sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
grep "[a-zA-Z]" | \
sed "s/\([0-9][a-zA-Z]*\)[0-9]*/\1/")
DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
PG_CONFIG = @PGCONFIG@
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo no || echo yes)
SQL_BITS = $(wildcard sql_bits/*.sql)
EXTRA_CLEAN += sql/*.sql ${SQL_BITS}
ifeq ($(PG91),yes)
all: sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql sql_minor_upgrade
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
cp $< $@
sql/$(EXTENSION).sql: sql_bits/tiger_geocoder.sql sql_bits/mark_editable_objects.sql.in sql_bits/tiger_geocoder_comments.sql
cat $^ > $@
#strip BEGIN/COMMIT since these are not allowed in extensions
#strip CREATE SCHEMA since we force extension
# to create schema by setting schema to tiger_geocoder in control
sql/tiger_geocoder.sql.in: ../../extras/tiger_geocoder/tiger_2011/utility/set_search_path.sql \
../../extras/tiger_geocoder/tiger_2011/tables/lookup_tables_2011.sql \
../../extras/tiger_geocoder/tiger_2011/geocode_settings.sql \
../../extras/tiger_geocoder/tiger_2011/utility/utmzone.sql \
../../extras/tiger_geocoder/tiger_2011/utility/cull_null.sql \
../../extras/tiger_geocoder/tiger_2011/utility/nullable_levenshtein.sql \
../../extras/tiger_geocoder/tiger_2011/utility/levenshtein_ignore_case.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/end_soundex.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/count_words.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/state_extract.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/get_last_words.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_countysub_exact.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_countysub_fuzzy.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_place_exact.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_place_fuzzy.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/../../extras/tiger_geocoder/tiger_2011/normalize_address.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/pprint_addy.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/other_helper_functions.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/rate_attributes.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/includes_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/interpolate_from_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_location.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_intersection.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/reverse_geocode.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/census_tracts_functions.sql
cat $^ > $@
sql_bits/tiger_geocoder.sql: sql_bits/tiger_geocoder.sql.in
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' -e '/^CREATE SCHEMA/d;' $< > $@
../../doc/tiger_geocoder_comments.sql:
$(MAKE) -C ../../doc comments
sql_bits/tiger_geocoder_comments.sql: ../../doc/tiger_geocoder_comments.sql
cp $< $@
#grep all lines that start with CREATE OR REPLACE FUNCTION, TRIGGER...
#then replace CREATE OR REPLACE .. with ALTER EXTENSION..;
#then remove default values and extra junk
# sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: ../../tiger_geocoder/tiger_geocoder.sql
# sed -e '/^CREATE \(OR REPLACE\|TYPE\|TABLE\|VIEW\|CAST\)/!d;' \
# -e 's/OR REPLACE//g' \
# -e 's/CREATE\(.*\)/ALTER EXTENSION $(EXTENSION) ADD\1;/' \
# -e 's/DEFAULT [\.0-9a-zA-Z]\+//g' \
# -e 's/\(BEFORE\|WITH FUNCTION\)\(.*\)/;/' \
# -e 's/[ \t]+;/;/' \
# -e 's/(;/;/' \
# -e 's/\\(;/;/' \
# -e 's/;;/;/g' $< > $@
#hardcode for now using
#the extensions/make_unpackaged.sql script form an install
sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: sql_bits/tiger_geocoder--unpackaged.sql.in
cp $< $@
#upgrade script should have everything but table, schema, type creation/alter
#NOTE: we assume all object definitions end in ;
#first expression deletes all non-removable objects defined on same line
#second deletes all non-removable defined on multiple lines
# the end of the body of object we assume ends in ;
#aggregates are special
#they can be dropped but we need to remove
#them from the extension first
sql/tiger_geocoder_upgrade_minor.sql: sql_bits/tiger_geocoder.sql
sed -e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\).*;/d' \
-e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\)/,/\;/d' \
$< > $@
sql_minor_upgrade: ../postgis_extension_helper.sql sql_bits/remove_from_extension.sql.in sql/tiger_geocoder_upgrade_minor.sql sql_bits/mark_editable_objects.sql.in sql_bits/tiger_geocoder_comments.sql ../postgis_extension_helper_uninstall.sql
for OLD_VERSION in $(UPGRADEABLE_VERSIONS); do \
cat $^ > sql/$(EXTENSION)--$$OLD_VERSION--$(EXTVERSION).sql; \
done
DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
EXTRA_CLEAN += sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql
endif
distclean: clean
rm Makefile
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
include ../upgradeable_versions.mk
EXTENSION = postgis_tiger_geocoder
EXTVERSION = 2.1.0SVN
MINORVERSION = 2011.2.1
MICRO_NUMBER = $(shell echo $(EXTVERSION) | sed "s/[0-9]\.[0-9]\.\([0-9]*\)[a-zA-Z]*[0-9]*/\1/")
PREREL_NUMBER = $(shell echo $(EXTVERSION) | \
sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
grep "[a-zA-Z]" | \
sed "s/[0-9][a-zA-Z]\([0-9]*\)[a-zA-Z]*/\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) | \
sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
grep "[a-zA-Z]" | \
sed "s/\([0-9][a-zA-Z]*\)[0-9]*/\1/")
DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
PG_CONFIG = /c/projects/pg/pg91/bin/pg_config
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo no || echo yes)
SQL_BITS = $(wildcard sql_bits/*.sql)
EXTRA_CLEAN += sql/*.sql ${SQL_BITS}
ifeq ($(PG91),yes)
all: sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql sql_minor_upgrade
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
cp $< $@
sql/$(EXTENSION).sql: sql_bits/tiger_geocoder.sql sql_bits/mark_editable_objects.sql.in sql_bits/tiger_geocoder_comments.sql
cat $^ > $@
#strip BEGIN/COMMIT since these are not allowed in extensions
#strip CREATE SCHEMA since we force extension
# to create schema by setting schema to tiger_geocoder in control
sql_bits/tiger_geocoder.sql.in: ../../extras/tiger_geocoder/tiger_2011/utility/set_search_path.sql \
../../extras/tiger_geocoder/tiger_2011/tables/lookup_tables_2011.sql \
../../extras/tiger_geocoder/tiger_2011/geocode_settings.sql \
../../extras/tiger_geocoder/tiger_2011/utility/utmzone.sql \
../../extras/tiger_geocoder/tiger_2011/utility/cull_null.sql \
../../extras/tiger_geocoder/tiger_2011/utility/nullable_levenshtein.sql \
../../extras/tiger_geocoder/tiger_2011/utility/levenshtein_ignore_case.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/end_soundex.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/count_words.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/state_extract.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/get_last_words.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_countysub_exact.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_countysub_fuzzy.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_place_exact.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract_place_fuzzy.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/location_extract.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/normalize_address.sql \
../../extras/tiger_geocoder/tiger_2011/normalize/pprint_addy.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/other_helper_functions.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/rate_attributes.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/includes_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/interpolate_from_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_address.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_location.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode_intersection.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/geocode.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/reverse_geocode.sql \
../../extras/tiger_geocoder/tiger_2011/geocode/census_tracts_functions.sql
cat $^ > $@
sql_bits/tiger_geocoder.sql: sql_bits/tiger_geocoder.sql.in
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' -e '/^CREATE SCHEMA/d;' $< > $@
../../doc/tiger_geocoder_comments.sql:
$(MAKE) -C ../../doc comments
sql_bits/tiger_geocoder_comments.sql: ../../doc/tiger_geocoder_comments.sql
cp $< $@
#grep all lines that start with CREATE OR REPLACE FUNCTION, TRIGGER...
#then replace CREATE OR REPLACE .. with ALTER EXTENSION..;
#then remove default values and extra junk
# sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: ../../tiger_geocoder/tiger_geocoder.sql
# sed -e '/^CREATE \(OR REPLACE\|TYPE\|TABLE\|VIEW\|CAST\)/!d;' \
# -e 's/OR REPLACE//g' \
# -e 's/CREATE\(.*\)/ALTER EXTENSION $(EXTENSION) ADD\1;/' \
# -e 's/DEFAULT [\.0-9a-zA-Z]\+//g' \
# -e 's/\(BEFORE\|WITH FUNCTION\)\(.*\)/;/' \
# -e 's/[ \t]+;/;/' \
# -e 's/(;/;/' \
# -e 's/\\(;/;/' \
# -e 's/;;/;/g' $< > $@
#hardcode for now using
#the extensions/make_unpackaged.sql script form an install
sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: sql_bits/tiger_geocoder--unpackaged.sql.in
cp $< $@
#upgrade script should have everything but table, schema, type creation/alter
#NOTE: we assume all object definitions end in ;
#first expression deletes all non-removable objects defined on same line
#second deletes all non-removable defined on multiple lines
# the end of the body of object we assume ends in ;
#aggregates are special
#they can be dropped but we need to remove
#them from the extension first
sql/tiger_geocoder_upgrade_minor.sql: sql_bits/tiger_geocoder.sql
sed -e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\).*;/d' \
-e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\)/,/\;/d' \
$< > $@
sql_minor_upgrade: ../postgis_extension_helper.sql sql_bits/remove_from_extension.sql.in sql/tiger_geocoder_upgrade_minor.sql sql_bits/mark_editable_objects.sql.in sql_bits/tiger_geocoder_comments.sql ../postgis_extension_helper_uninstall.sql
for OLD_VERSION in $(UPGRADEABLE_VERSIONS); do \
cat $^ > sql/$(EXTENSION)--$$OLD_VERSION--$(EXTVERSION).sql; \
done
DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
EXTRA_CLEAN += sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql
endif
distclean: clean
rm Makefile
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

View file

@ -0,0 +1 @@
SELECT pg_catalog.pg_extension_config_dump('geocode_settings', '');

View file

@ -0,0 +1,20 @@
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
-- $Id: remove_from_extension.sql.in 9324 2012-02-27 22:08:12Z pramsey $
----
-- PostGIS - Spatial Types for PostgreSQL
-- http://www.postgis.org
--
-- Copyright (C) 2011 Regina Obe <lr@pcorp.us>
--
-- This is free software; you can redistribute and/or modify it under
-- the terms of the GNU General Public Licence. See the COPYING file.
--
-- Author: Regina Obe <lr@pcorp.us>
--
-- This drops extension helper functions
-- and should be called at the end of the extension upgrade file
-- removes all postgis_topology functions from postgis_topology extension since they will be readded
-- during upgrade
SELECT postgis_extension_remove_objects('postgis_tiger_geocoder', 'FUNCTION');
SELECT postgis_extension_remove_objects('postgis_tiger_geocoder', 'AGGREGATE');