Make download_data folder be configurable with DOWNLOAD_DATADIR env. Revise reallie to use a download folder outside of repo

This commit is contained in:
Regina Obe 2021-07-01 13:52:48 -04:00
parent a67f904c3a
commit ba050a61b0
6 changed files with 30 additions and 10 deletions

1
.gitignore vendored
View file

@ -153,6 +153,7 @@ regress/dumper/Makefile
regress/loader/Makefile
regress/real/download_data
regress/real/Makefile
regress/real/load_data.sql
regress/sfcgal/Makefile
regress/postgis.sql
regress/postgis_garden_result.txt

View file

@ -8,7 +8,7 @@
## TODO: Determine what will trigger reallie to move
export WORKSPACE=/home/jenkins/workspace
export DOWNLOAD_DATADIR=${WORKSPACE}/download_data
cd ${WORKSPACE}/PostGIS_Worker_Run/label/${label}/$BRANCH
export OS_BUILD=64
export PG_VER=14

View file

@ -1,6 +1,4 @@
DATABASE=postgis_reg
PSQL=psql
PERL=@PERL@
# MingW hack: rather than use PGSQL_BINDIR directly, we change to the directory and
@ -8,6 +6,10 @@ PERL=@PERL@
# format, otherwise colons in drive letters will break PATH.
PGSQL_BINDIR=$(shell cd "@PGSQL_BINDIR@" && pwd)
ifndef DOWNLOAD_DATADIR
DOWNLOAD_DATADIR=$(srcdir)/download_data
endif
#
# Put path from pg_config into front of search path
#
@ -19,10 +21,17 @@ all:
download_data:
sh download_data.sh
clean distclean:
rm -f download_data
check-regress-deps: download_data
%.sql: %.sql.in
$(PERL) -lpe "s'@DOWNLOAD_DATADIR@'$(DOWNLOAD_DATADIR)'g" $< > $@
clean:
rm -f load_data.sql
distclean: clean
rm -rf $(DOWNLOAD_DATADIR)
check-regress-deps: download_data load_data.sql
check-regress: check-regress-deps
topsrcdir = $(realpath ../../)

View file

@ -8,6 +8,11 @@ It includes a download_data.sh script that downloads data from http://postgis.ne
Data in http://postgis.net/extra/test-data is currently sourced from Census Tiger and OSM data sources and is packaged
in a format suitable for load by psql.
If you want to control where the data is downloaded to, set env variable
export DOWNLOAD_DATADIR=/path/to_download_data
If path is not set, a download_data folder will created in this folder and removed with make distclean
The data sources available there are as follows:
tiger_national.sql.bz2 - this requires the postgis_tiger_geocoder extension to be loaded before hand as it inherits from the tables packaged with that. The data is from https://www2.census.gov/geo/tiger/TIGER2020/ (zcta5, state, county)

View file

@ -1,5 +1,5 @@
ALTER TABLE tiger.zcta5 DROP CONSTRAINT IF EXISTS enforce_geotype_the_geom;
\i download_data/tiger_national.sql
\i download_data/tiger_dc.sql
\i download_data/osm_china.sql
\i download_data/osm_belarus.sql
\i C:/ming64gcc81/projects/postgis/tmp/download_data/tiger_national.sql
\i C:/ming64gcc81/projects/postgis/tmp/download_data/tiger_dc.sql
\i C:/ming64gcc81/projects/postgis/tmp/download_data/osm_china.sql
\i C:/ming64gcc81/projects/postgis/tmp/download_data/osm_belarus.sql

View file

@ -0,0 +1,5 @@
ALTER TABLE tiger.zcta5 DROP CONSTRAINT IF EXISTS enforce_geotype_the_geom;
\i @DOWNLOAD_DATADIR@/tiger_national.sql
\i @DOWNLOAD_DATADIR@/tiger_dc.sql
\i @DOWNLOAD_DATADIR@/osm_china.sql
\i @DOWNLOAD_DATADIR@/osm_belarus.sql