From cc17e22c1f16326f5893f3e03c5c4c59b8256c71 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Sat, 3 Nov 2018 00:45:40 +0100 Subject: [PATCH] Fix build with namespaced SIP; fix grass detection; fix grass script shebangs; fix Requires --- qgis-2.18.20-grass.patch | 57 +++++++++++++++++++++++++++++++++ qgis-2.18.20-sip.patch | 69 ++++++++++++++++++++++++++++++++++++++++ qgis.spec | 41 ++++++++++++++++-------- 3 files changed, 154 insertions(+), 13 deletions(-) create mode 100644 qgis-2.18.20-grass.patch create mode 100644 qgis-2.18.20-sip.patch diff --git a/qgis-2.18.20-grass.patch b/qgis-2.18.20-grass.patch new file mode 100644 index 0000000..4b2d96f --- /dev/null +++ b/qgis-2.18.20-grass.patch @@ -0,0 +1,57 @@ +diff -rupN qgis-2.18.20/cmake/FindGRASS.cmake qgis-2.18.20-new/cmake/FindGRASS.cmake +--- qgis-2.18.20/cmake/FindGRASS.cmake 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/cmake/FindGRASS.cmake 2018-11-02 12:01:30.000000000 +0100 +@@ -28,7 +28,7 @@ MACRO (CHECK_GRASS G_PREFIX) + #MESSAGE(STATUS "GRASS_MAJOR_VERSION${GRASS_FIND_VERSION} = ${GRASS_MAJOR_VERSION${GRASS_FIND_VERSION}}") + IF(GRASS_MAJOR_VERSION${GRASS_FIND_VERSION} EQUAL GRASS_FIND_VERSION) + SET(GRASS_LIBRARIES_FOUND${GRASS_FIND_VERSION} TRUE) +- SET(GRASS_LIB_NAMES${GRASS_FIND_VERSION} gis dig2 dbmiclient dbmibase shape dgl rtree datetime linkm gproj) ++ SET(GRASS_LIB_NAMES${GRASS_FIND_VERSION} gis dbmiclient dbmibase shape dgl rtree datetime linkm gproj) + IF(GRASS_MAJOR_VERSION${GRASS_FIND_VERSION} LESS 7 ) + LIST(APPEND GRASS_LIB_NAMES${GRASS_FIND_VERSION} vect) + LIST(APPEND GRASS_LIB_NAMES${GRASS_FIND_VERSION} form) +diff -rupN qgis-2.18.20/src/plugins/grass/scripts/db.connect-login.pg.py qgis-2.18.20-new/src/plugins/grass/scripts/db.connect-login.pg.py +--- qgis-2.18.20/src/plugins/grass/scripts/db.connect-login.pg.py 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/src/plugins/grass/scripts/db.connect-login.pg.py 2018-11-02 13:24:02.276460662 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python2 + # -*- coding: utf-8 -*- + + """ +diff -rupN qgis-2.18.20/src/plugins/grass/scripts/qgis.v.kernel.rast.py qgis-2.18.20-new/src/plugins/grass/scripts/qgis.v.kernel.rast.py +--- qgis-2.18.20/src/plugins/grass/scripts/qgis.v.kernel.rast.py 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/src/plugins/grass/scripts/qgis.v.kernel.rast.py 2018-11-02 13:24:00.489411796 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python2 + # -*- coding: utf-8 -*- + + """ +diff -rupN qgis-2.18.20/src/plugins/grass/scripts/qgis.v.upgrade.py qgis-2.18.20-new/src/plugins/grass/scripts/qgis.v.upgrade.py +--- qgis-2.18.20/src/plugins/grass/scripts/qgis.v.upgrade.py 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/src/plugins/grass/scripts/qgis.v.upgrade.py 2018-11-02 13:23:58.663361863 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python2 + # -*- coding: utf-8 -*- + + """ +diff -rupN qgis-2.18.20/src/plugins/grass/scripts/r.external.all.py qgis-2.18.20-new/src/plugins/grass/scripts/r.external.all.py +--- qgis-2.18.20/src/plugins/grass/scripts/r.external.all.py 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/src/plugins/grass/scripts/r.external.all.py 2018-11-02 13:23:56.175293827 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python2 + # -*- coding: utf-8 -*- + + """ +diff -rupN qgis-2.18.20/src/plugins/grass/scripts/v.out.ogr.pg.py qgis-2.18.20-new/src/plugins/grass/scripts/v.out.ogr.pg.py +--- qgis-2.18.20/src/plugins/grass/scripts/v.out.ogr.pg.py 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/src/plugins/grass/scripts/v.out.ogr.pg.py 2018-11-02 13:23:54.063236074 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python2 + # -*- coding: utf-8 -*- + + """ diff --git a/qgis-2.18.20-sip.patch b/qgis-2.18.20-sip.patch new file mode 100644 index 0000000..72c819b --- /dev/null +++ b/qgis-2.18.20-sip.patch @@ -0,0 +1,69 @@ +diff -rupN qgis-2.18.20/cmake/FindSIP.cmake qgis-2.18.20-new/cmake/FindSIP.cmake +--- qgis-2.18.20/cmake/FindSIP.cmake 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/cmake/FindSIP.cmake 2018-11-01 23:42:52.907619884 +0100 +@@ -41,7 +41,7 @@ ELSE(SIP_VERSION) + STRING(REGEX REPLACE ".*\nsip_bin:([^\n]+).*$" "\\1" SIP_BINARY_PATH ${sip_config}) + STRING(REGEX REPLACE ".*\ndefault_sip_dir:([^\n]+).*$" "\\1" SIP_DEFAULT_SIP_DIR ${sip_config}) + STRING(REGEX REPLACE ".*\nsip_inc_dir:([^\n]+).*$" "\\1" SIP_INCLUDE_DIR ${sip_config}) +- STRING(REGEX REPLACE ".*\nsip_mod_dir:([^\n]+).*$" "\\1" SIP_MOD_DIR ${sip_config}) ++ STRING(REGEX REPLACE ".*\nsip_module_dir:([^\n]+).*$" "\\1" SIP_MOD_DIR ${sip_config}) + SET(SIP_FOUND TRUE) + ENDIF(sip_config) + +diff -rupN qgis-2.18.20/cmake/FindSIP.py qgis-2.18.20-new/cmake/FindSIP.py +--- qgis-2.18.20/cmake/FindSIP.py 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/cmake/FindSIP.py 2018-11-01 23:56:35.778989661 +0100 +@@ -39,4 +39,4 @@ print("sip_version_str:%s" % sipcfg.sip_ + print("sip_bin:%s" % sipcfg.sip_bin) + print("default_sip_dir:%s" % sipcfg.default_sip_dir) + print("sip_inc_dir:%s" % sipcfg.sip_inc_dir) +-print("sip_mod_dir:%s" % sipcfg.sip_mod_dir) ++print("sip_module_dir:%s" % sipcfg.sip_module_dir) +diff -rupN qgis-2.18.20/python/PyQt/PyQt4/QtCore.py qgis-2.18.20-new/python/PyQt/PyQt4/QtCore.py +--- qgis-2.18.20/python/PyQt/PyQt4/QtCore.py 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/python/PyQt/PyQt4/QtCore.py 2018-11-01 22:07:20.597278848 +0100 +@@ -23,7 +23,7 @@ __copyright__ = '(C) 2015, Matthias Kuhn + # This will get replaced with a git SHA1 when you do a git archive + __revision__ = '$Format:%H$' + +-import sip ++import PyQt4.sip as sip + for api in ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]: + sip.setapi(api, 2) + +diff -rupN qgis-2.18.20/python/PyQt/PyQt4/uic/pyuic.py qgis-2.18.20-new/python/PyQt/PyQt4/uic/pyuic.py +--- qgis-2.18.20/python/PyQt/PyQt4/uic/pyuic.py 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/python/PyQt/PyQt4/uic/pyuic.py 2018-11-01 22:07:15.417251277 +0100 +@@ -24,7 +24,7 @@ __copyright__ = '(C) 2016, Jürgen E. Fi + __revision__ = '$Format:%H$' + + +-import sip ++import PyQt4.sip as sip + for api in ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]: + sip.setapi(api, 2) + +diff -rupN qgis-2.18.20/src/python/qgspythonutilsimpl.cpp qgis-2.18.20-new/src/python/qgspythonutilsimpl.cpp +--- qgis-2.18.20/src/python/qgspythonutilsimpl.cpp 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/src/python/qgspythonutilsimpl.cpp 2018-11-01 22:07:08.002211865 +0100 +@@ -122,7 +122,7 @@ bool QgsPythonUtilsImpl::checkSystemImpo + runString( "sys.path = [" + newpaths.join( "," ) + "] + sys.path" ); + + // import SIP +- if ( !runString( "import sip", ++ if ( !runString( "import PyQt4.sip as sip", + QObject::tr( "Couldn't load SIP module." ) + '\n' + QObject::tr( "Python support will be disabled." ) ) ) + { + return false; +diff -rupN qgis-2.18.20/tests/src/python/test_qgsmaplayerregistry.py qgis-2.18.20-new/tests/src/python/test_qgsmaplayerregistry.py +--- qgis-2.18.20/tests/src/python/test_qgsmaplayerregistry.py 2018-05-18 14:01:08.000000000 +0200 ++++ qgis-2.18.20-new/tests/src/python/test_qgsmaplayerregistry.py 2018-11-01 22:06:59.632167456 +0100 +@@ -15,7 +15,7 @@ __revision__ = '$Format:%H$' + from qgis.core import QgsMapLayerRegistry, QgsVectorLayer, QgsMapLayer + from qgis.testing import start_app, unittest + from qgis.PyQt.QtCore import QT_VERSION_STR +-import sip ++import PyQt4.sip as sip + + try: + from qgis.PyQt.QtTest import QSignalSpy diff --git a/qgis.spec b/qgis.spec index badf4e4..1ff81b9 100644 --- a/qgis.spec +++ b/qgis.spec @@ -16,7 +16,7 @@ Name: qgis Version: 2.18.20 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A user friendly Open Source Geographic Information System # http://hub.qgis.org/issues/3789 @@ -38,6 +38,12 @@ Source5: %{name}-mime.xml # https://hub.qgis.org/issues/15602 Patch0: %{name}-lib64.patch +# Fix sip import for namespaced sip +Patch1: %{name}-2.18.20-sip.patch + +# Fix grass not found, fix grass scripts shebangs +Patch2: %{name}-2.18.20-grass.patch + # Some plug-ins need Pyspatialite (bundled) # The license is not totally clear, see: # http://code.google.com/p/pyspatialite/issues/detail?id=3 @@ -77,8 +83,8 @@ BuildRequires: qca2-devel BuildRequires: qextserialport-devel BuildRequires: qjson-devel BuildRequires: qscintilla-devel -BuildRequires: qscintilla-python -BuildRequires: qscintilla-python2-devel +BuildRequires: python2-qscintilla +BuildRequires: python2-qscintilla-devel BuildRequires: qt4-devel #BuildRequires: qt-mobility-devel BuildRequires: qt4-webkit-devel @@ -149,17 +155,17 @@ Provides: %{name}-python%{?_isa} = %{version}-%{release} Obsoletes: %{name}-python < %{version}-%{release} Summary: Python integration and plug-ins for QGIS Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: gdal-python +Requires: python2-gdal Requires: PyQt4-webkit -Requires: python-httplib2 -Requires: python-jinja2 -Requires: python-matplotlib -Requires: python-OWSLib -Requires: python-psycopg2 -Requires: python-pygments -Requires: python-six -Requires: PyYAML -Requires: qscintilla-python +Requires: python2-httplib2 +Requires: python2-jinja2 +Requires: python2-matplotlib +Requires: python2-owslib +Requires: python2-psycopg2 +Requires: python2-pygments +Requires: python2-six +Requires: python2-pyyaml +Requires: python2-qscintilla %{?_sip_api:Requires: sip-api(%{_sip_api_major}) >= %{_sip_api}} %description -n python2-qgis @@ -183,6 +189,8 @@ Please refer to %{name}-server-README.fedora for details! %prep %setup -q %patch0 -p1 -b .lib64 +%patch1 -p1 -b .sip +%patch2 -p1 -b .grass # Remove executable permissions from source code files find . \( -name "*.cpp" -o -name "*.h" \) -type f -perm /111 -execdir chmod -x {} \+ @@ -236,6 +244,7 @@ gzip ChangeLog -D WITH_PYSPATIALITE:BOOL=FALSE \ -D WITH_SERVER:BOOL=TRUE \ -D WITH_TOUCH:BOOL=TRUE \ + -D WITH_INTERNAL_FUTURE=FALSE \ %{configure_with_spatialite} \ . #-D WITH_QTMOBILITY:BOOL=TRUE \ @@ -408,6 +417,12 @@ update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || : %changelog +* Sat Nov 03 2018 Sandro Mani - 2.18.20-3 +- Fix broken requires +- Fix build with namespaced SIP +- Fix grass detection +- Fix grass script shebangs + * Sat Jul 14 2018 Fedora Release Engineering - 2.18.20-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild