Project

General

Profile

« Previous | Next » 

Revision 4452

input.Makefile: Support empty subdirs referencing an already-installed staging table everywhere, by replacing $(isCsv) with new $(nonXml) where needed

View differences:

inputs/input.Makefile
158 158
nonHeaderSrcs = $(filter-out %/header.csv,$(srcs))
159 159
isRef = $(if $(nonHeaderSrcs),,1)
160 160
    # empty subdir, so references an already-installed staging table
161
isCsv = $(if $(nonHeaderSrcs),$(if $(filter %.xml,$(nonHeaderSrcs)),,1))
161
isXml = $(filter %.xml,$(nonHeaderSrcs))
162
nonXml = $(if $(isXml),,1)
163
isCsv = $(if $(nonHeaderSrcs),$(if $(isXml),,1))
162 164
    # true if $(srcs) non-empty and contains no *.xml
163 165
catSrcs = $(bin)/cat$(if $(isCsv),_csv) $(srcs)
164 166
withCatSrcs = $(catSrcs:$(bin)/%=$(bin)/with_%) --
......
228 230
hasRowNum = $(if $(isJoinedTable),,1)
229 231

  
230 232
%/install: _always
231
	$(if $(isCsv),$(import_install_),$(if $(isRef),$(exportHeader)))
233
	$(if $(nonXml),$(import_install_),$(if $(isRef),$(exportHeader)))
232 234
import_install_ = (prefix=; . $(bin)/vegbien_dest; "time" nice -n +5\
233 235
env schema=$(datasrc) table=$* has_row_num=$(hasRowNum) $(bin)/csv2db\
234 236
$(catSrcs) $(if $(log),$(if $(quiet),&>,2>&1|tee )$*/logs/install.log.sql))
......
253 255
else
254 256
# Autogen src maps with known table names
255 257
%/src.csv: _always
256
	$(if $(wildcard $@),,$(if $(isCsv),$(mkSrcMap)))
257
	+$(if $(isCsv),$(selfMake) $(@:%/src.csv=%/.src.csv.last_cleanup))
258
	$(if $(wildcard $@),,$(if $(nonXml),$(mkSrcMap)))
259
	+$(if $(nonXml),$(selfMake) $(@:%/src.csv=%/.src.csv.last_cleanup))
258 260
# only build if doesn't exist
259 261
# only build if CSV srcs exist for that table name
260 262
endif
......
418 420
# Requires staging tables. To create them, run `make inputs/<datasrc>/install`.
419 421
# Non-flat-file inputs fall back to mimicking a successful test
420 422
%/test.xml: %/VegBIEN.csv _always
421
	$(if $(isCsv),$(call runTest,by_col=))
423
	$(if $(nonXml),$(call runTest,by_col=))
422 424
tests += %/test.xml
423 425

  
424 426
%/test.by_col.xml: %/VegBIEN.csv _always
425
	-$(if $(isCsv),$(call runTest,by_col=1))
427
	-$(if $(nonXml),$(call runTest,by_col=1))
426 428
# Don't abort tester if only by-column test fails
427 429

  
428 430
# Only run column-based tests if column-based mode enabled, because these tests

Also available in: Unified diff