Skip to content

Commit

Permalink
Use h3 minimum version from Makefile in static_assert
Browse files Browse the repository at this point in the history
  • Loading branch information
zachasme committed Jun 13, 2019
1 parent 227e84f commit 987a71f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 34 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ EXTENSION = h3
EXTVERSION = $(shell grep default_version $(EXTENSION).control | \
sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")

LIBH3_VERSION = v3.4.4
LIBH3_REQUIRED_MAJOR = 3
LIBH3_REQUIRED_MINOR = 4
LIBH3_REQUIRED_PATCH = 4
LIBH3_VERSION = v${LIBH3_REQUIRED_MAJOR}.${LIBH3_REQUIRED_MINOR}.${LIBH3_REQUIRED_PATCH}
LIBH3_REQUIRED_PATCH = 0
LIBH3_DIR = libh3-${LIBH3_VERSION}

INSTALL_FILES = $(wildcard sql/install/*.sql)
Expand Down
43 changes: 14 additions & 29 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,19 @@

We provide a Dockerfile for development without installation of H3 and Postgres. The following requires that your system has `docker` installed.

First, build the docker image:

```
docker build -t h3-pg .
```

Then, build the extension and run the test suite:

```
docker run --rm h3-pg
```

Afterwards, to quickly build and test changes, run:

```
chmod -R 777 .
docker run --rm -it -v "$PWD":/tmp/h3-pg h3-pg
```
Simply run `./docker/build.sh`.

It will mount the code as a volume, and also mount the test output directory,
so output can be inspected. The chmod might be needed if you get permission
denied errors.

## Distribution on PGXN

Zip it up
```
git archive --format zip --prefix=h3-x.x.x/ --output h3-x.x.x.zip master
```

Upload it on https://manager.pgxn.org/
so output can be inspected. It might be needed to `chmod` the repo directory if you get permission denied errors.

## Release Process

1. Update version number
* Don't follow semver, simply use major and minor from H3 core and increment patch.
* Version number should be changed in `h3.control` and `META.json`.
2. Create a release on GitHub
* Draft new release "vX.Y.Z"
* Copy CHANGELOG.md entry into release description
3. Distribute the extension on PGXN
* Run `make distribute` to zip the release
* Upload the distribution on [PGXN Manager](https://manager.pgxn.org/) (username: `bytesandbrains`)
4 changes: 2 additions & 2 deletions src/extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
PG_MODULE_MAGIC;

static_assert(
H3_VERSION_MAJOR == LIBH3_REQUIRED_MAJOR && H3_VERSION_MINOR >= LIBH3_REQUIRED_MINOR,
"Installed H3 must be at least version 3.3.0"
H3_VERSION_MAJOR == LIBH3_REQUIRED_MAJOR && H3_VERSION_MINOR >= LIBH3_REQUIRED_MINOR && H3_VERSION_PATCH >= LIBH3_REQUIRED_PATCH,
"Installed H3 must be at least version " LIBH3_REQUIRED_VERSION_STRING
);

/**
Expand Down
1 change: 1 addition & 0 deletions src/extension.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ typedef struct
#define LIBH3_REQUIRED_MAJOR @LIBH3_REQUIRED_MAJOR@
#define LIBH3_REQUIRED_MINOR @LIBH3_REQUIRED_MINOR@
#define LIBH3_REQUIRED_PATCH @LIBH3_REQUIRED_PATCH@
#define LIBH3_REQUIRED_VERSION_STRING "@LIBH3_REQUIRED_MAJOR@.@LIBH3_REQUIRED_MINOR@.@LIBH3_REQUIRED_PATCH@"

/* base type in postgres is Datum, and we cannot fit 8 bytes on all platforms
so we use pointers */
Expand Down
2 changes: 1 addition & 1 deletion src/indexing.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Datum h3_to_geo_boundary(PG_FUNCTION_ARGS)
lon = boundary.verts[v].lon;
lat = boundary.verts[v].lat;

if (extend && abs(lon - firstLon) > M_PI) // check if different sign
if (extend && fabs(lon - firstLon) > M_PI) // check if different sign
lon = lon + delta;

polygon->p[v].x = radsToDegs(lon);
Expand Down

0 comments on commit 987a71f

Please sign in to comment.