]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 29 Aug 2015 10:16:33 +0000 (12:16 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sat, 29 Aug 2015 10:16:33 +0000 (12:16 +0200)
configure.ac
m4/ax_lib_postgresql_svr.m4 [new file with mode: 0644]
nominatim/Makefile.am
osm2pgsql
tests/features/osm2pgsql/import/tags.feature
tests/steps/osm2pgsql_setup.py

index badcb5b224258b4ef2754775a9ba53d86db8302f..53a8e8714281cafa64b4d17cbffbbfee85535424 100644 (file)
@@ -9,6 +9,7 @@ AC_PREREQ(2.61)
 AM_INIT_AUTOMAKE([1.9.6 dist-bzip2 std-options check-news])
 
 dnl Additional macro definitions are in here
+m4_include([m4/ax_lib_postgresql_svr.m4])
 AC_CONFIG_MACRO_DIR([osm2pgsql/m4])
 
 dnl Generate configuration header file
@@ -45,6 +46,7 @@ if test "x$POSTGRESQL_VERSION" = "x"
 then
     AC_MSG_ERROR([postgresql client library not found])
 fi
+AX_LIB_POSTGRESQL_SVR(9.0)
 if test ! -f "$POSTGRESQL_PGXS"
 then
     AC_MSG_ERROR([postgresql server development library not found])
diff --git a/m4/ax_lib_postgresql_svr.m4 b/m4/ax_lib_postgresql_svr.m4
new file mode 100644 (file)
index 0000000..56ecb5b
--- /dev/null
@@ -0,0 +1,125 @@
+# SYNOPSIS
+#
+#   AX_LIB_POSTGRESQL_SVR([MINIMUM-VERSION])
+#
+# DESCRIPTION
+#
+#   This macro provides tests of availability of PostgreSQL server library
+#
+#   This macro calls:
+#
+#     AC_SUBST(POSTGRESQL_PGXS)
+#     AC_SUBST(POSTGRESQL_SERVER_CFLAGS)
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net>
+#   Copyright (c) 2015 Sarah Hoffmann <lonia@denofr.de>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_LIB_POSTGRESQL_SVR],
+[
+    AC_ARG_WITH([postgresql],
+        AC_HELP_STRING([--with-postgresql-svr=@<:@ARG@:>@],
+            [use PostgreSQL server library @<:@default=yes@:>@, optionally specify path to pg_config]
+        ),
+        [
+        if test "$withval" = "no"; then
+            want_postgresql="no"
+        elif test "$withval" = "yes"; then
+            want_postgresql="yes"
+        else
+            want_postgresql="yes"
+            PG_CONFIG="$withval"
+        fi
+        ],
+        [want_postgresql="yes"]
+    )
+
+    dnl
+    dnl Check PostgreSQL server libraries
+    dnl
+
+    if test "$want_postgresql" = "yes"; then
+
+        if test -z "$PG_CONFIG" -o test; then
+            AC_PATH_PROG([PG_CONFIG], [pg_config], [])
+        fi
+
+        if test ! -x "$PG_CONFIG"; then
+            AC_MSG_ERROR([$PG_CONFIG does not exist or it is not an exectuable file])
+            PG_CONFIG="no"
+            found_postgresql="no"
+        fi
+
+        if test "$PG_CONFIG" != "no"; then
+            AC_MSG_CHECKING([for PostgreSQL server libraries])
+
+            POSTGRESQL_SERVER_CFLAGS="-I`$PG_CONFIG --includedir-server`"
+
+            POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'`
+
+            POSTGRESQL_PGXS=`$PG_CONFIG --pgxs`
+        if test -f "$POSTGRESQL_PGXS"
+        then
+          found_postgresql="yes"
+              AC_MSG_RESULT([yes])
+        fi
+        else
+            found_postgresql="no"
+            AC_MSG_RESULT([no])
+        fi
+    fi
+
+    dnl
+    dnl Check if required version of PostgreSQL is available
+    dnl
+
+
+    postgresql_version_req=ifelse([$1], [], [], [$1])
+
+    if test "$found_postgresql" = "yes" -a -n "$postgresql_version_req"; then
+
+        AC_MSG_CHECKING([if PostgreSQL version is >= $postgresql_version_req])
+
+        dnl Decompose required version string of PostgreSQL
+        dnl and calculate its number representation
+        postgresql_version_req_major=`expr $postgresql_version_req : '\([[0-9]]*\)'`
+        postgresql_version_req_minor=`expr $postgresql_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
+        postgresql_version_req_micro=`expr $postgresql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+        if test "x$postgresql_version_req_micro" = "x"; then
+            postgresql_version_req_micro="0"
+        fi
+
+        postgresql_version_req_number=`expr $postgresql_version_req_major \* 1000000 \
+                                   \+ $postgresql_version_req_minor \* 1000 \
+                                   \+ $postgresql_version_req_micro`
+
+        dnl Decompose version string of installed PostgreSQL
+        dnl and calculate its number representation
+        postgresql_version_major=`expr $POSTGRESQL_VERSION : '\([[0-9]]*\)'`
+        postgresql_version_minor=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'`
+        postgresql_version_micro=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+        if test "x$postgresql_version_micro" = "x"; then
+            postgresql_version_micro="0"
+        fi
+
+        postgresql_version_number=`expr $postgresql_version_major \* 1000000 \
+                                   \+ $postgresql_version_minor \* 1000 \
+                                   \+ $postgresql_version_micro`
+
+        postgresql_version_check=`expr $postgresql_version_number \>\= $postgresql_version_req_number`
+        if test "$postgresql_version_check" = "1"; then
+            AC_MSG_RESULT([yes])
+        else
+            AC_MSG_RESULT([no])
+        fi
+    fi
+
+    AC_SUBST([POSTGRESQL_PGXS])
+    AC_SUBST([POSTGRESQL_SERVER_CFLAGS])
+])
+
index 3f65398a73fb35b3c2813e74fcf1c5c75660d608..d27ae55490e4287911a990a4d89e29b1ccdece92 100644 (file)
@@ -2,8 +2,8 @@ bin_PROGRAMS = nominatim
 
 nominatim_SOURCES = export.c geometry.cpp import.c index.c input.c nominatim.c postgresql.c sprompt.c
 
