Skip to content

Commit ca00174

Browse files
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.
1 parent ad73768 commit ca00174

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ cgo_flag_config.go
44
# provision-meos action (MEOS-API run.py), never committed. The flat FFI
55
# functions package is projected from it and IS committed.
66
tools/meos-idl.json
7+
8+
# tools/refresh-from-master.sh scratch (sibling clones + libmeos prefix).
9+
.meos-chain/

tools/refresh-from-master.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
# refresh-from-master.sh — refresh this binding's generated surface against the latest MEOS API,
3+
# end to end, with one command:
4+
#
5+
# tools/refresh-from-master.sh
6+
#
7+
# It runs the shared MobilityDB/MEOS-API refresh-binding.sh over this repo — deriving the catalog
8+
# and libmeos from the latest MobilityDB master and regenerating this binding's surface. The
9+
# per-binding last leg is in tools/refresh.conf.
10+
#
11+
# All of refresh-binding.sh's options pass through, e.g.:
12+
# tools/refresh-from-master.sh --mdb ~/src/MobilityDB # refresh against a local MobilityDB branch
13+
# tools/refresh-from-master.sh --skip-tests # regenerate + build, skip the tests
14+
#
15+
# MEOSAPI=<path> uses an existing MEOS-API checkout (any branch); otherwise MEOS-API master is
16+
# cloned into the work dir. WORK_DIR overrides the scratch location (default <repo>/.meos-chain).
17+
set -euo pipefail
18+
19+
HERE="$(cd "$(dirname "$0")/.." && pwd)"
20+
WORK="${WORK_DIR:-$HERE/.meos-chain}"
21+
MEOSAPI="${MEOSAPI:-}"
22+
23+
if [ -z "$MEOSAPI" ]; then
24+
MEOSAPI="$WORK/MEOS-API"
25+
mkdir -p "$WORK"
26+
if [ -d "$MEOSAPI/.git" ]; then
27+
git -C "$MEOSAPI" fetch --quiet https://github.com/MobilityDB/MEOS-API master
28+
git -C "$MEOSAPI" checkout --quiet FETCH_HEAD
29+
else
30+
git clone --quiet https://github.com/MobilityDB/MEOS-API "$MEOSAPI"
31+
fi
32+
fi
33+
34+
exec "$MEOSAPI/tools/refresh-binding.sh" \
35+
--binding "$HERE" --meos-api "$MEOSAPI" --work-dir "$WORK" "$@"

tools/refresh.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# refresh.conf — GoMEOS's last leg for tools/refresh-binding.sh (in MEOS-API).
2+
# The chain (MobilityDB -> catalog + libmeos) is shared; only these differ per binding.
3+
# BUILD_CMD runs from <repo>/<BUILD_DIR> with $PREFIX (the libmeos install prefix) and $CATALOG
4+
# exported; $SKIP_TESTS is set when --skip-tests is passed. tools/codegen.py reads the catalog
5+
# staged at CATALOG_DEST and regenerates the committed functions/ package.
6+
ENGINE=go
7+
BUILD_DIR=.
8+
BUILD_LIBMEOS=true
9+
CATALOG_DEST=tools/meos-idl.json
10+
BUILD_CMD='python3 tools/codegen.py
11+
CGO_CFLAGS="-I$PREFIX/include -I/usr/include/h3" CGO_LDFLAGS="-L$PREFIX/lib -lmeos" LD_LIBRARY_PATH="$PREFIX/lib" go build ./functions
12+
[ -n "${SKIP_TESTS:-}" ] || CGO_ENABLED=0 go test ./tools/parity/'

0 commit comments

Comments
 (0)