Skip to content
Commits on Source (10)
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
- 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
......@@ -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
......
# 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
pgsql-ogr-fdw (1.0.5-3) UNRELEASED; urgency=medium
pgsql-ogr-fdw (1.0.6-1) unstable; urgency=medium
* Team upload.
* New upstream release.
* Update Vcs-* URLs for Salsa.
* Bump Standards-Version to 4.1.5, no changes.
* Strip trailing whitespace from control file.
* Update copyright file, add license & copyright for stringbuffer_pg.c.
* Refresh patches.
* Fix typo in patch description.
* Enable all hardening buildflags.
* Add patch to use LDFLAGS for hardeningflags.
-- Christoph Berg <myon@debian.org> Sat, 31 Mar 2018 12:44:15 +0200
-- Bas Couwenberg <sebastic@debian.org> Fri, 06 Jul 2018 19:47:19 +0200
pgsql-ogr-fdw (1.0.5-2) unstable; urgency=medium
......
......@@ -39,3 +39,4 @@ Description: PostgreSQL foreign data wrapper for OGR
only requesting the columns needed to fulfill a query. This would be a
minimal efficiency improvement, but can be removed given some development
time, since the OGR API supports returning a subset of columns.
......@@ -9,7 +9,9 @@ License: Expat
Files: stringbuffer.c
stringbuffer.h
Copyright: 2002 Thamer Alharbash
stringbuffer_pg.c
Copyright: 2002, Thamer Alharbash
2009, Paul Ramsey <pramsey@cleverelephant.ca>
License: Expat
Files: debian/*
......
Description: Use LDFLAGS for hardeningflags.
Author: Bas Couwenberg <sebastic@debian.org>
--- a/Makefile
+++ b/Makefile
@@ -40,7 +40,7 @@ CFLAGS = $(GDAL_CFLAGS)
LIBS = $(GDAL_LIBS)
ogr_fdw_info$(X): ogr_fdw_info.o ogr_fdw_common.o stringbuffer.o
- $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
clean-exe:
rm -f ogr_fdw_info$(X) ogr_fdw_info.o stringbuffer.o
Description: Fix installation of ogr_fdw_info binary.
It would get installed with the name of the binary direcory itself instead of
It would get installed with the name of the binary directory itself instead of
bin/ogr_fdw_info.
Last-Update: 2017-02-19
Author: Michael Fladischer <fladi@debian.org>
Forwarded: no
Index: postgresql-ogr-fdw/Makefile
===================================================================
--- postgresql-ogr-fdw.orig/Makefile 2017-02-12 21:30:23.052413721 +0100
+++ postgresql-ogr-fdw/Makefile 2017-02-19 19:16:44.736277938 +0100
@@ -44,7 +44,7 @@
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,7 @@ clean-exe:
rm -f ogr_fdw_info$(X) ogr_fdw_info.o stringbuffer.o
install-exe: all
......
install.patch
hardingflags.patch
#!/usr/bin/make -f
# Enable hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
# Rebuild debian/control from debian/control.in
include /usr/share/postgresql-common/pgxs_debian_control.mk
......
......@@ -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);
......
......@@ -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.c
* simple stringbuffer
*
* Copyright (c) 2009, Paul Ramsey <pramsey@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"