Bug#738273: qgis-providers-common: fails to install, should use triggers for crssync

Sebastiaan Couwenberg sebastic at xs4all.nl
Sun Feb 9 21:52:51 UTC 2014


Hi Andreas,

Thanks for reporting this issue.

The srs.db provided by qgis-providers-common is updated by crssync
included in qgis-providers.

Because qgis-providers depends on qgis-providers-common, the common
package will be configured first, and I think this will prevent the
trigger in qgis-providers from running because that hasn't been
installed yet.

I've updated the qgis-providers-common.postinst to execute
`dpkg-trigger qgis-crssync` instead of `/usr/lib/qgis/crssync`,
added "interest qgis-crssync" in qgis-providers.triggers, and added
handling for the qgis-crssync named trigger in qgis-providers.postinst.

When I upgrade the the qgis 2.0.1-1 packages currently in unstable to
2.0.1-2 from my local repo the triggers are never run.

The trigger is only run when I `dpkg -i`
qgis-providers-common_2.0.1-2_all.deb from the apt archives cache after
wards.

Using a file based trigger on the srs.db may be an option, then we'll
need to watch for changes to /usr/share/qgis/resources/srs-template.db
which will be installed by dpkg whereas the srs.db is created from it in
the postinst to fix #738117.

I haven't tried the file based trigger yet, nor have I pushed my changes
thus far because they don't fix the issue just yet. The trigger changes
are included in the attached debdiff. I'll experiment with the file
based trigger to see if that works.

Kind Regards,

