[Git][debian-gis-team/pgsql-ogr-fdw][upstream] New upstream version 1.0.6
Bas Couwenberg
gitlab at salsa.debian.org
Fri Jul 6 20:06:44 BST 2018
Bas Couwenberg pushed to branch upstream at Debian GIS Project / pgsql-ogr-fdw
Commits:
849f4f00 by Bas Couwenberg at 2018-07-06T19:42:27+02:00
New upstream version 1.0.6
- - - - -
6 changed files:
- .travis.yml
- Makefile
- + ci/pg_hba.conf
- ogr_fdw.c
- stringbuffer.c
- + stringbuffer_pg.c
Changes:
=====================================
.travis.yml
=====================================
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,59 +1,47 @@
+dist: trusty
sudo: required
-
+language: cpp
compiler: gcc
+addons:
+ apt:
+ packages:
+ - curl
+ - libcurl4-gnutls-dev
+ - ca-certificates
+ - software-properties-common
+ - python-software-properties
+ - gnupg-curl
-matrix:
- include:
- - os: linux
- language: c
- env:
- - GDAL_VERSION=11
- - os: linux
- language: cpp
- env:
- - GDAL_VERSION=20
- - os: linux
- language: cpp
- env:
- - GDAL_VERSION=21
- - os: linux
- language: cpp
- env:
- - GDAL_VERSION=22
+env:
+ - PG_VERSION=9.6 GDAL_VERSION=1.1
+ - PG_VERSION=9.6 GDAL_VERSION=2.2.4
+ - PG_VERSION=9.6 GDAL_VERSION=2.3.1
+ - PG_VERSION=10 GDAL_VERSION=2.3.1
before_script:
- sudo /etc/init.d/postgresql stop
- - sudo apt-get -y remove --purge postgresql-9.1
- - sudo apt-get -y remove --purge postgresql-9.2
- - sudo apt-get -y remove --purge postgresql-9.3
- - sudo apt-get -y remove --purge postgresql-9.4
+ - sudo apt-get -y --purge remove postgresql-9.1
+ - sudo apt-get -y --purge remove postgresql-9.2
+ - sudo apt-get -y --purge remove postgresql-9.3
+ - sudo apt-get -y --purge remove postgresql-9.4
+ - sudo apt-get -y --purge remove postgresql-9.5
+ - sudo apt-get -y --purge remove postgresql-9.6
- sudo apt-get -y autoremove
- - sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 7FCC7D46ACCC4CF8
- - sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main 9.5" >> /etc/apt/sources.list.d/postgresql.list'
- - sudo apt-get update
- - sudo apt-get -y install postgresql-9.5 postgresql-server-dev-9.5
- - sudo sh -c 'echo "local all all trust" > /etc/postgresql/9.5/main/pg_hba.conf'
- - sudo sh -c 'echo -n "host all all 127.0.0.1/32 trust" >> /etc/postgresql/9.5/main/pg_hba.conf'
- - sudo /etc/init.d/postgresql stop
-# - sudo /etc/init.d/postgresql start
-# - sudo apt-get install valgrind
- - sudo -u postgres /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf 2>/tmp/postgres.log &
-# Run the Postgres instance under Valgrind and collect Valgrind log
-# - sudo -u postgres valgrind --trace-children=yes --leak-check=full /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf 2>/tmp/postgres.log &
- - psql --version
- - if test "$GDAL_VERSION" = "11"; then sudo apt-get install libgdal1h libgdal-dev; fi
- - if test "$GDAL_VERSION" = "20"; then wget http://download.osgeo.org/gdal/2.0.3/gdal-2.0.3.tar.xz; tar xJf gdal-2.0.3.tar.xz; cd gdal-2.0.3; ./configure --prefix=/usr --enable-debug --without-libtool; make -j4 >/dev/null; sudo make install >/dev/null; cd ..; gdalinfo --version; fi
- - if test "$GDAL_VERSION" = "21"; then wget http://download.osgeo.org/gdal/2.1.4/gdal-2.1.4.tar.xz; tar xJf gdal-2.1.4.tar.xz; cd gdal-2.1.4; ./configure --prefix=/usr --enable-debug --without-libtool; make -j4 >/dev/null; sudo make install >/dev/null; cd ..; gdalinfo --version; fi
- - if test "$GDAL_VERSION" = "22"; then wget http://download.osgeo.org/gdal/2.2.2/gdal-2.2.2.tar.xz; tar xJf gdal-2.2.2.tar.xz; cd gdal-2.2.2; ./configure --prefix=/usr --enable-debug --without-libtool; make -j4 >/dev/null; sudo make install >/dev/null; cd ..; gdalinfo --version; fi
-
+ - sudo rm -rf /var/lib/postgresql
+ - apt-key adv --fetch-keys https://www.postgresql.org/media/keys/ACCC4CF8.asc
+ - sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main $PG_VERSION"
+ - sudo apt-get update -qq
+ - sudo apt-get -y install postgresql-$PG_VERSION postgresql-server-dev-$PG_VERSION
+ - sudo cp ci/pg_hba.conf /etc/postgresql/$PG_VERSION/main/pg_hba.conf
+ - sudo /etc/init.d/postgresql reload
+
+ - if [[ $GDAL_VERSION == 1* ]]; then sudo apt-get install libgdal1h libgdal-dev; fi
+ - if [[ $GDAL_VERSION == 2* ]]; then wget http://download.osgeo.org/gdal/$GDAL_VERSION/gdal-$GDAL_VERSION.tar.xz; tar xJf gdal-$GDAL_VERSION.tar.xz; cd gdal-$GDAL_VERSION; ./configure --prefix=/usr --enable-debug --without-libtool; make -j4 >/dev/null; sudo make install >/dev/null; cd ..; gdalinfo --version; fi
+
script:
- make
- sudo make install
- sudo chmod 755 $HOME
- - env
- PGUSER=postgres make installcheck || (cat regression.diffs && /bin/false)
-# Small delay so that things get flushed
-# - sleep 5
-# Check that ogr_fdw doesn't appear in Valgrind log
-# - if sudo -u postgres grep ogr_fdw /tmp/postgres.log > /dev/null; then sudo -u postgres cat /tmp/postgres.log && /bin/false; fi
+
=====================================
Makefile
=====================================
--- a/Makefile
+++ b/Makefile
@@ -42,9 +42,6 @@ LIBS = $(GDAL_LIBS)
ogr_fdw_info$(X): ogr_fdw_info.o ogr_fdw_common.o stringbuffer.o
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
-stringbuffer_pg.o: stringbuffer.c stringbuffer.h
- $(CC) $(CFLAGS) -D USE_PG_MEM -c -o $@ $<
-
clean-exe:
rm -f ogr_fdw_info$(X) ogr_fdw_info.o stringbuffer.o
=====================================
ci/pg_hba.conf
=====================================
--- /dev/null
+++ b/ci/pg_hba.conf
@@ -0,0 +1,8 @@
+# TYPE DATABASE USER ADDRESS METHOD
+
+# "local" is for Unix domain socket connections only
+local all postgres trust
+# IPv4 local connections:
+host all postgres 127.0.0.1/32 trust
+# IPv6 local connections:
+host all postgres ::1/128 trust
=====================================
ogr_fdw.c
=====================================
--- a/ogr_fdw.c
+++ b/ogr_fdw.c
@@ -164,7 +164,7 @@ static void ogrReadColumnData(OgrFdwState *state);
/* Global to hold GEOMETRYOID */
Oid GEOMETRYOID = InvalidOid;
-#if GDAL_VERSION_MAJOR >= 2 && GDAL_VERSION_MINOR >= 1
+#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,1,0)
static void
ogrErrorHandler(CPLErr eErrClass, int err_no, const char *msg)
{
@@ -204,7 +204,7 @@ _PG_init(void)
on_proc_exit(&ogr_fdw_exit, PointerGetDatum(NULL));
-#if GDAL_VERSION_MAJOR >= 2 && GDAL_VERSION_MINOR >= 1
+#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,1,0)
/* Hook up the GDAL error handlers to PgSQL elog() */
CPLSetErrorHandler(ogrErrorHandler);
CPLSetCurrentErrorHandlerCatchDebug(true);
@@ -1099,7 +1099,7 @@ ogrReadColumnData(OgrFdwState *state)
/* Get OGR metadata ready */
dfn = OGR_L_GetLayerDefn(state->ogr.lyr);
ogr_ncols = OGR_FD_GetFieldCount(dfn);
-#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
+#if (GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0))
ogr_geom_count = OGR_FD_GetGeomFieldCount(dfn);
#else
ogr_geom_count = ( OGR_FD_GetGeomType(dfn) != wkbNone ) ? 1 : 0;
@@ -1155,7 +1155,11 @@ ogrReadColumnData(OgrFdwState *state)
getTypeBinaryOutputInfo(col.pgtype, &col.pgsendfunc, &col.pgsendvarlena);
/* Get the PgSQL column name */
- col.pgname = get_relid_attribute_name(rel->rd_id, att_tuple->attnum);
+#if PG_VERSION_NUM >= 110000
+ col.pgname = get_attname(rel->rd_id, att_tuple->attnum, false);
+#else
+ col.pgname = get_attname(rel->rd_id, att_tuple->attnum);
+#endif
/* Handle FID first */
if ( strcaseeq(col.pgname, "fid") && (col.pgtype == INT4OID || col.pgtype == INT8OID) )
@@ -1442,7 +1446,7 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot *slot, const OgrFdwExecS
unsigned char *wkb;
OGRErr err;
-#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
+#if (GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0))
OGRGeometryH geom = OGR_F_GetGeomFieldRef(feat, ogrfldnum);
#else
OGRGeometryH geom = OGR_F_GetGeometryRef(feat);
@@ -1546,7 +1550,7 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot *slot, const OgrFdwExecS
}
else if ( ogrvariant == OGR_FIELD )
{
-#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,2,0)
+#if (GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,2,0))
int field_not_null = OGR_F_IsFieldSet(feat, ogrfldnum) && ! OGR_F_IsFieldNull(feat, ogrfldnum);
#else
int field_not_null = OGR_F_IsFieldSet(feat, ogrfldnum);
@@ -1797,7 +1801,7 @@ ogrSlotToFeature(const TupleTableSlot *slot, OGRFeatureH feat, const OgrFdwTable
OGRErr err;
if ( nulls[i] )
{
-#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
+#if (GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0))
err = OGR_F_SetGeomFieldDirectly(feat, ogrfldnum, NULL);
#else
err = OGR_F_SetGeometryDirectly(feat, NULL);
@@ -1818,7 +1822,7 @@ ogrSlotToFeature(const TupleTableSlot *slot, OGRFeatureH feat, const OgrFdwTable
if ( err != OGRERR_NONE )
return err;
-#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
+#if (GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0))
err = OGR_F_SetGeomFieldDirectly(feat, ogrfldnum, geom);
#else
err = OGR_F_SetGeometryDirectly(feat, geom);
=====================================
stringbuffer.c
=====================================
--- a/stringbuffer.c
+++ b/stringbuffer.c
@@ -11,18 +11,6 @@
#include "stringbuffer.h"
-#ifdef USE_PG_MEM
-
-void * palloc(size_t sz);
-void pfree(void *ptr);
-void * repalloc(void *ptr, size_t sz);
-
-#define malloc(sz) palloc(sz)
-#define free(ptr) pfree(ptr)
-#define realloc(ptr,sz) repalloc(ptr,sz)
-
-#endif
-
/**
* Allocate a new stringbuffer_t. Use stringbuffer_destroy to free.
*/
=====================================
stringbuffer_pg.c
=====================================
--- /dev/null
+++ b/stringbuffer_pg.c
@@ -0,0 +1,32 @@
+/*-------------------------------------------------------------------------
+ *
+ * stringbuffer.c
+ * simple stringbuffer
+ *
+ * Copyright (c) 2009, Paul Ramsey <pramsey at cleverelephant.ca>
+ * Copyright (c) 2002 Thamer Alharbash
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/*
+ * We need a version of stringbuffer that uses palloc/pfree/repalloc
+ * for use inside PgSQL. (We are sharing code in ogr_fdw_common.c
+ * between the commandline utility and the backend module, so we
+ * cannot just depend on the PgSQL standard string handling utility)
+ * We rebuild it here, but with the pgsql memory stuff in place
+ * of the standard system calls
+ */
+
+#include "stringbuffer.h"
+
+void * palloc(size_t sz);
+void pfree(void *ptr);
+void * repalloc(void *ptr, size_t sz);
+
+#define malloc(sz) palloc(sz)
+#define free(ptr) pfree(ptr)
+#define realloc(ptr,sz) repalloc(ptr,sz)
+
+#include "stringbuffer.c"
+
View it on GitLab: https://salsa.debian.org/debian-gis-team/pgsql-ogr-fdw/commit/849f4f0086a5824208445aaabc351d7ad9b5c053
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pgsql-ogr-fdw/commit/849f4f0086a5824208445aaabc351d7ad9b5c053
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20180706/ae94f8c3/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list