]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/taginfo/templates/default/update-planet.erb
Use verbose option on pyosmium-up-to-date command for taginfo.
[chef.git] / cookbooks / taginfo / templates / default / update-planet.erb
index 311c7703e6230cb1b47c15716d66e066ecc6d74c..1d8ba1b126e843fdc5ab20b76c04a2f6b74c4252 100644 (file)
@@ -2,42 +2,33 @@
 
 # DO NOT EDIT - This file is being maintained by Chef
 
-# abort on error
-
-set -e
-
 # setup
 
 PLANETDIR="<%= @directory %>/planet"
 LOGDIR="${PLANETDIR}/log"
-PLANETOLD="${PLANETDIR}/planet.pbf"
+PLANETPREV="${PLANETDIR}/planet-previous.pbf"
+PLANETCURR="${PLANETDIR}/planet.pbf"
 PLANETNEW="${PLANETDIR}/planet-new.pbf"
-STATEDIR="${PLANETDIR}/replication"
-OSCFILE="${PLANETDIR}/$(date +%Y%m%d-%H%M).osc"
 
 # start logging
 
 exec > "${LOGDIR}/$(date +%Y%m%d-%H%M).log" 2>&1
 
-# if there are old .osc files, they have to be taken into account
+retval=1
+while [ $retval -eq 1 ]; do
+    pyosmium-up-to-date -v -o $PLANETNEW $PLANETCURR
+    retval=$?
+done
 
-OLDFILE="$(find "${PLANETDIR}" -name "2*-*.osc" -print)"
-if [ -z "$OLDFILE" ]
-then
-   osmosis --rri "$STATEDIR" --simc --write-xml-change "$OSCFILE"
-else
-   osmosis --rxc "$OLDFILE" --rri "$STATEDIR" --mc --simc --write-xml-change "$OSCFILE" && rm "$OLDFILE"
+if [ $retval -ne 0 ]; then
+  exit $retval
 fi
 
-# osc file is ready, create new planet file
-
-osmosis --read-xml-change "$OSCFILE" --read-bin "$PLANETOLD" --buffer bufferCapacity=12000 --apply-change --buffer bufferCapacity=12000 --write-pbf file="$PLANETNEW"
-
 # cleanup
 
-mv "$PLANETNEW" "$PLANETOLD"
-rm "$OSCFILE"
+mv "$PLANETCURR" "$PLANETPREV"
+mv "$PLANETNEW" "$PLANETCURR"
 
 # expire old logs
 
-find "${LOGDIR}" -mtime +28 -delte
+find "${LOGDIR}" -mtime +28 -delete