From 9fd4c120648e6e902b924d5da0d8de42cbe27084 Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Fri, 11 Nov 2016 19:20:27 +0300 Subject: [PATCH] [build] Small fixes to build process and styles --- data/mapcss-mapping.csv | 2 +- tools/kothic | 2 +- tools/python/booking_hotels.py | 8 +++++++- tools/python/mwm/mwm.py | 2 +- tools/unix/build_omim.sh | 8 +++++++- tools/unix/generate_planet.sh | 23 ++++++++++++++++++----- 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/data/mapcss-mapping.csv b/data/mapcss-mapping.csv index 5ee8c58927..ba14da09a9 100644 --- a/data/mapcss-mapping.csv +++ b/data/mapcss-mapping.csv @@ -1098,7 +1098,7 @@ shop|wine;1097; tourism|chalet;1098; tourism|information|board;[tourism=information][information=board];;name;int_name;1099; tourism|information|map;[tourism=information][information=map];;name;int_name;1100; -tourism|information|office;[tourism=information][information=office];;name;int_name;1101; +tourism|information|office;[tourism=information][information=office];x;name;int_name;1101;tourism|information|office traffic_calming|bump;1102; traffic_calming|hump;1103; shop|car_parts;1104; diff --git a/tools/kothic b/tools/kothic index c32d9c5e22..1ffa4306fe 160000 --- a/tools/kothic +++ b/tools/kothic @@ -1 +1 @@ -Subproject commit c32d9c5e22d6f42c582c2234e9881cda5f6db4f5 +Subproject commit 1ffa4306fe949c6345414823946ee7b1bbf8a07e diff --git a/tools/python/booking_hotels.py b/tools/python/booking_hotels.py index d64c1f9e8c..8b315d7e3e 100755 --- a/tools/python/booking_hotels.py +++ b/tools/python/booking_hotels.py @@ -89,7 +89,8 @@ def download(user, password, path): # Check for error. if hotels is None: - exit(1) + logging.critical('No hotels downloaded for country {0}'.format(country['name'])) + break for h in hotels: allhotels[h['hotel_id']] = h @@ -98,6 +99,9 @@ def download(user, password, path): if len(hotels) < maxrows: break + if not hotels: + continue + # Now the same for hotel translations offset = 0 while True: @@ -116,6 +120,8 @@ def download(user, password, path): if len(hotels) < maxrows: break + if not hotels: + raise Exception('Failed to load any hotels') logging.info('Num of hotels: {0}, translations: {1}'.format(len(allhotels), offset)) filename = os.path.join(path, '{0} - {1}.pkl'.format(country['area'].encode('utf8'), country['name'].encode('utf8'))) diff --git a/tools/python/mwm/mwm.py b/tools/python/mwm/mwm.py index 65929831bd..bb8f3d8100 100644 --- a/tools/python/mwm/mwm.py +++ b/tools/python/mwm/mwm.py @@ -258,7 +258,7 @@ class MWM: if type_id < len(self.type_mapping): types.append(self.type_mapping[type_id]) else: - types.append(str(type_id)) + types.append(str(type_id + 1)) # So the numbers match with mapcss-mapping.csv header['types'] = types if has_name: header['name'] = self.read_multilang() diff --git a/tools/unix/build_omim.sh b/tools/unix/build_omim.sh index 0ee6527b24..509ca9f7c4 100755 --- a/tools/unix/build_omim.sh +++ b/tools/unix/build_omim.sh @@ -96,7 +96,13 @@ build_conf() else "$QMAKE" "$OMIM_PATH/omim.pro" -spec $SPEC CONFIG+=$CONF ${CONFIG+"CONFIG*=$CONFIG"} fi - make -j $PROCESSES + TMP_FILE="build_error.log" + if ! make -j $PROCESSES 2> "$TMP_FILE"; then + echo '--------------------' + cat "$TMP_FILE" + exit 1 + fi + rm "$TMP_FILE" ) } diff --git a/tools/unix/generate_planet.sh b/tools/unix/generate_planet.sh index d3aa4e05f8..743e1b1284 100755 --- a/tools/unix/generate_planet.sh +++ b/tools/unix/generate_planet.sh @@ -138,6 +138,9 @@ OMIM_PATH="${OMIM_PATH:-$(cd "$(dirname "$0")/../.."; pwd)}" DATA_PATH="${DATA_PATH:-$OMIM_PATH/data}" [ ! -r "${DATA_PATH}/types.txt" ] && fail "Cannot find classificators in $DATA_PATH, please set correct OMIM_PATH" [ -n "$OPT_ROUTING" -a ! -f "$HOME/.stxxl" ] && fail "For routing, you need ~/.stxxl file. Run this: echo 'disk=$HOME/stxxl_disk1,400G,syscall' > $HOME/.stxxl" +if [ -n "$OPT_ROUTING" -a -n "${OSRM_URL-}" ]; then + curl -s "http://$OSRM_URL/way_id" | grep -q position || fail "Cannot access $OSRM_URL" +fi TARGET="${TARGET:-$DATA_PATH}" mkdir -p "$TARGET" INTDIR="${INTDIR:-$TARGET/intermediate_data}" @@ -254,8 +257,13 @@ if [ "$MODE" == "coast" ]; then if [ ! -f "$BOOKING_FILE" -a -n "${BOOKING_USER-}" -a -n "${BOOKING_PASS-}" ]; then log "STATUS" "Step S1: Starting background hotels downloading" ( - $PYTHON $BOOKING_SCRIPT --user $BOOKING_USER --password $BOOKING_PASS --path "$INTDIR" --download --translate --output "$BOOKING_FILE" 2>"$LOG_PATH"/booking.log & - echo "Hotels have been downloaded. Please ensure this line is before Step 4." >> "$PLANET_LOG" + $PYTHON $BOOKING_SCRIPT --user $BOOKING_USER --password $BOOKING_PASS --path "$INTDIR" --download --translate --output "$BOOKING_FILE" 2>"$LOG_PATH"/booking.log || true + if [ -f "$BOOKING_FILE" -a "$(wc -l < "$BOOKING_FILE" || echo 0)" -gt 100 ]; then + echo "Hotels have been downloaded. Please ensure this line is before Step 4." >> "$PLANET_LOG" + else + log "Failed to download hotels!" + [ -n "${MAIL-}" ] && tail "$LOG_PATH/booking.log" | mailx -s "Failed to download hotels at $(hostname), please hurry to fix" "$MAIL" + fi ) & fi @@ -263,8 +271,13 @@ if [ "$MODE" == "coast" ]; then if [ ! -f "$OPENTABLE_FILE" -a -n "${OPENTABLE_USER-}" -a -n "${OPENTABLE_PASS-}" ]; then log "STATUS" "Step S2: Starting background restaurants downloading" ( - $PYTHON $OPENTABLE_SCRIPT --client $OPENTABLE_USER --secret $OPENTABLE_PASS --opentable_data "$INTDIR"/opentable.json --download --tsv "$OPENTABLE_FILE" 2>"$LOG_PATH"/opentable.log & - echo "Restaurants have been downloaded. Please ensure this line is before Step 4." >> "$PLANET_LOG" + $PYTHON $OPENTABLE_SCRIPT --client $OPENTABLE_USER --secret $OPENTABLE_PASS --opentable_data "$INTDIR"/opentable.json --download --tsv "$OPENTABLE_FILE" 2>"$LOG_PATH"/opentable.log || true + if [ -f "$OPENTABLE_FILE" -a "$(wc -l < "$OPENTABLE_FILE" || echo 0)" -gt 100 ]; then + echo "Restaurants have been downloaded. Please ensure this line is before Step 4." >> "$PLANET_LOG" + else + log "Failed to download restaurants!" + [ -n "${MAIL-}" ] && tail "$LOG_PATH/opentable.log" | mailx -s "Failed to download restaurants at $(hostname), please hurry to fix" "$MAIL" + fi ) & fi @@ -312,7 +325,7 @@ if [ "$MODE" == "coast" ]; then then log "STATUS" "Coastline merge failed" if [ -n "$OPT_UPDATE" ]; then - [ -n "${MAIL-}" ] && tail -n 50 "$LOG_PATH/WorldCoasts.log" | mailx -s "Generate_planet: coastline merge failed, next try in $MERGE_INTERVAL minutes" "$MAIL" + [ -n "${MAIL-}" ] && tail -n 50 "$LOG_PATH/WorldCoasts.log" | mailx -s "Coastline merge at $(hostname) failed, next try in $MERGE_INTERVAL minutes" "$MAIL" echo "Will try fresh coasts again in $MERGE_INTERVAL minutes, or press a key..." read -rs -n 1 -t $(($MERGE_INTERVAL * 60)) || true TRY_AGAIN=1