From ca00174682837ffd699d4cb4d416b463b826b6b6 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Wed, 29 Jul 2026 01:00:28 +0200 Subject: [PATCH] Add a one-command refresh against upstream MEOS tools/refresh-from-master.sh refreshes the generated functions/ package against upstream MEOS in one command: it runs the shared MEOS-API refresh-binding.sh over this repo, deriving the catalog and libmeos from MobilityDB master and regenerating the wrappers via tools/codegen.py. tools/refresh.conf holds this binding's last leg (the go build, LD/CGO flags pointing at the derived libmeos prefix). .gitignore excludes the .meos-chain scratch. Byte-identical wrapper and the same refresh.conf shape as every other MobilityDB binding. --- .gitignore | 3 +++ tools/refresh-from-master.sh | 35 +++++++++++++++++++++++++++++++++++ tools/refresh.conf | 12 ++++++++++++ 3 files changed, 50 insertions(+) create mode 100755 tools/refresh-from-master.sh create mode 100644 tools/refresh.conf diff --git a/.gitignore b/.gitignore index f786007..af30002 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ cgo_flag_config.go # provision-meos action (MEOS-API run.py), never committed. The flat FFI # functions package is projected from it and IS committed. tools/meos-idl.json + +# tools/refresh-from-master.sh scratch (sibling clones + libmeos prefix). +.meos-chain/ diff --git a/tools/refresh-from-master.sh b/tools/refresh-from-master.sh new file mode 100755 index 0000000..fa68784 --- /dev/null +++ b/tools/refresh-from-master.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# refresh-from-master.sh — refresh this binding's generated surface against the latest MEOS API, +# end to end, with one command: +# +# tools/refresh-from-master.sh +# +# It runs the shared MobilityDB/MEOS-API refresh-binding.sh over this repo — deriving the catalog +# and libmeos from the latest MobilityDB master and regenerating this binding's surface. The +# per-binding last leg is in tools/refresh.conf. +# +# All of refresh-binding.sh's options pass through, e.g.: +# tools/refresh-from-master.sh --mdb ~/src/MobilityDB # refresh against a local MobilityDB branch +# tools/refresh-from-master.sh --skip-tests # regenerate + build, skip the tests +# +# MEOSAPI= uses an existing MEOS-API checkout (any branch); otherwise MEOS-API master is +# cloned into the work dir. WORK_DIR overrides the scratch location (default /.meos-chain). +set -euo pipefail + +HERE="$(cd "$(dirname "$0")/.." && pwd)" +WORK="${WORK_DIR:-$HERE/.meos-chain}" +MEOSAPI="${MEOSAPI:-}" + +if [ -z "$MEOSAPI" ]; then + MEOSAPI="$WORK/MEOS-API" + mkdir -p "$WORK" + if [ -d "$MEOSAPI/.git" ]; then + git -C "$MEOSAPI" fetch --quiet https://github.com/MobilityDB/MEOS-API master + git -C "$MEOSAPI" checkout --quiet FETCH_HEAD + else + git clone --quiet https://github.com/MobilityDB/MEOS-API "$MEOSAPI" + fi +fi + +exec "$MEOSAPI/tools/refresh-binding.sh" \ + --binding "$HERE" --meos-api "$MEOSAPI" --work-dir "$WORK" "$@" diff --git a/tools/refresh.conf b/tools/refresh.conf new file mode 100644 index 0000000..98f709f --- /dev/null +++ b/tools/refresh.conf @@ -0,0 +1,12 @@ +# refresh.conf — GoMEOS's last leg for tools/refresh-binding.sh (in MEOS-API). +# The chain (MobilityDB -> catalog + libmeos) is shared; only these differ per binding. +# BUILD_CMD runs from / with $PREFIX (the libmeos install prefix) and $CATALOG +# exported; $SKIP_TESTS is set when --skip-tests is passed. tools/codegen.py reads the catalog +# staged at CATALOG_DEST and regenerates the committed functions/ package. +ENGINE=go +BUILD_DIR=. +BUILD_LIBMEOS=true +CATALOG_DEST=tools/meos-idl.json +BUILD_CMD='python3 tools/codegen.py + CGO_CFLAGS="-I$PREFIX/include -I/usr/include/h3" CGO_LDFLAGS="-L$PREFIX/lib -lmeos" LD_LIBRARY_PATH="$PREFIX/lib" go build ./functions + [ -n "${SKIP_TESTS:-}" ] || CGO_ENABLED=0 go test ./tools/parity/'