From cedef425802366a75c6018ffd1dad7b85f4996e0 Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Thu, 6 Jul 2023 23:41:29 +0200 Subject: [PATCH 01/18] Fix Iceland, Faroe and Svalbard, use Sonny's LiDAR This fixes many mesh problems by using Sonny's digital terrain models from https://sonny.4lima.de/ for Europe. Please consider a donation to Sonny for the great DTM that he is producing and publishing for free. --- .github/workflows/build-tiles.yml | 5 +- .gitignore | 2 + Makefile.tiles | 101 ++++++++++++++++++++++++++---- bin/genMakefileElevationRules | 23 +++++++ bin/prepareAssetsElevationData | 30 +++++++++ test_tile_list | 8 +++ 6 files changed, 155 insertions(+), 14 deletions(-) create mode 100755 bin/genMakefileElevationRules create mode 100755 bin/prepareAssetsElevationData diff --git a/.github/workflows/build-tiles.yml b/.github/workflows/build-tiles.yml index 1759148..32a4c62 100644 --- a/.github/workflows/build-tiles.yml +++ b/.github/workflows/build-tiles.yml @@ -22,6 +22,7 @@ jobs: env: DEBIAN_FRONTEND: noninteractive TZ: America/NewYork + GH_TOKEN: ${{ github.token }} runs-on: ubuntu-22.04 @@ -42,7 +43,7 @@ jobs: - name: Test run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks - TILENAME=${{ inputs.setname }} make -n -f Makefile.tiles ${{ inputs.zip }} + TILENAME=${{ inputs.setname }} make -n -f Makefile.tiles ${{ inputs.zip }} -j $(nproc) - name: Setup Ortho4XP run: make Ortho4XP @@ -51,7 +52,7 @@ jobs: id: build run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks - TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }} && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" + TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }} -j $(nproc) && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" - name: Show work if: steps.build.outputs.done == 'true' diff --git a/.gitignore b/.gitignore index fec8021..55bfdb4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.swp Ortho4XP *_tile_list.* +/var/ +/.venv/ diff --git a/Makefile.tiles b/Makefile.tiles index 1df2153..32543e8 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -1,30 +1,52 @@ +# Requires Github CLI (gh) command to facilitate authenticated requests to the API +# +# Quick start: +# make -f Makefile.tiles clean +# make -f Makefile.tiles test_tile_list_chunks +# make -f Makefile.tiles -j $(nproc --ignore=2) + +# @todo: make release in kubilus/autoortho-scenery, see ./bin/prepareAssetsElevationData +ELEV_RELEASE_JSON_ENDPOINT?=repos/jonaseberle/autoortho-scenery/releases/tags/elevation-v0.0.1 SPLITSIZE?=125 SHELL=/bin/bash ZL?=16 TILENAME?=test -TILES:=$(addprefix z_$(TILENAME)_, $(shell ls $(TILENAME)_tile_list.* | awk -F. '{ print $$2 }') ) +TILES:=$(addprefix z_$(TILENAME)_, $(shell ls $(TILENAME)_tile_list.* 2>/dev/null | awk -F. '{ print $$2 }') ) TILE_ZIPS=$(addsuffix .zip, $(TILES)) ZIPS=$(TILE_ZIPS) +# paranthesis to use in shell commands +# make chokes on () in shell commands +OP:=( +CP:=) + # Get the tiles listed in each list file .SECONDEXPANSION: -TILE_FILES = $(addsuffix .dsf, $(addprefix Ortho4XP/Tiles/*/*/*/, $(basename $(shell cat $(TILENAME)_tile_list.$* ) ) ) ) -#TILE_FILES = $(basename $(shell cat $(TILENAME)_tile_list.$* ) ) - +TILE_FILES = $(addsuffix .dsf, $(addprefix Ortho4XP/Tiles/*/*/*/, $(basename $(shell cat $(TILENAME)_tile_list.$* 2>/dev/null ) ) ) ) all: $(ZIPS) +# creates directories +%/: + @echo [$@] + @mkdir -p $@ + +# +# Work on tile lists +# + z_$(TILENAME)_%: $(TILENAME)_tile_list.% $${TILE_FILES} - @echo "Going to do some $@" + @echo [$@] @echo "Expected tile len:" @cat $< | wc -l @echo "Actual tile len:" @unzip -l $@.zip *.dsf | grep dsf | wc -l z_$(TILENAME)_%.zip.info: $(TILENAME)_tile_list.% + @echo [$@] @echo "-----------------------------------" @echo "Post processing info:" comm --total -3 <( unzip -l $(basename $@) *.dsf | awk -F/ '/.*\.dsf/ { print $$4 }' | sort ) <( cat $< | sort ) @@ -34,23 +56,67 @@ z_$(TILENAME)_%.zip.info: $(TILENAME)_tile_list.% echo "Expected tile len: $$EXPECTED"; \ echo "Actual tile len: $$ACTUAL"; \ [ $$EXPECTED -eq $$ACTUAL ] + # # Ortho4XP setup # ortho4xp.diff: + @echo [$@] cd Ortho4XP && git diff > ../ortho4xp.diff Ortho4XP: + @echo [$@] git clone --depth=1 https://github.com/oscarpilote/Ortho4XP.git cd $@ && patch -p1 -u < ../ortho4xp.diff cp extract_overlay.py $@/. cp Ortho4XP.cfg $@/. mkdir $@/tmp + @echo "Setting up symlinks in order to not care about Ortho4XP's expected directory structure in ./Elevation_data..." + mkdir -p $@/Elevation_data && cd $@/Elevation_data \ + && bash -c 'for lat in {-9..9}; do for lon in {-18..18}; do ln -snfr ./ "./$$(printf "%+d0%+03d0" "$$lat" "$$lon")"; done; done' + +# +# Custom tile elevation +# +# generates the targets var/run/neighboursOfTile_%.elevation with surrounding tiles' elevations +# as prerequisites (takes a little while, 360*180 rules): +var/run/Makefile.elevationRules: | $$(@D)/ + @echo [$@] + @bin/genMakefileElevationRules > $@ +include var/run/Makefile.elevationRules + +var/run/tile_%.elevation: var/cache/elevation/elevation_%.zip Ortho4XP | $$(@D)/ + @echo [$@] + @# unzip if file not empty, but fail on unzip error + @if [ -s "var/cache/elevation/elevation_$*.zip" ]; then \ + unzip -o -d Ortho4XP/Elevation_data/ var/cache/elevation/elevation_$*.zip; \ + fi + @touch $@ + +var/run/elevationRelease.json: | $$(@D)/ + @echo [$@] + gh api $(ELEV_RELEASE_JSON_ENDPOINT) --paginate > $@ + +var/cache/elevation/elevation_%.zip: var/run/elevationRelease.json | $$(@D)/ + @echo [$@] + @url=$$(jq -r '.assets[] | select$(OP).name == "elevation_$*.zip"$(CP) .browser_download_url' \ + var/run/elevationRelease.json) \ + && [ -n "$$url" ] \ + && ( cd $(@D) && wget --continue --quiet "$$url" ) \ + && echo "[$@] downloaded $$url" \ + || ( echo "[$@] no custom elevation data for $* found"; true ) + @# always create the file + @touch $@ + +# +# Split tile list +# #$(TILENAME)_tile_list.%: $(TILENAME)_tile_list_chunks $(TILENAME)_tile_list_chunks: $(TILENAME)_tile_list + @echo [$@] split $< -d -l $(SPLITSIZE) $<. @@ -63,22 +129,24 @@ $(TILENAME)_tile_list_chunks: $(TILENAME)_tile_list #%.dsf: Ortho4XP/Tiles/zOrtho4XP_%/.done # echo $< #Ortho4XP/Tiles/zOrtho4XP_%/.done: Ortho4XP -Ortho4XP/Tiles/*/*/*/%.dsf: Ortho4XP - @echo "Make tile $*" +Ortho4XP/Tiles/*/*/*/%.dsf: Ortho4XP var/run/neighboursOfTile_%.elevation + @echo [$@] + @echo "Make tile $*" @echo "Setup per tile config, if possible" mkdir -p Ortho4XP/Tiles/zOrtho4XP_$* - -cp Ortho4XP_$*.cfg Ortho4XP/Tiles/zOrtho4XP_$*/. + -cp Ortho4XP_$*.cfg Ortho4XP/Tiles/zOrtho4XP_$*/. 2>/dev/null @echo "Make tile $(@)" set -e;\ export COORDS=$$(echo $(@) | sed -e 's/.*\/\([-+][0-9]\+\)\([-+][0-9]\+\).dsf/\1 \2/g');\ echo $$COORDS; \ - cd $< && python3 Ortho4XP_v130.py $$COORDS BI $(ZL) || ( echo "ERROR DETECTED! Retry tile $@ with noroads config."; cp $(CURDIR)/Ortho4XP_noroads.cfg $(CURDIR)/Ortho4XP/Tiles/zOrtho4XP_$*/Ortho4XP_$*.cfg && python3 Ortho4XP_v130.py $$COORDS BI $(ZL) ) + cd Ortho4XP && python3 Ortho4XP_v130.py $$COORDS BI $(ZL) || ( echo "ERROR DETECTED! Retry tile $@ with noroads config."; cp $(CURDIR)/Ortho4XP_noroads.cfg $(CURDIR)/Ortho4XP/Tiles/zOrtho4XP_$*/Ortho4XP_$*.cfg && python3 Ortho4XP_v130.py $$COORDS BI $(ZL) ) #touch $@ .SECONDARY: $(TILE_FILES) # Static pattern rule for the zip files $(ZIPS): z_%.zip: z_% + @echo [$@] mkdir -p $< cp -r Ortho4XP/Tiles/zOrtho4XP_*/'Earth nav data' $ $@ clean: + @echo [$@] -rm -rf Ortho4XP - -rm $(ZIPS) - -rm -rf z_$(TILENAME) - -rm $(TILENAME)_tile_list.* + -rm -rf var/run + -rm -f $(ZIPS) + -rm -rf z_$(TILENAME)* + -rm -f $(TILENAME)_tile_list.* + +distclean: clean + @echo [$@] + -rm -rf var + -rm -f z_* + -rm -f *_tile_list.* diff --git a/bin/genMakefileElevationRules b/bin/genMakefileElevationRules new file mode 100755 index 0000000..856ef12 --- /dev/null +++ b/bin/genMakefileElevationRules @@ -0,0 +1,23 @@ +#!/bin/bash +# Outputs Makefile rules for elevations. +# Ortho4XP uses all surrounding tiles' elevations for generation of a tile. +# The generated rules look like this: +# var/run/neighboursOfTile_+12+123.elevation: var/run/tile_+12+123.elevation ... |$(@D) + +# saner programming env: these switches turn some bugs into errors +set -o errexit -o pipefail -o noclobber -o nounset + +for lat in $(seq -90 90); do + for lon in $(seq -180 179); do + printf "var/run/neighboursOfTile_%+03d%+04d.elevation:" "$lat" "$lon" + for dLon in -1 0 1; do + for dLat in -1 0 1; do + _lat="$((lat + dLat))" + # wrap around although not needed in 100 years. Elevation data for the Aleutians anybody? + _lon="$(( ($lon + $dLon + 540) % 360 - 180))" + printf "var/run/tile_%+03d%+04d.elevation " "$_lat" "$_lon" + done + done + printf '|$(@D)'"\n" + done +done diff --git a/bin/prepareAssetsElevationData b/bin/prepareAssetsElevationData new file mode 100755 index 0000000..c8d9c7a --- /dev/null +++ b/bin/prepareAssetsElevationData @@ -0,0 +1,30 @@ +#!/bin/bash +# saner programming env: these switches turn some bugs into errors +set -o errexit -o pipefail -o noclobber -o nounset + +zipsDir="${1:-}" +dir="$(dirname "$0")" +targetDir="$(readlink -f "$dir/../var/cache/elevation")" + +if ! [ -d "$zipsDir" ]; then + cat <<-EOL + Usage: $0 + + The source .zips will be copied to + ‹$targetDir› + and renamed to tile name format for being uploaded to a release. + + Example with the Github CLI: + ‹for i in var/cache/elevation/*; do gh release upload elevation-v0.0.1 \$i; done› + EOL + exit 1 +fi + +mkdir -p "$targetDir" + +for filePath in "$zipsDir"/*.zip; do + fileNameElevationFormat="$(basename "$filePath")" + fileNameTile="elevation_$(sed -E -e 's/N|E/+/g' -e 's/S|W/-/g' <<< "$fileNameElevationFormat")" + printf "%s\n → %s\n" "$fileNameElevationFormat" "$fileNameTile" + cp "$filePath" "$targetDir/$fileNameTile" +done diff --git a/test_tile_list b/test_tile_list index c8dd3e3..e467ac4 100644 --- a/test_tile_list +++ b/test_tile_list @@ -1,2 +1,10 @@ +00-051.dsf +00-052.dsf ++64-016.dsf ++61-008.dsf ++61-007.dsf ++62-008.dsf ++62-007.dsf ++78+013.dsf ++78+014.dsf ++78+015.dsf From 3fa0622a81c02e9c451192f730a5a3394cfd22d5 Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Sun, 9 Jul 2023 15:39:04 +0200 Subject: [PATCH 02/18] use partly successful work with fail-fast=false --- .github/workflows/push-main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/push-main.yml b/.github/workflows/push-main.yml index 9107255..9ce531b 100644 --- a/.github/workflows/push-main.yml +++ b/.github/workflows/push-main.yml @@ -44,6 +44,8 @@ jobs: strategy: matrix: ${{ fromJSON(needs.ziplist.outputs.chunks) }} + # might still need several restarts of failed jobs, but prevents us from losing successful work + fail-fast: false uses: ./.github/workflows/build-tiles.yml with: From d6492999176291c440e0a364f3aefffcb2dad35d Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Sun, 9 Jul 2023 19:50:00 +0200 Subject: [PATCH 03/18] add Spitsbergen/Svalbard to eur_tile_list I haven't noticed it has not been part of the scenery at all. But there should be no reason not to. --- Makefile.tiles | 2 +- eur_tile_list | 125 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 1 deletion(-) diff --git a/Makefile.tiles b/Makefile.tiles index 32543e8..6cfe165 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -97,7 +97,7 @@ var/run/tile_%.elevation: var/cache/elevation/elevation_%.zip Ortho4XP | $$(@D)/ var/run/elevationRelease.json: | $$(@D)/ @echo [$@] - gh api $(ELEV_RELEASE_JSON_ENDPOINT) --paginate > $@ + @gh api $(ELEV_RELEASE_JSON_ENDPOINT) --paginate > $@ var/cache/elevation/elevation_%.zip: var/run/elevationRelease.json | $$(@D)/ @echo [$@] diff --git a/eur_tile_list b/eur_tile_list index b060353..a451662 100644 --- a/eur_tile_list +++ b/eur_tile_list @@ -1979,3 +1979,128 @@ +58-006.dsf +51-008.dsf +56-007.dsf ++76+009.dsf ++76+010.dsf ++76+011.dsf ++76+012.dsf ++76+013.dsf ++76+014.dsf ++76+015.dsf ++76+016.dsf ++76+017.dsf ++76+018.dsf ++76+019.dsf ++76+020.dsf ++76+021.dsf ++76+022.dsf ++76+023.dsf ++76+024.dsf ++76+025.dsf ++76+026.dsf ++76+027.dsf ++76+028.dsf ++76+029.dsf ++76+030.dsf ++76+031.dsf ++76+032.dsf ++76+033.dsf ++77+009.dsf ++77+010.dsf ++77+011.dsf ++77+012.dsf ++77+013.dsf ++77+014.dsf ++77+015.dsf ++77+016.dsf ++77+017.dsf ++77+018.dsf ++77+019.dsf ++77+020.dsf ++77+021.dsf ++77+022.dsf ++77+023.dsf ++77+024.dsf ++77+025.dsf ++77+026.dsf ++77+027.dsf ++77+028.dsf ++77+029.dsf ++77+030.dsf ++77+031.dsf ++77+032.dsf ++77+033.dsf ++78+009.dsf ++78+010.dsf ++78+011.dsf ++78+012.dsf ++78+013.dsf ++78+014.dsf ++78+015.dsf ++78+016.dsf ++78+017.dsf ++78+018.dsf ++78+019.dsf ++78+020.dsf ++78+021.dsf ++78+022.dsf ++78+023.dsf ++78+024.dsf ++78+025.dsf ++78+026.dsf ++78+027.dsf ++78+028.dsf ++78+029.dsf ++78+030.dsf ++78+031.dsf ++78+032.dsf ++78+033.dsf ++79+009.dsf ++79+010.dsf ++79+011.dsf ++79+012.dsf ++79+013.dsf ++79+014.dsf ++79+015.dsf ++79+016.dsf ++79+017.dsf ++79+018.dsf ++79+019.dsf ++79+020.dsf ++79+021.dsf ++79+022.dsf ++79+023.dsf ++79+024.dsf ++79+025.dsf ++79+026.dsf ++79+027.dsf ++79+028.dsf ++79+029.dsf ++79+030.dsf ++79+031.dsf ++79+032.dsf ++79+033.dsf ++80+009.dsf ++80+010.dsf ++80+011.dsf ++80+012.dsf ++80+013.dsf ++80+014.dsf ++80+015.dsf ++80+016.dsf ++80+017.dsf ++80+018.dsf ++80+019.dsf ++80+020.dsf ++80+021.dsf ++80+022.dsf ++80+023.dsf ++80+024.dsf ++80+025.dsf ++80+026.dsf ++80+027.dsf ++80+028.dsf ++80+029.dsf ++80+030.dsf ++80+031.dsf ++80+032.dsf ++80+033.dsf From 286ef0b8051e711f0052b9c66ee9fbf39bfb7d55 Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Sun, 9 Jul 2023 20:40:51 +0200 Subject: [PATCH 04/18] move the often failing sha256 step into "build" "build" has a retry-config. I hope more .zips will successfully pass like that. --- .github/workflows/build-tiles.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-tiles.yml b/.github/workflows/build-tiles.yml index 32a4c62..6e83084 100644 --- a/.github/workflows/build-tiles.yml +++ b/.github/workflows/build-tiles.yml @@ -53,11 +53,11 @@ jobs: run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }} -j $(nproc) && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" + TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 - name: Show work if: steps.build.outputs.done == 'true' run: | - TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 echo '### ${{ inputs.tileset }} : ${{ inputs.zip }}' >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY #unzip -l ${{ inputs.zip }} *.dsf >> $GITHUB_STEP_SUMMARY @@ -122,11 +122,11 @@ jobs: run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }} && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" + TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 - name: Show work if: steps.rebuild.outputs.done == 'true' run: | - TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 echo '### ${{ inputs.tileset }} : ${{ inputs.zip }}' >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY #unzip -l ${{ inputs.zip }} *.dsf >> $GITHUB_STEP_SUMMARY @@ -191,11 +191,11 @@ jobs: run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }} && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" + TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 - name: Show work if: steps.rebuild.outputs.done == 'true' run: | - TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 echo '### ${{ inputs.tileset }} : ${{ inputs.zip }}' >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY #unzip -l ${{ inputs.zip }} *.dsf >> $GITHUB_STEP_SUMMARY From 7ef9eaa674a56a422f655ac35386a24f2ab62747 Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Sun, 9 Jul 2023 22:03:28 +0200 Subject: [PATCH 05/18] Make .zip.info depend on the .zip We have many failures in that function. --- Makefile.tiles | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.tiles b/Makefile.tiles index 6cfe165..500ba14 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -45,16 +45,16 @@ z_$(TILENAME)_%: $(TILENAME)_tile_list.% $${TILE_FILES} @echo "Actual tile len:" @unzip -l $@.zip *.dsf | grep dsf | wc -l -z_$(TILENAME)_%.zip.info: $(TILENAME)_tile_list.% +z_$(TILENAME)_%.zip.info: z_$(TILENAME)_%.zip @echo [$@] @echo "-----------------------------------" @echo "Post processing info:" - comm --total -3 <( unzip -l $(basename $@) *.dsf | awk -F/ '/.*\.dsf/ { print $$4 }' | sort ) <( cat $< | sort ) + @comm --total -3 <( unzip -l $(basename $@) *.dsf | awk -F/ '/.*\.dsf/ { print $$4 }' | sort ) <( cat $(TILENAME)_tile_list.$* | sort ) @echo "-----------------------------------" - export EXPECTED=$$(cat $< | wc -l); \ - export ACTUAL=$$(unzip -l $(basename $@) *.dsf | grep dsf | wc -l); \ - echo "Expected tile len: $$EXPECTED"; \ - echo "Actual tile len: $$ACTUAL"; \ + @export EXPECTED=$$(cat $(TILENAME)_tile_list.$* | wc -l); \ + export ACTUAL=$$(unzip -l $(basename $@) *.dsf | grep dsf | wc -l); \ + echo "Expected tile len: $$EXPECTED"; \ + echo "Actual tile len: $$ACTUAL"; \ [ $$EXPECTED -eq $$ACTUAL ] # From 23a6d2f6e0904685bce2f621a762a3a4d306df61 Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Sun, 9 Jul 2023 22:05:16 +0200 Subject: [PATCH 06/18] add "compilage" to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 55bfdb4..dd1a2db 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ Ortho4XP *_tile_list.* /var/ /.venv/ +/z_*_*/ +/z_*_*.zip From f41c0ae6d9e72f73b0d05152adad8c555bd1fa7c Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Sun, 9 Jul 2023 22:40:19 +0200 Subject: [PATCH 07/18] Use .zip.info as build target Maybe that helps with the errors we have in the next step? --- .github/workflows/build-tiles.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-tiles.yml b/.github/workflows/build-tiles.yml index 6e83084..16e4a2c 100644 --- a/.github/workflows/build-tiles.yml +++ b/.github/workflows/build-tiles.yml @@ -52,7 +52,7 @@ jobs: id: build run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks - TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }} -j $(nproc) && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" + TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }}.info -j $(nproc) && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 - name: Show work @@ -121,7 +121,7 @@ jobs: id: rebuild run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks - TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }} && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" + TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }}.info -j $(nproc) && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 - name: Show work @@ -190,7 +190,8 @@ jobs: id: rebuild run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks - TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }} && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" + # last rebuild without any concurrency (-j 1) + TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }}.info -j 1 && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 - name: Show work From 60d0954e6bd06f1fb812b28e70d2ae7c9ede952e Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Sun, 9 Jul 2023 23:50:29 +0200 Subject: [PATCH 08/18] cleanup --- Makefile.tiles | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Makefile.tiles b/Makefile.tiles index 500ba14..d95ea1d 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -40,10 +40,6 @@ all: $(ZIPS) z_$(TILENAME)_%: $(TILENAME)_tile_list.% $${TILE_FILES} @echo [$@] - @echo "Expected tile len:" - @cat $< | wc -l - @echo "Actual tile len:" - @unzip -l $@.zip *.dsf | grep dsf | wc -l z_$(TILENAME)_%.zip.info: z_$(TILENAME)_%.zip @echo [$@] From b6ea98282b132d998fad50b71c8c1cb7fbb2392c Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Mon, 10 Jul 2023 00:58:54 +0200 Subject: [PATCH 09/18] Add GITHUB_TOKEN to all workflow steps --- .github/workflows/build-tiles.yml | 8 ++++++++ .github/workflows/push-main.yml | 8 ++++++++ .github/workflows/test-main.yml | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/.github/workflows/build-tiles.yml b/.github/workflows/build-tiles.yml index 16e4a2c..4db1c44 100644 --- a/.github/workflows/build-tiles.yml +++ b/.github/workflows/build-tiles.yml @@ -92,6 +92,10 @@ jobs: if: needs.build.outputs.done == 'false' needs: build runs-on: ubuntu-22.04 + env: + DEBIAN_FRONTEND: noninteractive + TZ: America/NewYork + GH_TOKEN: ${{ github.token }} outputs: done: ${{ steps.rebuild.outputs.done }} @@ -161,6 +165,10 @@ jobs: if: needs.rebuild.outputs.done == 'false' needs: rerun runs-on: ubuntu-22.04 + env: + DEBIAN_FRONTEND: noninteractive + TZ: America/NewYork + GH_TOKEN: ${{ github.token }} outputs: done: ${{ steps.rebuild.outputs.done }} diff --git a/.github/workflows/push-main.yml b/.github/workflows/push-main.yml index 9ce531b..2218ab3 100644 --- a/.github/workflows/push-main.yml +++ b/.github/workflows/push-main.yml @@ -24,6 +24,10 @@ on: jobs: ziplist: runs-on: ubuntu-22.04 + env: + DEBIAN_FRONTEND: noninteractive + TZ: America/NewYork + GH_TOKEN: ${{ github.token }} outputs: chunks: ${{ steps.chunks.outputs.chunks }} steps: @@ -61,6 +65,10 @@ jobs: environment: release runs-on: ubuntu-22.04 + env: + DEBIAN_FRONTEND: noninteractive + TZ: America/NewYork + GH_TOKEN: ${{ github.token }} steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/test-main.yml b/.github/workflows/test-main.yml index 3db5e14..74299e6 100644 --- a/.github/workflows/test-main.yml +++ b/.github/workflows/test-main.yml @@ -6,6 +6,10 @@ on: jobs: ziplist: runs-on: ubuntu-22.04 + env: + DEBIAN_FRONTEND: noninteractive + TZ: America/NewYork + GH_TOKEN: ${{ github.token }} outputs: chunks: ${{ steps.chunks.outputs.chunks }} steps: From 66c674e77108bbafbf83a286353ce0cb6292aba8 Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Mon, 10 Jul 2023 21:08:59 +0200 Subject: [PATCH 10/18] Support debugging by more concise output --- Makefile.tiles | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Makefile.tiles b/Makefile.tiles index d95ea1d..a2f9ce7 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -84,10 +84,13 @@ var/run/Makefile.elevationRules: | $$(@D)/ include var/run/Makefile.elevationRules var/run/tile_%.elevation: var/cache/elevation/elevation_%.zip Ortho4XP | $$(@D)/ - @echo [$@] @# unzip if file not empty, but fail on unzip error @if [ -s "var/cache/elevation/elevation_$*.zip" ]; then \ - unzip -o -d Ortho4XP/Elevation_data/ var/cache/elevation/elevation_$*.zip; \ + printf "[$@] custom elevation found: "; \ + unzip -o -d Ortho4XP/Elevation_data/ var/cache/elevation/elevation_$*.zip | tr "\n" " | "; \ + echo; \ + else \ + echo "[$@] no custom elevation"; \ fi @touch $@ @@ -96,14 +99,13 @@ var/run/elevationRelease.json: | $$(@D)/ @gh api $(ELEV_RELEASE_JSON_ENDPOINT) --paginate > $@ var/cache/elevation/elevation_%.zip: var/run/elevationRelease.json | $$(@D)/ - @echo [$@] @url=$$(jq -r '.assets[] | select$(OP).name == "elevation_$*.zip"$(CP) .browser_download_url' \ var/run/elevationRelease.json) \ && [ -n "$$url" ] \ - && ( cd $(@D) && wget --continue --quiet "$$url" ) \ - && echo "[$@] downloaded $$url" \ - || ( echo "[$@] no custom elevation data for $* found"; true ) - @# always create the file + && ( echo "[$@] downloading $$url" && cd $(@D) && wget --continue --quiet "$$url" ) \ + && echo "[$@] using custom elevation" \ + || ( echo "[$@] no custom elevation found"; true ) + @# always create the .zip file @touch $@ # @@ -131,12 +133,18 @@ Ortho4XP/Tiles/*/*/*/%.dsf: Ortho4XP var/run/neighboursOfTile_%.elevation @echo "Setup per tile config, if possible" mkdir -p Ortho4XP/Tiles/zOrtho4XP_$* -cp Ortho4XP_$*.cfg Ortho4XP/Tiles/zOrtho4XP_$*/. 2>/dev/null - @echo "Make tile $(@)" + @echo "Make tile $(@)" + # this silences deprecation warnings in Ortho4XP for more concise output set -e;\ export COORDS=$$(echo $(@) | sed -e 's/.*\/\([-+][0-9]\+\)\([-+][0-9]\+\).dsf/\1 \2/g');\ echo $$COORDS; \ - cd Ortho4XP && python3 Ortho4XP_v130.py $$COORDS BI $(ZL) || ( echo "ERROR DETECTED! Retry tile $@ with noroads config."; cp $(CURDIR)/Ortho4XP_noroads.cfg $(CURDIR)/Ortho4XP/Tiles/zOrtho4XP_$*/Ortho4XP_$*.cfg && python3 Ortho4XP_v130.py $$COORDS BI $(ZL) ) - #touch $@ + cd Ortho4XP \ + && python3 Ortho4XP_v130.py $$COORDS BI $(ZL) 2>&1 | grep -v 'is deprecated' \ + || ( \ + echo "ERROR DETECTED! Retry tile $@ with noroads config."; \ + cp $(CURDIR)/Ortho4XP_noroads.cfg $(CURDIR)/Ortho4XP/Tiles/zOrtho4XP_$*/Ortho4XP_$*.cfg \ + && python3 Ortho4XP_v130.py $$COORDS BI $(ZL) 2>&1 | grep -v 'is deprecated' \ + ) .SECONDARY: $(TILE_FILES) From 8e964cdc1a2b9d52d6b5b9ae4bc513af9e7505eb Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Mon, 10 Jul 2023 21:09:28 +0200 Subject: [PATCH 11/18] Support quick retries by deleting Ortho4XP with distclean only "clean" removes products, distclean brings mostly everything back to like a clean git checkout --- Makefile.tiles | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile.tiles b/Makefile.tiles index a2f9ce7..a5593b7 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -162,15 +162,16 @@ $(ZIPS): z_%.zip: z_% sha256sum $< > $@ clean: - @echo [$@] - -rm -rf Ortho4XP + @echo "[$@]" + -rm -rf Ortho4XP/Tiles/* -rm -rf var/run -rm -f $(ZIPS) -rm -rf z_$(TILENAME)* -rm -f $(TILENAME)_tile_list.* distclean: clean - @echo [$@] + @echo "[$@]" + -rm -rf Ortho4XP -rm -rf var -rm -f z_* -rm -f *_tile_list.* From 277c3e07756317b64adec08b1aa0edfdecd177d3 Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Mon, 10 Jul 2023 22:22:00 +0200 Subject: [PATCH 12/18] work on output, logic --- Makefile.tiles | 63 +++++++++++++++++++---------------- bin/genMakefileElevationRules | 4 ++- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/Makefile.tiles b/Makefile.tiles index a5593b7..b6a263c 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -31,7 +31,6 @@ all: $(ZIPS) # creates directories %/: - @echo [$@] @mkdir -p $@ # @@ -39,10 +38,10 @@ all: $(ZIPS) # z_$(TILENAME)_%: $(TILENAME)_tile_list.% $${TILE_FILES} - @echo [$@] + @echo "[$@]" z_$(TILENAME)_%.zip.info: z_$(TILENAME)_%.zip - @echo [$@] + @echo "[$@]" @echo "-----------------------------------" @echo "Post processing info:" @comm --total -3 <( unzip -l $(basename $@) *.dsf | awk -F/ '/.*\.dsf/ { print $$4 }' | sort ) <( cat $(TILENAME)_tile_list.$* | sort ) @@ -58,11 +57,11 @@ z_$(TILENAME)_%.zip.info: z_$(TILENAME)_%.zip # ortho4xp.diff: - @echo [$@] + @echo "[$@]" cd Ortho4XP && git diff > ../ortho4xp.diff Ortho4XP: - @echo [$@] + @echo "[$@]" git clone --depth=1 https://github.com/oscarpilote/Ortho4XP.git cd $@ && patch -p1 -u < ../ortho4xp.diff cp extract_overlay.py $@/. @@ -79,34 +78,40 @@ Ortho4XP: # generates the targets var/run/neighboursOfTile_%.elevation with surrounding tiles' elevations # as prerequisites (takes a little while, 360*180 rules): var/run/Makefile.elevationRules: | $$(@D)/ - @echo [$@] + @echo "[$@]" @bin/genMakefileElevationRules > $@ include var/run/Makefile.elevationRules var/run/tile_%.elevation: var/cache/elevation/elevation_%.zip Ortho4XP | $$(@D)/ - @# unzip if file not empty, but fail on unzip error + @# Unzips if file not empty, but fails on unzip error. + @# Ignores the .zip if empty @if [ -s "var/cache/elevation/elevation_$*.zip" ]; then \ - printf "[$@] custom elevation found: "; \ + printf "[$@] unzipping custom elevation: "; \ unzip -o -d Ortho4XP/Elevation_data/ var/cache/elevation/elevation_$*.zip | tr "\n" " | "; \ echo; \ else \ - echo "[$@] no custom elevation"; \ + echo "[$@] no custom elevation for this tile"; \ fi @touch $@ var/run/elevationRelease.json: | $$(@D)/ - @echo [$@] - @gh api $(ELEV_RELEASE_JSON_ENDPOINT) --paginate > $@ + @echo "[$@]" + @json=$$(gh api $(ELEV_RELEASE_JSON_ENDPOINT) --paginate) \ + && echo "$$json" > $@ \ + && printf "[$@] got %s\n" "$$(jq -r '.assets[].name' $@ | tr --delete "elevation_" | tr --delete ".zip" | tr "\n" ",")" var/cache/elevation/elevation_%.zip: var/run/elevationRelease.json | $$(@D)/ + @# Fails if we expect a file but download failed. + @# Creates an empty .zip file if there is no custom elevation. @url=$$(jq -r '.assets[] | select$(OP).name == "elevation_$*.zip"$(CP) .browser_download_url' \ - var/run/elevationRelease.json) \ - && [ -n "$$url" ] \ - && ( echo "[$@] downloading $$url" && cd $(@D) && wget --continue --quiet "$$url" ) \ - && echo "[$@] using custom elevation" \ - || ( echo "[$@] no custom elevation found"; true ) - @# always create the .zip file - @touch $@ + var/run/elevationRelease.json); \ + if [ -n "$$url" ]; then \ + echo "[$@] downloading custom elevation"; \ + wget --continue --quiet -O $@ "$$url" && touch $@; \ + else \ + echo "[$@] no custom elevation for this tile"; \ + touch $@; \ + fi # # Split tile list @@ -114,7 +119,7 @@ var/cache/elevation/elevation_%.zip: var/run/elevationRelease.json | $$(@D)/ #$(TILENAME)_tile_list.%: $(TILENAME)_tile_list_chunks $(TILENAME)_tile_list_chunks: $(TILENAME)_tile_list - @echo [$@] + @echo "[$@]" split $< -d -l $(SPLITSIZE) $<. @@ -131,11 +136,11 @@ Ortho4XP/Tiles/*/*/*/%.dsf: Ortho4XP var/run/neighboursOfTile_%.elevation @echo [$@] @echo "Make tile $*" @echo "Setup per tile config, if possible" - mkdir -p Ortho4XP/Tiles/zOrtho4XP_$* - -cp Ortho4XP_$*.cfg Ortho4XP/Tiles/zOrtho4XP_$*/. 2>/dev/null + @mkdir -p Ortho4XP/Tiles/zOrtho4XP_$* + @cp Ortho4XP_$*.cfg Ortho4XP/Tiles/zOrtho4XP_$*/. 2>/dev/null || true @echo "Make tile $(@)" # this silences deprecation warnings in Ortho4XP for more concise output - set -e;\ + @set -e;\ export COORDS=$$(echo $(@) | sed -e 's/.*\/\([-+][0-9]\+\)\([-+][0-9]\+\).dsf/\1 \2/g');\ echo $$COORDS; \ cd Ortho4XP \ @@ -150,15 +155,15 @@ Ortho4XP/Tiles/*/*/*/%.dsf: Ortho4XP var/run/neighboursOfTile_%.elevation # Static pattern rule for the zip files $(ZIPS): z_%.zip: z_% - @echo [$@] - mkdir -p $< - cp -r Ortho4XP/Tiles/zOrtho4XP_*/'Earth nav data' $ $@ clean: diff --git a/bin/genMakefileElevationRules b/bin/genMakefileElevationRules index 856ef12..6a769ce 100755 --- a/bin/genMakefileElevationRules +++ b/bin/genMakefileElevationRules @@ -18,6 +18,8 @@ for lat in $(seq -90 90); do printf "var/run/tile_%+03d%+04d.elevation " "$_lat" "$_lon" done done - printf '|$(@D)'"\n" + echo '|$(@D)' + echo ' @echo "[$@]"' + echo ' @touch $@' done done From 2856ccd4bf7566f7a8e77c58b365b33362792ea4 Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Tue, 11 Jul 2023 00:04:30 +0200 Subject: [PATCH 13/18] Add "build single .zip" workflow for quicker testing --- .github/workflows/build-tiles.yml | 2 +- .github/workflows/push-main.yml | 2 +- .github/workflows/run-one-tile.yml | 41 ++++++++++++++++++++++++++++++ .github/workflows/run-one.yml | 2 +- .github/workflows/test-main.yml | 2 +- Makefile.tiles | 23 +++++++++-------- 6 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/run-one-tile.yml diff --git a/.github/workflows/build-tiles.yml b/.github/workflows/build-tiles.yml index 4db1c44..2d06b21 100644 --- a/.github/workflows/build-tiles.yml +++ b/.github/workflows/build-tiles.yml @@ -1,4 +1,4 @@ -name: Test +name: Build one .zip (and upload) (sub-workflow) on: workflow_call: diff --git a/.github/workflows/push-main.yml b/.github/workflows/push-main.yml index 2218ab3..7c2d35f 100644 --- a/.github/workflows/push-main.yml +++ b/.github/workflows/push-main.yml @@ -1,4 +1,4 @@ -name: Main +name: Build tileset (and upload) on: workflow_dispatch: diff --git a/.github/workflows/run-one-tile.yml b/.github/workflows/run-one-tile.yml new file mode 100644 index 0000000..0615f49 --- /dev/null +++ b/.github/workflows/run-one-tile.yml @@ -0,0 +1,41 @@ +name: Build one tile (and create artifact) + +on: + workflow_dispatch: + inputs: + tile: + type: string + default: '+62-008' + +jobs: + build: + env: + DEBIAN_FRONTEND: noninteractive + TZ: America/NewYork + GH_TOKEN: ${{ github.token }} + + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install reqs + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip python3-tk zip libgeos-dev + python3 -m pip install -r requirements.txt + make --version + + - name: Build + id: build + run: | + timeout 20m make -f Makefile.tiles zOrtho4XP_${{ inputs.tile }}.zip -j $(nproc) + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: z_aosingle_${{ inputs.tile }}.zip + path: ./z_aosingle_${{ inputs.tile }}.zip + retention-days: 2 + diff --git a/.github/workflows/run-one.yml b/.github/workflows/run-one.yml index 1c6eeda..a5cb2ed 100644 --- a/.github/workflows/run-one.yml +++ b/.github/workflows/run-one.yml @@ -1,4 +1,4 @@ -name: Run one +name: Build one .zip (and upload) on: workflow_dispatch: diff --git a/.github/workflows/test-main.yml b/.github/workflows/test-main.yml index 74299e6..7c0e5ab 100644 --- a/.github/workflows/test-main.yml +++ b/.github/workflows/test-main.yml @@ -1,4 +1,4 @@ -name: Test +name: Build test tileset on: push: diff --git a/Makefile.tiles b/Makefile.tiles index b6a263c..a865b94 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -86,9 +86,8 @@ var/run/tile_%.elevation: var/cache/elevation/elevation_%.zip Ortho4XP | $$(@D)/ @# Unzips if file not empty, but fails on unzip error. @# Ignores the .zip if empty @if [ -s "var/cache/elevation/elevation_$*.zip" ]; then \ - printf "[$@] unzipping custom elevation: "; \ - unzip -o -d Ortho4XP/Elevation_data/ var/cache/elevation/elevation_$*.zip | tr "\n" " | "; \ - echo; \ + printf "[$@] unzipping custom elevation: %s\n" \ + "$$(unzip -o -d Ortho4XP/Elevation_data/ var/cache/elevation/elevation_$*.zip | tr "\n" " | ")"; \ else \ echo "[$@] no custom elevation for this tile"; \ fi @@ -118,20 +117,15 @@ var/cache/elevation/elevation_%.zip: var/run/elevationRelease.json | $$(@D)/ # #$(TILENAME)_tile_list.%: $(TILENAME)_tile_list_chunks + $(TILENAME)_tile_list_chunks: $(TILENAME)_tile_list @echo "[$@]" split $< -d -l $(SPLITSIZE) $<. - # # Tile pack setup # -#Ortho4XP/Tiles/zOrtho4XP_%: Ortho4XP/Tiles/zOrtho4XP_%/.done -#.PHONY: %.dsf -#%.dsf: Ortho4XP/Tiles/zOrtho4XP_%/.done -# echo $< -#Ortho4XP/Tiles/zOrtho4XP_%/.done: Ortho4XP Ortho4XP/Tiles/*/*/*/%.dsf: Ortho4XP var/run/neighboursOfTile_%.elevation @echo [$@] @echo "Make tile $*" @@ -149,7 +143,15 @@ Ortho4XP/Tiles/*/*/*/%.dsf: Ortho4XP var/run/neighboursOfTile_%.elevation echo "ERROR DETECTED! Retry tile $@ with noroads config."; \ cp $(CURDIR)/Ortho4XP_noroads.cfg $(CURDIR)/Ortho4XP/Tiles/zOrtho4XP_$*/Ortho4XP_$*.cfg \ && python3 Ortho4XP_v130.py $$COORDS BI $(ZL) 2>&1 | grep -v 'is deprecated' \ - ) + ); + +var/run/z_aosingle_%: Ortho4XP/Tiles/*/*/*/%.dsf + @echo "[$@]" + @cp -r Ortho4XP/Tiles/zOrtho4XP_$*/ var/run/z_aosingle_$* + +z_aosingle_%.zip: var/run/z_aosingle_% + @echo "[$@]" + @cd var/run/ && zip -r ../../$@ z_aosingle_$*/ .SECONDARY: $(TILE_FILES) @@ -172,6 +174,7 @@ clean: -rm -rf var/run -rm -f $(ZIPS) -rm -rf z_$(TILENAME)* + -rm -rf z_aosingle_* -rm -f $(TILENAME)_tile_list.* distclean: clean From 5c2d6280981bace5cd275b63d0a2bbc4cbe95dc3 Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Tue, 11 Jul 2023 00:17:59 +0200 Subject: [PATCH 14/18] remove make concurrency in runners again All Ortho4XPs run on the same dir so mabe we had an issue. --- .github/workflows/build-tiles.yml | 9 ++++----- .github/workflows/run-one-tile.yml | 2 +- Makefile.tiles | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-tiles.yml b/.github/workflows/build-tiles.yml index 2d06b21..431956b 100644 --- a/.github/workflows/build-tiles.yml +++ b/.github/workflows/build-tiles.yml @@ -43,7 +43,7 @@ jobs: - name: Test run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks - TILENAME=${{ inputs.setname }} make -n -f Makefile.tiles ${{ inputs.zip }} -j $(nproc) + TILENAME=${{ inputs.setname }} make -n -f Makefile.tiles ${{ inputs.zip }} - name: Setup Ortho4XP run: make Ortho4XP @@ -52,7 +52,7 @@ jobs: id: build run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks - TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }}.info -j $(nproc) && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" + TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }}.info && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 - name: Show work @@ -125,7 +125,7 @@ jobs: id: rebuild run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks - TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }}.info -j $(nproc) && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" + TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }}.info && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 - name: Show work @@ -198,8 +198,7 @@ jobs: id: rebuild run: | TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks - # last rebuild without any concurrency (-j 1) - TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }}.info -j 1 && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" + TILENAME=${{ inputs.setname }} timeout 300m make -f Makefile.tiles ${{ inputs.zip }}.info && echo "done=true" >> "$GITHUB_OUTPUT" || echo "done=false" >> "$GITHUB_OUTPUT" TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.zip }}.sha256 - name: Show work diff --git a/.github/workflows/run-one-tile.yml b/.github/workflows/run-one-tile.yml index 0615f49..7eb75ef 100644 --- a/.github/workflows/run-one-tile.yml +++ b/.github/workflows/run-one-tile.yml @@ -30,7 +30,7 @@ jobs: - name: Build id: build run: | - timeout 20m make -f Makefile.tiles zOrtho4XP_${{ inputs.tile }}.zip -j $(nproc) + timeout 20m make -f Makefile.tiles zOrtho4XP_${{ inputs.tile }}.zip - name: Upload artifact uses: actions/upload-artifact@v3 diff --git a/Makefile.tiles b/Makefile.tiles index a865b94..521a79d 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -95,7 +95,7 @@ var/run/tile_%.elevation: var/cache/elevation/elevation_%.zip Ortho4XP | $$(@D)/ var/run/elevationRelease.json: | $$(@D)/ @echo "[$@]" - @json=$$(gh api $(ELEV_RELEASE_JSON_ENDPOINT) --paginate) \ + @json="$$(gh api $(ELEV_RELEASE_JSON_ENDPOINT) --paginate)" \ && echo "$$json" > $@ \ && printf "[$@] got %s\n" "$$(jq -r '.assets[].name' $@ | tr --delete "elevation_" | tr --delete ".zip" | tr "\n" ",")" From 3ad4769845e1e3d914e94e6617d290910ec277e8 Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Tue, 11 Jul 2023 20:25:50 +0200 Subject: [PATCH 15/18] Show elevation data when starting --- Makefile.tiles | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile.tiles b/Makefile.tiles index 521a79d..9164666 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -128,15 +128,14 @@ $(TILENAME)_tile_list_chunks: $(TILENAME)_tile_list Ortho4XP/Tiles/*/*/*/%.dsf: Ortho4XP var/run/neighboursOfTile_%.elevation @echo [$@] - @echo "Make tile $*" - @echo "Setup per tile config, if possible" @mkdir -p Ortho4XP/Tiles/zOrtho4XP_$* + @echo "Setup per tile config, if possible" @cp Ortho4XP_$*.cfg Ortho4XP/Tiles/zOrtho4XP_$*/. 2>/dev/null || true - @echo "Make tile $(@)" + @echo "Available elevation data" + ls Ortho4XP/Elevation_data/ -lsh # this silences deprecation warnings in Ortho4XP for more concise output @set -e;\ export COORDS=$$(echo $(@) | sed -e 's/.*\/\([-+][0-9]\+\)\([-+][0-9]\+\).dsf/\1 \2/g');\ - echo $$COORDS; \ cd Ortho4XP \ && python3 Ortho4XP_v130.py $$COORDS BI $(ZL) 2>&1 | grep -v 'is deprecated' \ || ( \ From 192b32a5491744a9e8bd071bfd13a00b5f70de6c Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Tue, 11 Jul 2023 20:31:56 +0200 Subject: [PATCH 16/18] fix single tile workflow --- .github/workflows/run-one-tile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-one-tile.yml b/.github/workflows/run-one-tile.yml index 7eb75ef..a0ce1e3 100644 --- a/.github/workflows/run-one-tile.yml +++ b/.github/workflows/run-one-tile.yml @@ -30,7 +30,7 @@ jobs: - name: Build id: build run: | - timeout 20m make -f Makefile.tiles zOrtho4XP_${{ inputs.tile }}.zip + timeout 20m make -f Makefile.tiles z_aosingle_${{ inputs.tile }}.zip - name: Upload artifact uses: actions/upload-artifact@v3 From c0b8e57172c255c68415ac3b004599df5ad0e4ab Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Tue, 11 Jul 2023 20:51:10 +0200 Subject: [PATCH 17/18] Let Makefile.tiles handle the Orto4XP setup, too --- .github/workflows/build-tiles.yml | 3 -- Makefile | 87 ------------------------------- 2 files changed, 90 deletions(-) delete mode 100644 Makefile diff --git a/.github/workflows/build-tiles.yml b/.github/workflows/build-tiles.yml index 431956b..f84ee7d 100644 --- a/.github/workflows/build-tiles.yml +++ b/.github/workflows/build-tiles.yml @@ -45,9 +45,6 @@ jobs: TILENAME=${{ inputs.setname }} make -f Makefile.tiles ${{ inputs.setname }}_tile_list_chunks TILENAME=${{ inputs.setname }} make -n -f Makefile.tiles ${{ inputs.zip }} - - name: Setup Ortho4XP - run: make Ortho4XP - - name: Build id: build run: | diff --git a/Makefile b/Makefile deleted file mode 100644 index 323b5fa..0000000 --- a/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -SPLITSIZE?=150 - -AUS_PACS:=$(addprefix z_aus_pac_, $(shell ls aus_pac_tile_list.* | awk -F. '{ print $$2 }') ) -AUS_PAC_ZIPS=$(addsuffix .zip, $(AUS_PACS)) - -NAS:=$(addprefix z_na_, $(shell ls na_tile_list.* | awk -F. '{ print $$2 }') ) -NA_ZIPS=$(addsuffix .zip, $(NAS)) - -EURS:=$(addprefix z_eur_, $(shell ls eur_tile_list.* | awk -F. '{ print $$2 }') ) -EUR_ZIPS=$(addsuffix .zip, $(EURS)) - -TESTS:=$(addprefix z_test_, $(shell ls test_tile_list.* | awk -F. '{ print $$2 }') ) -TEST_ZIPS=$(addsuffix .zip, $(TESTS)) - - -ZIPS=$(AUS_PAC_ZIPS) $(NA_ZIPS) $(EUR_ZIPS) $(TEST_ZIPS) - -# Get the tiles listed in each list file -.SECONDEXPANSION: -AUS_PAC_TILES = $(addprefix Ortho4XP/Tiles/zOrtho4XP_, $(basename $(shell cat aus_pac_tile_list.$* ) ) ) -NA_TILES = $(addprefix Ortho4XP/Tiles/zOrtho4XP_, $(basename $(shell cat na_tile_list.$* ) ) ) -EUR_TILES = $(addprefix Ortho4XP/Tiles/zOrtho4XP_, $(basename $(shell cat eur_tile_list.$* ) ) ) -TEST_TILES = $(addprefix Ortho4XP/Tiles/zOrtho4XP_, $(basename $(shell cat test_tile_list.$* ) ) ) - -z_aus_pac_%: aus_pac_tile_list.% $${AUS_PAC_TILES} - echo "Going to do some $@" - -z_na_%: na_tile_list.% $${NA_TILES} - echo "Going to do some $@" - -z_eur_%: eur_tile_list.% $${EUR_TILES} - echo "Going to do some $@" - -z_test_%: test_tile_list.% $${TEST_TILES} - echo "Going to do some $@" - - -#allzips: $(AUS_PAC_ZIPS) $(NA_ZIPS) - -# -# Ortho4XP setup -# - -ortho4xp.diff: Ortho4XP - cd Ortho4XP && git diff > ../ortho4xp.diff - -Ortho4XP: - git clone --depth=1 https://github.com/oscarpilote/Ortho4XP.git - cd $@ && patch -p1 -u < ../ortho4xp.diff - cp extract_overlay.py $@/. - cp Ortho4XP.cfg $@/. - mkdir $@/tmp - - -%_chunks: % - split $< -d -l $(SPLITSIZE) $<. - -# -# Tile pack setup -# - -.SECONDARY: $(AUS_PAC_TILES) $(NA_TILES) $(EUR_TILES) $(TEST_TILES) -Ortho4XP/Tiles/zOrtho4XP_%: Ortho4XP - @echo "Setup per tile config, if possible" - mkdir -p $@ - -cp Ortho4XP_$*.cfg $@/. - @echo "Make tile $@" - set -e;\ - export COORDS=$$(echo $* | sed -e 's/\([-+][0-9]\+\)\([-+][0-9]\+\)/\1 \2/g');\ - cd $< && python3 Ortho4XP_v130.py $$COORDS BI 16 - -# Static pattern rule for the zip files -$(ZIPS): z_%.zip: z_% - mkdir -p $< - cp -r Ortho4XP/Tiles/zOrtho4XP_*/'Earth nav data' $ Date: Wed, 12 Jul 2023 19:28:28 +0200 Subject: [PATCH 18/18] Improve the output, show available elevation data --- Makefile.tiles | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile.tiles b/Makefile.tiles index 9164666..dc1558a 100644 --- a/Makefile.tiles +++ b/Makefile.tiles @@ -66,9 +66,9 @@ Ortho4XP: cd $@ && patch -p1 -u < ../ortho4xp.diff cp extract_overlay.py $@/. cp Ortho4XP.cfg $@/. - mkdir $@/tmp + @mkdir $@/tmp @echo "Setting up symlinks in order to not care about Ortho4XP's expected directory structure in ./Elevation_data..." - mkdir -p $@/Elevation_data && cd $@/Elevation_data \ + @mkdir -p $@/Elevation_data && cd $@/Elevation_data \ && bash -c 'for lat in {-9..9}; do for lon in {-18..18}; do ln -snfr ./ "./$$(printf "%+d0%+03d0" "$$lat" "$$lon")"; done; done' # @@ -131,8 +131,12 @@ Ortho4XP/Tiles/*/*/*/%.dsf: Ortho4XP var/run/neighboursOfTile_%.elevation @mkdir -p Ortho4XP/Tiles/zOrtho4XP_$* @echo "Setup per tile config, if possible" @cp Ortho4XP_$*.cfg Ortho4XP/Tiles/zOrtho4XP_$*/. 2>/dev/null || true - @echo "Available elevation data" - ls Ortho4XP/Elevation_data/ -lsh + @echo "Available elevation data for this tile before Ortho4XP run (25M is HD 1\", 2.8M is 3\"):" + @#ls Ortho4XP/Elevation_data/ -sh + @hgtLat="$$(grep -Eo '^.{3}' <<< $* | tr "+" "N" | tr "-" "S")" \ + && hgtLon="$$(grep -Eo '.{4}$$' <<< $* | tr "+" "E" | tr "-" "W")" \ + && hgtFilePath=Ortho4XP/Elevation_data/"$$hgtLat$$hgtLon".hgt \ + && ( [ -e "$$hgtFilePath" ] && ls -sh "$$hgtFilePath" || true ) # this silences deprecation warnings in Ortho4XP for more concise output @set -e;\ export COORDS=$$(echo $(@) | sed -e 's/.*\/\([-+][0-9]\+\)\([-+][0-9]\+\).dsf/\1 \2/g');\