[postgis-tickets] r17550 - Ensure sql and expected dirs are created when needed
Sandro Santilli
strk at kbt.io
Thu Jun 20 12:08:13 PDT 2019
Author: strk
Date: 2019-06-20 00:08:13 -0700 (Thu, 20 Jun 2019)
New Revision: 17550
Modified:
branches/2.3/extensions/postgis_tiger_geocoder/Makefile.in
Log:
Ensure sql and expected dirs are created when needed
See https://dronie.osgeo.org/postgis/postgis/311/3/2
Modified: branches/2.3/extensions/postgis_tiger_geocoder/Makefile.in
===================================================================
--- branches/2.3/extensions/postgis_tiger_geocoder/Makefile.in 2019-06-19 16:57:22 UTC (rev 17549)
+++ branches/2.3/extensions/postgis_tiger_geocoder/Makefile.in 2019-06-20 07:08:13 UTC (rev 17550)
@@ -30,7 +30,7 @@
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}
+EXTRA_CLEAN += sql/*.sql ${SQL_BITS}
#test address standardizer if also built
ifeq (@ADDRESS_STANDARDIZER@,address_standardizer)
@@ -41,55 +41,49 @@
ifeq ($(PG91),yes)
all: sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql sql/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql sql/$(EXTENSION)--$(EXTVERSION)next--$(EXTVERSION).sql sql_minor_upgrade sql/test-normalize_address.sql sql/test-pagc_normalize_address.sql expected/test-normalize_address.out expected/test-pagc_normalize_address.out sql/test-upgrade.sql expected/test-upgrade.out sql/$(EXTENSION)--$(EXTVERSION)next--$(EXTVERSION).sql sql_minor_upgrade
-sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
- mkdir -p sql
- mkdir -p expected
+expected sql:
+ mkdir -p $@
+
+sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql | expected sql
cp $< $@
-expected/test-normalize_address.out: sql_bits/test_tuples_only_unaligned.sql.in ../../extras/tiger_geocoder/regress/normalize_address_regress
- mkdir -p expected
+expected/test-normalize_address.out: sql_bits/test_tuples_only_unaligned.sql.in ../../extras/tiger_geocoder/regress/normalize_address_regress | expected
cat $^ > $@
-
-expected/test-pagc_normalize_address.out: sql_bits/test_tuples_only_unaligned.sql.in ../../extras/tiger_geocoder/regress/pagc_normalize_address_regress
+
+expected/test-pagc_normalize_address.out: sql_bits/test_tuples_only_unaligned.sql.in ../../extras/tiger_geocoder/regress/pagc_normalize_address_regress | expected
cat $^ > $@
-
+
## adding \t .. to force output to be the same as what get in regular regress in tiger folder
-sql/test-normalize_address.sql: sql_bits/test_tuples_only_unaligned.sql.in ../../extras/tiger_geocoder/regress/normalize_address_regress.sql
- mkdir -p sql
+sql/test-normalize_address.sql: sql_bits/test_tuples_only_unaligned.sql.in ../../extras/tiger_geocoder/regress/normalize_address_regress.sql | sql
cat $^ > $@
-
-sql/test-upgrade.sql:
- mkdir -p sql
+
+sql/test-upgrade.sql: | sql
echo 'ALTER EXTENSION ${EXTENSION} UPDATE TO "$(EXTVERSION)next"' > $@
-
-expected/test-upgrade.out: sql/test-upgrade.sql
+
+expected/test-upgrade.out: sql/test-upgrade.sql | expected
cp $< $@
-
-sql/test-pagc_normalize_address.sql: sql_bits/test_tuples_only_unaligned.sql.in ../../extras/tiger_geocoder/regress/pagc_normalize_address_regress.sql
- mkdir -p sql
+
+sql/test-pagc_normalize_address.sql: sql_bits/test_tuples_only_unaligned.sql.in ../../extras/tiger_geocoder/regress/pagc_normalize_address_regress.sql | sql
cat $^ > $@
-
-sql/$(EXTENSION).sql: sql_bits/tiger_geocoder.sql sql_bits/mark_editable_objects.sql.in sql_bits/tiger_geocoder_comments.sql
- mkdir -p sql
+
+sql/$(EXTENSION).sql: sql_bits/tiger_geocoder.sql sql_bits/mark_editable_objects.sql.in sql_bits/tiger_geocoder_comments.sql | sql
cat $^ > $@
-
+
#this is a cludge to allow upgrading from same SVN to same SVN
-sql/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql: ../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
- mkdir -p sql
+sql/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql: ../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 | sql
cat $^ > $@
echo "SELECT postgis_extension_drop_if_exists('${EXTENSION}', 'DROP SCHEMA tiger_data');" >> $@
cat ../postgis_extension_helper_uninstall.sql >> $@
-
-
-sql/$(EXTENSION)--$(EXTVERSION)next--$(EXTVERSION).sql: sql/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql
- mkdir -p sql
+
+
+sql/$(EXTENSION)--$(EXTVERSION)next--$(EXTVERSION).sql: sql/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql | sql
cp $< $@
-
+
#strip BEGIN/COMMIT since these are not allowed in extensions
-#strip CREATE SCHEMA since we force extension
+#strip CREATE SCHEMA since we force extension
# to create schema by setting schema to tiger_geocoder in control
#also remove tiger_data from extension if it is part of it
sql_bits/tiger_geocoder_minor.sql.in: ../../extras/tiger_geocoder/utility/set_search_path.sql \
@@ -123,7 +117,7 @@
../../extras/tiger_geocoder/geocode/reverse_geocode.sql \
../../extras/tiger_geocoder/geocode/census_tracts_functions.sql
cat $^ > $@
-
+
#also remove tiger_data from extension if it is part of it so data gets backed up
sql_bits/tiger_geocoder.sql.in: sql_bits/norm_addy_create.sql.in \
../../extras/tiger_geocoder/utility/set_search_path.sql \
@@ -164,20 +158,20 @@
cat $^ > $@
echo "SELECT postgis_extension_drop_if_exists('${EXTENSION}', 'DROP SCHEMA tiger_data');" >> $@
cat ../postgis_extension_helper_uninstall.sql >> $@
-
+
sql_bits/tiger_geocoder.sql: sql_bits/tiger_geocoder.sql.in
sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' -e '/^CREATE SCHEMA/d;' $< > $@
$(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' $< > $@
-
+
sql_bits/add_search_path.sql: sql_bits/add_search_path.sql.in
cp $< $@
-
+
../../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
@@ -192,33 +186,31 @@
# -e 's/\\(;/;/' \
# -e 's/;;/;/g' $< > $@
-#hardcode for now using
+#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
- mkdir -p sql
+sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: sql_bits/tiger_geocoder--unpackaged.sql.in | sql
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
+#second deletes all non-removable defined on multiple lines
# the end of the body of object we assume ends in ;
-#aggregates are special
+#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_minor.sql.in
- mkdir -p sql
+sql/tiger_geocoder_upgrade_minor.sql: sql_bits/tiger_geocoder_minor.sql.in | sql
sed -e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\).*;/d' \
-e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\)/,/\;/d' \
-e 's/BEGIN;//g' -e 's/COMMIT;//g' \
$< > $@
-
+
sql_minor_upgrade: sql/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql
for OLD_VERSION in $(UPGRADEABLE_VERSIONS); do \
cat $^ > sql/$(EXTENSION)--$$OLD_VERSION--$(EXTVERSION).sql; \
done
-#only extension files
+#only extension files
DATA = ${EXTENSION}.control sql/$(EXTENSION).sql $(wildcard sql/*--*.sql)
EXTRA_CLEAN += $(wildcard expected/*--*.out)
EXTRA_CLEAN += sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql
More information about the postgis-tickets
mailing list