diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 925b8ac..0000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [master] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fd906de..1a7db81 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,15 @@ +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit.com hooks + + for more information, see https://pre-commit.ci + autofix_prs: true + autoupdate_branch: '' + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: weekly + skip: [] + submodules: false + repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.0.1 diff --git a/import/import_planet.sh b/import/import_planet.sh index 2516857..2ab6dc7 100644 --- a/import/import_planet.sh +++ b/import/import_planet.sh @@ -11,7 +11,7 @@ export PGUSER='%(db_user)s' FLAT_NODES_BUCKET='%(flat_nodes_bucket)s' FLAT_NODES_KEY='%(flat_nodes_key)s' export AWS_DEFAULT_REGION='%(aws_region)s' -export OSM2PGSQL='/usr/bin/osm2pgsql' +export OSM2PGSQL='/usr/local/bin/osm2pgsql' VECTOR_DATASOURCE_VERSION='%(vector_datasource_version)s' # we don't want the STATUS file moving around while we change working directories, especially if @@ -71,6 +71,21 @@ sudo DEBIAN_FRONTEND=noninteractive apt update sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y -q sudo DEBIAN_FRONTEND=noninteractive apt install -y -q make g++ git awscli build-essential autoconf libtool pkg-config python-dev python3-pip python3-virtualenv python-pil libxml2-dev libxslt-dev unzip postgis osm2pgsql +# make osm2pgsql from source +if [[ ! -f "${OSM2PGSQL}" ]]; then + git clone git://github.com/openstreetmap/osm2pgsql.git + cd osm2pgsql + git checkout tags/1.5.1 + sudo DEBIAN_FRONTEND=noninteractive sudo apt install -y -q make cmake g++ libboost-dev libboost-system-dev \ + libboost-filesystem-dev libexpat1-dev zlib1g-dev \ + libbz2-dev libpq-dev libproj-dev lua5.3 liblua5.3-dev pandoc + mkdir build && cd build + cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF + make + sudo make install + cd ../.. +fi + # if there's no planet, then download it if [[ ! -f "planet/${PLANET_FILE}" ]]; then echo "downloading planet" > $STATUS @@ -112,7 +127,7 @@ ntuples=`psql -t -c "select sum(n_live_tup) from pg_stat_user_tables where relna if [[ $ntuples -eq 0 ]]; then # no existing data => run osm2pgsql! echo "running osm2pgsql" > $STATUS - (cd vector-datasource && $OSM2PGSQL --slim --hstore-all -C 61440 -S osm2pgsql.style -d "$PGDATABASE" -U "$PGUSER" -H "$PGHOST" --flat-nodes ../flat.nodes --number-processes 16 "../planet/${PLANET_FILE}") + (cd vector-datasource && $OSM2PGSQL --slim --hstore-all -C 61440 -S osm2pgsql.lua -O flex -d "$PGDATABASE" -U "$PGUSER" -H "$PGHOST" --flat-nodes ../flat.nodes --number-processes 16 "../planet/${PLANET_FILE}") fi # if flat nodes file already exists in S3, don't upload it again