From a39cb79f4a37eb94b96bf466ee7977b2572855cc Mon Sep 17 00:00:00 2001 From: Jannis R Date: Tue, 9 Dec 2025 23:48:28 +0100 Subject: [PATCH 1/3] chore!: require at least Make v3.82 --- README.md | 2 +- makefile | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d8a693f..25e1f6b 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Thanks to everybody contributing to these tools, the OSM community and Geofabrik You'll need to have Docker installed. -Also, make sure you're using the *GNU* flavor of `make`. The BSD `make` (e.g. on macOS) is not fully compatible with this project. +Also, make sure you're using the *GNU* flavor of `make`, at least v3.82. The BSD `make` (e.g. on macOS) is not fully compatible with this project. ### Running GTFS-Hub diff --git a/makefile b/makefile index c301641..3571c7f 100644 --- a/makefile +++ b/makefile @@ -1,3 +1,11 @@ +# https://stackoverflow.com/a/12231321/1072129 +# Check Make version (we need at least GNU Make 3.82). Fortunately, +# 'undefine' directive has been introduced exactly in GNU Make 3.82. +ifeq ($(filter undefine,$(value .FEATURES)),) +$(error Unsupported Make version. \ + gtfs-hub does not work with GNU Make $(MAKE_VERSION), please use GNU Make 3.82 or above.) +endif + HOST_MOUNT = $(shell set +e +u; if [ -n "$$HOST_MOUNT" ]; then echo "$$HOST_MOUNT"; else echo "$$PWD"; fi) TOOL_CFG = /cfg TOOL_DATA = /data From 989d8fbfbac41c3b66caea664bed07ea9525aa10 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Tue, 9 Dec 2025 23:50:03 +0100 Subject: [PATCH 2/3] feat: add %.gtfs.duckdb target --- makefile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/makefile b/makefile index 3571c7f..76098a9 100644 --- a/makefile +++ b/makefile @@ -25,6 +25,7 @@ OBA_MERGE_IMAGE=mfdz/onebusaway-gtfs-merge-cli:4.0.1-SNAPSHOT GTFSTIDY_IMAGE=derhuerst/gtfstidy OSMOSIS_IMAGE=mfdz/osmosis:0.47-1-gd370b8c4 PYOSMIUM_IMAGE=mfdz/pyosmium +GTFS_VIA_DUCKDB_IMAGE=ghcr.io/public-transport/gtfs-via-duckdb:5 .SUFFIXES: .DEFAULT_TARGET: gtfs @@ -53,6 +54,7 @@ PFAEDLE = docker run -i --rm -v $(HOST_MOUNT)/config:$(TOOL_CFG) -v $(HOST_MOUNT MERGE = docker run -v $(HOST_MOUNT)/data/gtfs:$(TOOL_DATA)/gtfs --rm -e JAVA_TOOL_OPTIONS="-Xmx18g" $(OBA_MERGE_IMAGE) --file=stops.txt --duplicateDetection=identity GTFSVTOR = docker run -i --rm -v $(HOST_MOUNT)/data/gtfs:$(TOOL_DATA)/gtfs -v $(HOST_MOUNT)/data/www:$(TOOL_DATA)/www -e GTFSVTOR_OPTS=-Xmx8G $(GTFSVTOR_IMAGE) GTFSTIDY = docker run -i --rm -v $(HOST_MOUNT)/data/gtfs:$(TOOL_DATA)/gtfs $(GTFSTIDY_IMAGE) +GTFS_VIA_DUCKDB = docker run -i --rm -v $(HOST_MOUNT)/data/gtfs:$(TOOL_DATA)/gtfs -v $(HOST_MOUNT)/data/www:$(TOOL_DATA)/www -w / $(GTFS_VIA_DUCKDB_IMAGE) # Download/Update OSM extracts from Geofabrik @@ -233,6 +235,26 @@ data/www/gtfsvtor_%.html: data/gtfs/%.raw.gtfs $(info running GTFSVTOR on the $* GTFS feed) 2>/dev/null $(GTFSVTOR) -o $(TOOL_DATA)/www/$(@F) -p -l 1000 $(TOOL_DATA)/gtfs/$(data/gtfs/$*.gtfsvtor.log +# run all shell commands in one shell +# > The .ONESHELL variable was added in GNU make 3.82. +.ONESHELL: data/www/%.gtfs.duckdb +data/www/%.gtfs.duckdb: data/gtfs/%.gtfs + $(info importing the $* GTFS feed into $(@F)) + + gtfs_files=() + shopt -s nullglob + for file in "data/gtfs/$( Date: Fri, 23 Jan 2026 12:02:15 +0100 Subject: [PATCH 3/3] WIP --- makefile | 9 +++++++++ patch_raw_gtfs.sh | 2 ++ 2 files changed, 11 insertions(+) diff --git a/makefile b/makefile index 76098a9..2a9e233 100644 --- a/makefile +++ b/makefile @@ -6,6 +6,11 @@ $(error Unsupported Make version. \ gtfs-hub does not work with GNU Make $(MAKE_VERSION), please use GNU Make 3.82 or above.) endif +# SHELL="/bin/bash" +# # > The .SHELLFLAGS variable was added in GNU make 3.82. +# # .SHELLFLAGS="-eu -O extglob -c" +# .SHELLFLAGS="-eux" + HOST_MOUNT = $(shell set +e +u; if [ -n "$$HOST_MOUNT" ]; then echo "$$HOST_MOUNT"; else echo "$$PWD"; fi) TOOL_CFG = /cfg TOOL_DATA = /data @@ -22,9 +27,11 @@ PFAEDLE_IMAGE=ghcr.io/ad-freiburg/pfaedle:2024-10-31t12-25 GTFSVTOR_IMAGE=mfdz/gtfsvtor OBA_TRANSFORMER_IMAGE=mfdz/onebusaway-gtfs-transformer-cli:4.0.1-SNAPSHOT OBA_MERGE_IMAGE=mfdz/onebusaway-gtfs-merge-cli:4.0.1-SNAPSHOT +# todo: use gtfsclean? GTFSTIDY_IMAGE=derhuerst/gtfstidy OSMOSIS_IMAGE=mfdz/osmosis:0.47-1-gd370b8c4 PYOSMIUM_IMAGE=mfdz/pyosmium +DUCKDB_GTFS_IMPORTER_IMAGE=ghcr.io/opendatavbb/duckdb-gtfs-importer:1 GTFS_VIA_DUCKDB_IMAGE=ghcr.io/public-transport/gtfs-via-duckdb:5 .SUFFIXES: @@ -54,6 +61,8 @@ PFAEDLE = docker run -i --rm -v $(HOST_MOUNT)/config:$(TOOL_CFG) -v $(HOST_MOUNT MERGE = docker run -v $(HOST_MOUNT)/data/gtfs:$(TOOL_DATA)/gtfs --rm -e JAVA_TOOL_OPTIONS="-Xmx18g" $(OBA_MERGE_IMAGE) --file=stops.txt --duplicateDetection=identity GTFSVTOR = docker run -i --rm -v $(HOST_MOUNT)/data/gtfs:$(TOOL_DATA)/gtfs -v $(HOST_MOUNT)/data/www:$(TOOL_DATA)/www -e GTFSVTOR_OPTS=-Xmx8G $(GTFSVTOR_IMAGE) GTFSTIDY = docker run -i --rm -v $(HOST_MOUNT)/data/gtfs:$(TOOL_DATA)/gtfs $(GTFSTIDY_IMAGE) +# todo +DUCKDB_GTFS_IMPORTER = docker run -i --rm -v $(HOST_MOUNT)/data/gtfs:$(TOOL_DATA)/gtfs -v $(HOST_MOUNT)/data/www:$(TOOL_DATA)/www $(DUCKDB_GTFS_IMPORTER_IMAGE) GTFS_VIA_DUCKDB = docker run -i --rm -v $(HOST_MOUNT)/data/gtfs:$(TOOL_DATA)/gtfs -v $(HOST_MOUNT)/data/www:$(TOOL_DATA)/www -w / $(GTFS_VIA_DUCKDB_IMAGE) diff --git a/patch_raw_gtfs.sh b/patch_raw_gtfs.sh index 2fd3477..0a20dba 100755 --- a/patch_raw_gtfs.sh +++ b/patch_raw_gtfs.sh @@ -5,6 +5,8 @@ set -o pipefail name=$1 gtfs_dir=$2 +# todo: keep original modification date+time + if [ "$1" == "SPNV-BW" ]; then 1>&2 echo "SPNV-BW routes.txt: filling missing agency_id values" set -x