From 8ec986e01d9a714f169005829c0ccf9a3d2b6c12 Mon Sep 17 00:00:00 2001 From: zstadler Date: Wed, 6 Oct 2021 19:02:52 +0300 Subject: [PATCH] Expose `make all` errors (#1254) Avoid redirection of error messages to output files - build/openmaptiles.tm2source/data.yml - build/mapping.yaml Currently, if an error occurs when `make all` creates any of these files, the error message is not printed to the console. ``` docker-compose run --rm --user=1000:1000 openmaptiles-tools generate-tm2source openmaptiles.yaml --host="postgres" --port=5432 --database="openmaptiles" --user="openmaptiles" --password="openmaptiles" > build/openmaptiles.tm2source/data.yml Creating openmaptiles_openmaptiles-tools_run ... done ERROR: 1 make: *** [Makefile:257: build/openmaptiles.tm2source/data.yml] Error 1 ``` An inexperienced user would not know where to look for the details. With this PR, the error is sent to the console: ``` docker-compose run --rm --user=1000:1000 openmaptiles-tools bash -c \ 'generate-tm2source openmaptiles.yaml --host="postgres" --port=5432 --database="openmaptiles" --user="openmaptiles" --password="openmaptiles" > build/openmaptiles.tm2source/data.yml' Creating openmaptiles_openmaptiles-tools_run ... done Could not parse /tileset/layers/aeroway/mapping.yaml found undefined alias 'refkjbkjkhh' in "/tileset/layers/aeroway/mapping.yaml", line 94, column 7 ERROR: 1 make: *** [Makefile:257: build/openmaptiles.tm2source/data.yml] Error 1 ``` Redirection of stdout is now done in the container, leaving stderr to go to the host. --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ad5e1798..b112c465 100644 --- a/Makefile +++ b/Makefile @@ -254,12 +254,14 @@ init-dirs: build/openmaptiles.tm2source/data.yml: init-dirs ifeq (,$(wildcard build/openmaptiles.tm2source/data.yml)) - $(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools generate-tm2source $(TILESET_FILE) --host="$(PGHOST)" --port=$(PGPORT) --database="$(PGDATABASE)" --user="$(PGUSER)" --password="$(PGPASSWORD)" > $@ + $(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c \ + 'generate-tm2source $(TILESET_FILE) --host="$(PGHOST)" --port=$(PGPORT) --database="$(PGDATABASE)" --user="$(PGUSER)" --password="$(PGPASSWORD)" > $@' endif build/mapping.yaml: init-dirs ifeq (,$(wildcard build/mapping.yaml)) - $(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools generate-imposm3 $(TILESET_FILE) > $@ + $(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c \ + 'generate-imposm3 $(TILESET_FILE) > $@' endif .PHONY: build-sql