-AM_CFLAGS = @PTHREAD_CFLAGS@ @POSTGRESQL_CFLAGS@ @XML_CPPFLAGS@ @BZIP2_CFLAGS@  @GEOS_CFLAGS@ @PROJ_CFLAGS@ -DVERSION='"@PACKAGE_VERSION@"'
-AM_CPPFLAGS = @PTHREAD_CFLAGS@ @POSTGRESQL_CFLAGS@ @XML_CPPFLAGS@ @BZIP2_CFLAGS@  @GEOS_CFLAGS@ @PROJ_CFLAGS@
+AM_CFLAGS = @PTHREAD_CFLAGS@ @POSTGRESQL_CPPFLAGS@ @XML_CPPFLAGS@ @BZIP2_CFLAGS@  @GEOS_CFLAGS@ @PROJ_CFLAGS@ -DVERSION='"@PACKAGE_VERSION@"'
+AM_CPPFLAGS = @PTHREAD_CFLAGS@ @POSTGRESQL_CPPFLAGS@ @XML_CPPFLAGS@ @BZIP2_CFLAGS@  @GEOS_CFLAGS@ @PROJ_CFLAGS@
 
 nominatim_LDADD = @PTHREAD_CFLAGS@ @POSTGRESQL_LDFLAGS@ @POSTGRESQL_LIBS@ @XML_LIBS@ @BZIP2_LDFLAGS@ @BZIP2_LIBS@ @GEOS_LDFLAGS@ @GEOS_LIBS@ @PROJ_LDFLAGS@ @PROJ_LIBS@ -lz
 
index 07db15e5e55eca63971a014ddb08bc47cd89f762..8179cdb67e70d7fb5605ab6ddedfd0bd3347db47 160000 (submodule)
--- a/osm2pgsql
+++ b/osm2pgsql
@@ -1 +1 @@
-Subproject commit 07db15e5e55eca63971a014ddb08bc47cd89f762
+Subproject commit 8179cdb67e70d7fb5605ab6ddedfd0bd3347db47
index 759c6b964e295665058d0c8e72d1e12f9e13dfe2..149c48138f9e693703c04d2fa1a4dc6affc187b0 100644 (file)
@@ -79,19 +79,20 @@ Feature: Tag evaluation
      | my:ref
      | br:name
      | name:prefix