Bas
-------------- next part --------------
diff -Nru qgis-2.0.1/debian/changelog qgis-2.0.1/debian/changelog
--- qgis-2.0.1/debian/changelog	2014-01-18 03:34:17.000000000 +0100
+++ qgis-2.0.1/debian/changelog	2014-02-09 16:52:22.000000000 +0100
@@ -1,3 +1,25 @@
+qgis (2.0.1-2) UNRELEASED; urgency=low
+
+  [ Peter Michael Green ]
+  * Fix broken ARM patch by Konstantinos Margaritis.
+  * Fix qreal vs double issues with qmin and qmax.
+
+  [ Jürgen E. Fischer ]
+  * run crssync on copy of srs.db
+    (closes: #738117)
+
+  [ Bas Couwenberg ]
+  * Additional checks in qgis-providers-common.postinst 
+  * Add patch to fix mis-detection of PostGIS table types.
+  * Add patch to not look for topology layers without topology support.
+  * Add patch to fix postgis topology availability detection query.
+  * Enable parallel builds.
+  * Add patch to disable features on ARM.
+  * Add qgis-crssync dpkg trigger to run crssync after installing the srs.db.
+    (closes: #738273)
+
+ -- Bas Couwenberg <sebastic at xs4all.nl>  Fri, 31 Jan 2014 19:42:03 +0100
+
 qgis (2.0.1-1) unstable; urgency=low
 
   [ Jürgen E. Fischer ]
diff -Nru qgis-2.0.1/debian/patches/disable-features-on-arm.patch qgis-2.0.1/debian/patches/disable-features-on-arm.patch
--- qgis-2.0.1/debian/patches/disable-features-on-arm.patch	1970-01-01 01:00:00.000000000 +0100
+++ qgis-2.0.1/debian/patches/disable-features-on-arm.patch	2014-02-09 12:53:16.000000000 +0100
@@ -0,0 +1,66 @@
+Description: Disable troublesome features on ARM.
+ Building QGIS on ARM produces the error:
+
+ sip: qgis/python/core/qgsclipper.sip:44: \
+ QgsClipper::trimFeature() unsupported function argument type - provide %MethodCode and a C++ signature
+
+ In the upstream git repository this and other functions are disbled for
+ Android builds which have the same problems:
+
+ https://github.com/qgis/QGIS/commit/2cc684793ceb29d8600d71564fb38f92c998f588
+
+Author: Bas Couwenberg <sebastic at xs4all.nl>
+Bug-Debian: http://bugs.debian.org/737814
+
+--- a/python/core/qgsclipper.sip
++++ b/python/core/qgsclipper.sip
+@@ -1,3 +1,5 @@
++%Feature ARM
++
+ class QgsClipper
+ {
+ %TypeHeaderCode
+@@ -34,6 +36,7 @@ class QgsClipper
+     // A handy way to refer to the four boundaries
+     enum Boundary {XMax, XMin, YMax, YMin};
+ 
++%If (!ARM)
+     // Trims the given feature to a rectangular box. Returns the trimmed
+     // feature in x and y. The shapeOpen parameter determines whether
+     // the function treats the points as a closed shape (polygon), or as
+@@ -41,7 +44,7 @@ class QgsClipper
+     static void trimFeature( QVector<double>& x,
+                              QVector<double>& y,
+                              bool shapeOpen );
+-
++%End
+     static void trimPolygon( QPolygonF& pts, const QgsRectangle& clipRect );
+ 
+     /**Reads a polyline from WKB and clips it to clipExtent
+--- a/python/core/composer/qgscomposerscalebar.sip
++++ b/python/core/composer/qgscomposerscalebar.sip
+@@ -104,9 +104,11 @@ class QgsComposerScaleBar: QgsComposerIt
+     /**Returns style name*/
+     QString style() const;
+ 
++%If (!ARM)
+     /**Returns the x - positions of the segment borders (in item coordinates) and the width
+      of the segment*/
+     void segmentPositions( QList<QPair<double, double> >& posWidthList ) const;
++%End
+ 
+     /**Sets box size suitable to content*/
+     void adjustBoxSize();
+--- a/python/CMakeLists.txt
++++ b/python/CMakeLists.txt
+@@ -72,6 +72,10 @@ IF(PYQT4_VERSION_NUM LESS 264196)
+   SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} QLISTCONSTPTR_CONVERSION)
+ ENDIF(PYQT4_VERSION_NUM LESS 264196)
+ 
++IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
++  SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} ARM)
++ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
++
+ # core module
+ FILE(GLOB_RECURSE sip_files_core core/*.sip)
+ SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core})
diff -Nru qgis-2.0.1/debian/patches/fix-qreal-vs-double.patch qgis-2.0.1/debian/patches/fix-qreal-vs-double.patch
--- qgis-2.0.1/debian/patches/fix-qreal-vs-double.patch	1970-01-01 01:00:00.000000000 +0100
+++ qgis-2.0.1/debian/patches/fix-qreal-vs-double.patch	2014-02-08 05:33:38.000000000 +0100
@@ -0,0 +1,45 @@
+Description: Fix qreal vs double.
+ In qt4 on arm architectures qreal is defined as float while on other
+ architectures it is defined as double. This can cause problems if qreal
+ and double are carelessly mixed.
+
+ In this particular case the problem is that qMin/qMax are templates defined
+ to take two parameters of the same type. If two different types are passed
+ in then C++ can't resolve what type the template parameter should be and
+ bails out. The fix is simple, typecast one of the parameters so they
+ match.
+
+Author: Peter Michael Green <plugwash at debian.org>
+Bug-Debian: http://bugs.debian.org/737814
+
+--- a/src/app/gps/qwtpolar-1.0/qwt_polar_curve.cpp
++++ b/src/app/gps/qwtpolar-1.0/qwt_polar_curve.cpp
+@@ -433,7 +433,7 @@ void QwtPolarCurve::drawLines( QPainter
+ 
+     if ( !clipRect.isEmpty() )
+     {
+-        double off = qCeil( qMax( 1.0, painter->pen().widthF() ) );
++        double off = qCeil( qMax((qreal)1.0,painter->pen().widthF() ) );
+         clipRect = clipRect.toRect().adjusted( -off, -off, off, off );
+         polyline = QwtClipper::clipPolygonF( clipRect, polyline );
+     }
+--- a/src/app/gps/qwtpolar-1.0/qwt_polar_layout.cpp
++++ b/src/app/gps/qwtpolar-1.0/qwt_polar_layout.cpp
+@@ -278,7 +278,7 @@ QRectF QwtPolarLayout::layoutLegend( Opt
+         // We don't allow vertical legends to take more than
+         // half of the available space.
+ 
+-        dim = qMin( hint.width(), rect.width() * d_data->legendRatio );
++        dim = qMin( hint.width(), (qreal)(rect.width() * d_data->legendRatio) );
+ 
+         if ( !( options & IgnoreScrollbars ) )
+         {
+@@ -293,7 +293,7 @@ QRectF QwtPolarLayout::layoutLegend( Opt
+     }
+     else
+     {
+-        dim = qMin( hint.height(), rect.height() * d_data->legendRatio );
++        dim = qMin( hint.height(), (qreal)(rect.height() * d_data->legendRatio) );
+         dim = qMax( dim, d_data->layoutData.legend.hScrollBarHeight );
+     }
+ 
diff -Nru qgis-2.0.1/debian/patches/fix-query-to-detect-postgis-topology-availability.patch qgis-2.0.1/debian/patches/fix-query-to-detect-postgis-topology-availability.patch
--- qgis-2.0.1/debian/patches/fix-query-to-detect-postgis-topology-availability.patch	1970-01-01 01:00:00.000000000 +0100
+++ qgis-2.0.1/debian/patches/fix-query-to-detect-postgis-topology-availability.patch	2014-02-09 12:51:07.000000000 +0100
@@ -0,0 +1,17 @@
+From: Sandro Santilli <strk at keybit.net>
+Subject: Fix query to detect postgis topology availability.
+Origin: https://github.com/qgis/QGIS/commit/f8028087ad533307774c79afceb3580d27466664
+Bug: http://hub.qgis.org/issues/9453
+--- a/src/providers/postgres/qgspostgresconn.cpp
++++ b/src/providers/postgres/qgspostgresconn.cpp
+@@ -712,8 +712,8 @@ QString QgsPostgresConn::postgisVersion()
+   mTopologyAvailable = false;
+   if ( mPostgisVersionMajor > 1 )
+   {
+-    QgsPostgresResult result = PQexec( "SELECT count(c.oid) FROM pg_class AS c JOIN pg_namespace AS n ON c.relnamespace=n.oid WHERE n.nspname='topology' AND c.relname='topology'" );
+-    if ( result.PQntuples() >= 1 )
++    QgsPostgresResult result = PQexec( "SELECT EXISTS ( SELECT c.oid FROM pg_class AS c JOIN pg_namespace AS n ON c.relnamespace=n.oid WHERE n.nspname='topology' AND c.relname='topology' )" );
++    if ( result.PQntuples() >= 1 && result.PQgetvalue(0, 0) == "t" )
+     {
+       mTopologyAvailable = true;
+     }
diff -Nru qgis-2.0.1/debian/patches/mis-detection-of-PostGIS-table-type.patch qgis-2.0.1/debian/patches/mis-detection-of-PostGIS-table-type.patch
--- qgis-2.0.1/debian/patches/mis-detection-of-PostGIS-table-type.patch	1970-01-01 01:00:00.000000000 +0100
+++ qgis-2.0.1/debian/patches/mis-detection-of-PostGIS-table-type.patch	2014-02-09 12:51:07.000000000 +0100
@@ -0,0 +1,67 @@
+From: Sandro Santilli <strk at keybit.net>
+Subject: Backport fix for mis-detection of PostGIS table types
+Origin: https://github.com/qgis/QGIS/commit/b90fb29ed2d25b9d988044c8dbb74e3a3f212ba5
+Bug: http://hub.qgis.org/issues/9421
+
+Don't try to detect geometry type or srid, if it's already known
+Backport of eaf5725f569fab62a67a51c0b0bddbb6a44797a2 by Jef
+
+--- a/src/providers/postgres/qgspostgresconn.cpp
++++ b/src/providers/postgres/qgspostgresconn.cpp
+@@ -1118,21 +1118,41 @@ void QgsPostgresConn::retrieveLayerTypes
+       table += QString( " WHERE %1" ).arg( layerProperty.sql );
+     }
+ 
+-    QString query = QString( "SELECT DISTINCT"
+-                             " CASE"
+-                             " WHEN %1 THEN 'POINT'"
+-                             " WHEN %2 THEN 'LINESTRING'"
+-                             " WHEN %3 THEN 'POLYGON'"
+-                             " END,"
+-                             " %4(%5%6)"
+-                             " FROM %7" )
+-                    .arg( postgisTypeFilter( layerProperty.geometryColName, QGis::WKBPoint, layerProperty.geometryColType == sctGeography ) )
+-                    .arg( postgisTypeFilter( layerProperty.geometryColName, QGis::WKBLineString, layerProperty.geometryColType == sctGeography ) )
+-                    .arg( postgisTypeFilter( layerProperty.geometryColName, QGis::WKBPolygon, layerProperty.geometryColType == sctGeography ) )
+-                    .arg( majorVersion() < 2 ? "srid" : "st_srid" )
+-                    .arg( quotedIdentifier( layerProperty.geometryColName ) )
+-                    .arg( layerProperty.geometryColType == sctGeography ? "::geometry" : "" )
+-                    .arg( table );
++    QString query = "SELECT DISTINCT ";
++
++    QGis::WkbType type = layerProperty.types.value( 0, QGis::WKBUnknown );
++    if ( type == QGis::WKBUnknown )
++    {
++      query += QString( "CASE"
++                        " WHEN %1 THEN 'POINT'"
++                        " WHEN %2 THEN 'LINESTRING'"
++                        " WHEN %3 THEN 'POLYGON'"
++                        " END" )
++               .arg( postgisTypeFilter( layerProperty.geometryColName, QGis::WKBPoint, layerProperty.geometryColType == sctGeography ) )
++               .arg( postgisTypeFilter( layerProperty.geometryColName, QGis::WKBLineString, layerProperty.geometryColType == sctGeography ) )
++               .arg( postgisTypeFilter( layerProperty.geometryColName, QGis::WKBPolygon, layerProperty.geometryColType == sctGeography ) );
++    }
++    else
++    {
++      query += quotedValue( QgsPostgresConn::postgisWkbTypeName( type ) );
++    }
++
++    query += ",";
++
++    int srid = layerProperty.srids.value( 0, INT_MIN );
++    if ( srid  == INT_MIN )
++    {
++      query += QString( "%1(%2%3)" )
++               .arg( majorVersion() < 2 ? "srid" : "st_srid" )
++               .arg( quotedIdentifier( layerProperty.geometryColName ) )
++               .arg( layerProperty.geometryColType == sctGeography ? "::geometry" : "" );
++    }
++    else
++    {
++      query += QString::number( srid );
++    }
++
++    query += " FROM " + table;
+ 
+     QgsDebugMsg( "Retrieving geometry types: " + query );
+ 
diff -Nru qgis-2.0.1/debian/patches/postgres-provider-topology-support.patch qgis-2.0.1/debian/patches/postgres-provider-topology-support.patch
--- qgis-2.0.1/debian/patches/postgres-provider-topology-support.patch	1970-01-01 01:00:00.000000000 +0100
+++ qgis-2.0.1/debian/patches/postgres-provider-topology-support.patch	2014-02-09 12:51:07.000000000 +0100
@@ -0,0 +1,15 @@
+From: "Juergen E. Fischer" <jef at norbit.de>
+Subject: postgres provider: don't look for topology layers without topology support
+Origin: https://github.com/qgis/QGIS/commit/673406d271fbc54071c3cc8835fb1279e4ebe719
+Bug: http://hub.qgis.org/issues/9453
+--- a/src/providers/postgres/qgspostgresconn.cpp
++++ b/src/providers/postgres/qgspostgresconn.cpp
+@@ -307,7 +307,7 @@ bool QgsPostgresConn::getTableInfo( bool
+ 
+   mLayersSupported.clear();
+ 
+-  for ( int i = 0; i < 3; i++ )
++  for ( int i = 0; i < (hasTopology() ? 3 : 2); i++ )
+   {
+     QString sql, tableName, schemaName, columnName, typeName, sridName, gtableName;
+     QgsPostgresGeometryColumnType columnType = sctGeometry;
diff -Nru qgis-2.0.1/debian/patches/qgis_arm.patch qgis-2.0.1/debian/patches/qgis_arm.patch
--- qgis-2.0.1/debian/patches/qgis_arm.patch	2014-01-17 23:07:11.000000000 +0100
+++ qgis-2.0.1/debian/patches/qgis_arm.patch	2014-02-08 05:29:03.000000000 +0100
@@ -1,7 +1,10 @@
 Description: On armel/armhf qreal is typedef'ed to float not double.
+ This patch adds qreal versions of some functions on arm. It was originally 
+ writen by Konstantinos Margaritis and later fixed by Peter Michael Green
 Author: Konstantinos Margaritis <konstantinos.margaritis at freevec.org>
+Author: Peter Michael Green <plugwash at debian.org>
 Bug-Debian: http://bugs.debian.org/691333
-Last-Update: 2014-01-17
+Last-Update: 2014-02-06
 --- a/src/core/qgscoordinatetransform.h
 +++ b/src/core/qgscoordinatetransform.h
 @@ -154,6 +154,9 @@ class CORE_EXPORT QgsCoordinateTransform
@@ -35,8 +38,8 @@
 +#ifdef QT_ARCH_ARM
 +void QgsMapToPixel::transformInPlace( qreal& x, qreal& y ) const
 +{
-+  double xd = (double) x, yd = (double) y;
-+  transformInPlace(xd, yd);
++  x = ( x - xMin ) / mMapUnitsPerPixel;
++  y = yMax - ( y - yMin ) / mMapUnitsPerPixel;
 +}
 +#endif
 +
@@ -50,7 +53,7 @@
 +
 --- a/src/core/qgscoordinatetransform.cpp
 +++ b/src/core/qgscoordinatetransform.cpp
-@@ -416,6 +416,15 @@ void QgsCoordinateTransform::transformIn
+@@ -388,6 +388,17 @@ void QgsCoordinateTransform::transformIn
    }
  }
  
@@ -60,9 +63,11 @@
 +{
 +  double xd = (double) x, yd = (double) y;
 +  transformInPlace(xd, yd, z, direction);
++  x=xd;
++  y=yd;
 +}
 +#endif
 +
- void QgsCoordinateTransform::transformInPlace(
-   QVector<float>& x, QVector<float>& y, QVector<float>& z,
-   TransformDirection direction ) const
+ #ifdef ANDROID
+ void QgsCoordinateTransform::transformInPlace( float& x, float& y, float& z,
+     TransformDirection direction ) const
diff -Nru qgis-2.0.1/debian/patches/series qgis-2.0.1/debian/patches/series
--- qgis-2.0.1/debian/patches/series	2014-01-18 02:46:45.000000000 +0100
+++ qgis-2.0.1/debian/patches/series	2014-02-09 12:51:08.000000000 +0100
@@ -26,3 +26,8 @@
 python-env.patch
 wms-c-don-t-crash-if-tile-matrix-set-isn-t-available.patch
 use-local-icon.patch
+fix-qreal-vs-double.patch
+mis-detection-of-PostGIS-table-type.patch
+postgres-provider-topology-support.patch
+fix-query-to-detect-postgis-topology-availability.patch
+disable-features-on-arm.patch
diff -Nru qgis-2.0.1/debian/qgis-providers-common.install qgis-2.0.1/debian/qgis-providers-common.install
--- qgis-2.0.1/debian/qgis-providers-common.install	2014-01-17 23:07:11.000000000 +0100
+++ qgis-2.0.1/debian/qgis-providers-common.install	2014-02-09 12:50:10.000000000 +0100
@@ -1,6 +1,6 @@
 usr/share/qgis/svg/*
 usr/share/qgis/resources/qgis.db
-usr/share/qgis/resources/srs.db
+usr/share/qgis/resources/srs-template.db
 usr/share/qgis/resources/customization.xml
 usr/share/qgis/resources/symbology-ng-style.db
 usr/share/qgis/resources/cpt-city-qgis-min/*
diff -Nru qgis-2.0.1/debian/qgis-providers-common.postinst qgis-2.0.1/debian/qgis-providers-common.postinst
--- qgis-2.0.1/debian/qgis-providers-common.postinst	2013-09-26 23:08:55.000000000 +0200
+++ qgis-2.0.1/debian/qgis-providers-common.postinst	2014-02-09 16:03:19.000000000 +0100
@@ -2,7 +2,8 @@
 set -e
 
 if [ "$1" = "configure" ] && [ -x /usr/lib/qgis/crssync ]; then
-	/usr/lib/qgis/crssync
+	cp /usr/share/qgis/resources/srs-template.db /usr/share/qgis/resources/srs.db
+	dpkg-trigger qgis-crssync
 fi
 
 #DEBHELPER#
diff -Nru qgis-2.0.1/debian/qgis-providers-common.prerm qgis-2.0.1/debian/qgis-providers-common.prerm
--- qgis-2.0.1/debian/qgis-providers-common.prerm	1970-01-01 01:00:00.000000000 +0100
+++ qgis-2.0.1/debian/qgis-providers-common.prerm	2014-02-09 12:50:10.000000000 +0100
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+if [ "$1" = "remove" ] && [ -e /usr/share/qgis/resources/srs.db ]; then
+	rm -f /usr/share/qgis/resources/srs.db || true
+fi
+
+#DEBHELPER#
diff -Nru qgis-2.0.1/debian/qgis-providers.postinst qgis-2.0.1/debian/qgis-providers.postinst
--- qgis-2.0.1/debian/qgis-providers.postinst	1970-01-01 01:00:00.000000000 +0100
+++ qgis-2.0.1/debian/qgis-providers.postinst	2014-02-09 16:28:43.000000000 +0100
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -e
+
+if [ "$1" = "triggered" ]; then
+    for trigger in $2; do
+        case "$trigger" in
+            "qgis-crssync")
+                if [ -w /usr/share/qgis/resources/srs.db ] && [ -x /usr/lib/qgis/crssync ]; then
+                        /usr/lib/qgis/crssync
+                fi
+            ;;
+        esac
+    done
+
+    exit 0
+fi
+
+#DEBHELPER#
diff -Nru qgis-2.0.1/debian/qgis-providers.triggers qgis-2.0.1/debian/qgis-providers.triggers
--- qgis-2.0.1/debian/qgis-providers.triggers	1970-01-01 01:00:00.000000000 +0100
+++ qgis-2.0.1/debian/qgis-providers.triggers	2014-02-09 16:28:59.000000000 +0100
@@ -0,0 +1 @@
+interest qgis-crssync
diff -Nru qgis-2.0.1/debian/rules qgis-2.0.1/debian/rules
--- qgis-2.0.1/debian/rules	2014-01-18 03:32:05.000000000 +0100
+++ qgis-2.0.1/debian/rules	2014-02-09 12:51:07.000000000 +0100
@@ -83,7 +83,7 @@
 endif
 
 %:
-	dh $@ --with python2,pkgkde_symbolshelper
+	dh $@ --with python2,pkgkde_symbolshelper --parallel
 
 override_dh_clean:
 	dh_clean
@@ -119,6 +119,9 @@
 	$(RM) -f $(CURDIR)/debian/tmp/usr/man/man1/qgis.1
 	$(RM) -f $(CURDIR)/debian/tmp/usr/man/man1/qbrowser.1
 
+	# Don't ship srs.db, automatically updated in postinst with crssync
+	mv $(CURDIR)/debian/tmp/usr/share/qgis/resources/srs.db $(CURDIR)/debian/tmp/usr/share/qgis/resources/srs-template.db
+
 	# Install menu pixmap
 	install -o root -g root -d $(CURDIR)/debian/tmp/usr/share/pixmaps
 	install -o root -g root -m 644 $(CURDIR)/images/icons/qgis_icon.svg $(CURDIR)/debian/tmp/usr/share/pixmaps/qgis.svg


More information about the Pkg-grass-devel mailing list