+     | name:source
 
     Scenario: Special character in name tag
         Given the osm nodes:
          | id | tags
-         | 1  | 'highway' : 'yes', 'name: de' : 'Foo', 'name' : 'real'
-         | 2  | 'highway' : 'yes', 'name:\nde' : 'Foo', 'name' : 'real'
-         | 3  | 'highway' : 'yes', 'name:\tde' : 'Foo', 'name:\\' : 'real'
+         | 1  | 'highway' : 'yes', 'name: de' : 'Foo', 'name' : 'real1'
+         | 2  | 'highway' : 'yes', 'name:&#xa;de' : 'Foo', 'name' : 'real2'
+         | 3  | 'highway' : 'yes', 'name:&#x9;de' : 'Foo', 'name:\\' : 'real3'
         When loading osm data
         Then table place contains
          | object | name
-         | N1     | 'name:_de' : 'Foo', 'name' : 'real'
-         | N2     | 'name:_de' : 'Foo', 'name' : 'real'
-         | N3     | 'name:_de' : 'Foo', 'name:\\\\' : 'real'
+         | N1     | 'name: de' : 'Foo', 'name' : 'real1'
+         | N2     | 'name: de' : 'Foo', 'name' : 'real2'
+         | N3     | 'name: de' : 'Foo', 'name:\\\\' : 'real3'
 
     Scenario Outline: Included places
         Given the osm nodes:
@@ -217,6 +218,14 @@ Feature: Tag evaluation
       | boundary | administrative
       | waterway | stream
 
+    Scenario: Footways are not included if they are sidewalks
+        Given the osm nodes:
+         | id | tags
+         | 2  | 'highway' : 'footway', 'name' : 'To Hell', 'footway' : 'sidewalk'
+         | 23 | 'highway' : 'footway', 'name' : 'x'
+        When loading osm data
+        Then table place has no entry for N2
+
     Scenario: named junctions are included if there is no other tag
         Given the osm nodes:
          | id | tags
@@ -393,7 +402,7 @@ Feature: Tag evaluation
         Then table place contains
           | object | class   | type    | isin
           | N10    | place   | village | Feebourgh county
-          | N11    | place   | village | Alabama,Feebourgh county
+          | N11    | place   | village | Feebourgh county,Alabama
           | N12    | place   | village | Feebourgh county
 
     Scenario Outline: Import of address tags
@@ -508,6 +517,10 @@ Feature: Tag evaluation
        | locality
        | wikipedia
        | wikipedia:de
+       | wikidata
+       | name:prefix
+       | name:botanical
+       | name:etymology:wikidata
 
     Scenario: buildings
         Given the osm nodes:
index e5198d9df97736d3a3685a2fd365cd7f3e2d8516..eaa14573b58675b9ce2ac403f51ba3a14e3c2223 100644 (file)
@@ -140,7 +140,7 @@ def osm2pgsql_load_place(step):
     world.osm2pgsql.sort(cmp=_sort_xml_entries)
 
     # create a OSM file in /tmp
-    with tempfile.NamedTemporaryFile(dir='/tmp', delete=False) as fd:
+    with tempfile.NamedTemporaryFile(dir='/tmp', suffix='.osm', delete=False) as fd:
         fname = fd.name
         fd.write("<?xml version='1.0' encoding='UTF-8'?>\n")
         fd.write('<osm version="0.6" generator="test-nominatim" timestamp="2014-08-26T20:22:02Z">\n')
@@ -188,7 +188,7 @@ def osm2pgsql_update_place(step):
     world.run_nominatim_script('setup', 'index', 'index-noanalyse')
     world.run_nominatim_script('setup', 'create-functions', 'create-partition-functions', 'enable-diff-updates')
 
-    with tempfile.NamedTemporaryFile(dir='/tmp', delete=False) as fd:
+    with tempfile.NamedTemporaryFile(dir='/tmp', suffix='.osc', delete=False) as fd:
         fname = fd.name
         fd.write("<?xml version='1.0' encoding='UTF-8'?>\n")
         fd.write('<osmChange version="0.6" generator="Osmosis 0.43.1">\n')