Skip to content

Commit

Permalink
Ship a seperate srs.db file for proj >= 6 builds
Browse files Browse the repository at this point in the history
It's too dangerous to reuse the existing one, as it breaks the
ability to run multiple versions of qgis (i.e. proj < 6 and proj >= 6)
on the same machine

Fixes #30569
  • Loading branch information
nyalldawson committed Jul 15, 2019
1 parent da8b574 commit 56d03f7
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions debian/qgis-providers-common.postinst
Expand Up @@ -3,6 +3,7 @@ set -e

if [ "$1" = "configure" ] && [ -x /usr/lib/qgis/crssync ]; then
cp /usr/share/qgis/resources/srs-template.db /usr/share/qgis/resources/srs.db
cp /usr/share/qgis/resources/srs6-template.db /usr/share/qgis/resources/srs6.db
dpkg-trigger qgis-crssync
fi

Expand Down
3 changes: 3 additions & 0 deletions debian/qgis-providers-common.prerm
Expand Up @@ -4,5 +4,8 @@ set -e
if [ "$1" = "remove" ] && [ -e /usr/share/qgis/resources/srs.db ]; then
rm -f /usr/share/qgis/resources/srs.db || true
fi
if [ "$1" = "remove" ] && [ -e /usr/share/qgis/resources/srs6.db ]; then
rm -f /usr/share/qgis/resources/srs6.db || true
fi

#DEBHELPER#
3 changes: 3 additions & 0 deletions debian/qgis-providers.postinst
Expand Up @@ -5,6 +5,9 @@ if [ "$1" = "triggered" ] || [ "$1" = "configure" ]; then
if [ -w /usr/share/qgis/resources/srs.db ] && [ -x /usr/lib/qgis/crssync ]; then
/usr/lib/qgis/crssync
fi
if [ -w /usr/share/qgis/resources/srs6.db ] && [ -x /usr/lib/qgis/crssync ]; then
/usr/lib/qgis/crssync
fi
fi

#DEBHELPER#
1 change: 1 addition & 0 deletions debian/rules
Expand Up @@ -300,6 +300,7 @@ override_dh_auto_install:

# 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
mv $(CURDIR)/debian/tmp/usr/share/qgis/resources/srs6.db $(CURDIR)/debian/tmp/usr/share/qgis/resources/srs6-template.db

# Mime info
install -o root -g root -d $(CURDIR)/debian/tmp/usr/share/mime/packages
Expand Down
1 change: 1 addition & 0 deletions ms-windows/osgeo4w/package.cmd
Expand Up @@ -322,6 +322,7 @@ for %%i in (%packages%) do (
"apps/%PACKAGENAME%/resources/qgis.db" ^
"apps/%PACKAGENAME%/resources/spatialite.db" ^
"apps/%PACKAGENAME%/resources/srs.db" ^
"apps/%PACKAGENAME%/resources/srs.db" ^
"apps/%PACKAGENAME%/resources/symbology-style.xml" ^
"apps/%PACKAGENAME%/resources/cpt-city-qgis-min/" ^
"apps/%PACKAGENAME%/svg/" ^
Expand Down
1 change: 1 addition & 0 deletions resources/CMakeLists.txt
@@ -1,4 +1,5 @@
INSTALL(FILES srs.db
srs6.db
qgis.db
symbology-style.xml
spatialite.db
Expand Down
Binary file added resources/srs6.db
Binary file not shown.
22 changes: 22 additions & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -955,6 +955,27 @@ QString QgsApplication::iconsPath()

QString QgsApplication::srsDatabaseFilePath()
{
#if PROJ_VERSION_MAJOR>=6
if ( ABISYM( mRunningFromBuildDir ) )
{
QString tempCopy = QDir::tempPath() + "/srs6.db";

if ( !QFile( tempCopy ).exists() )
{
QFile f( pkgDataPath() + "/resources/srs6.db" );
if ( !f.copy( tempCopy ) )
{
qFatal( "Could not create temporary copy" );
}
}

return tempCopy;
}
else
{
return pkgDataPath() + QStringLiteral( "/resources/srs6.db" );
}
#else
if ( ABISYM( mRunningFromBuildDir ) )
{
QString tempCopy = QDir::tempPath() + "/srs.db";
Expand All @@ -974,6 +995,7 @@ QString QgsApplication::srsDatabaseFilePath()
{
return pkgDataPath() + QStringLiteral( "/resources/srs.db" );
}
#endif
}

QStringList QgsApplication::svgPaths()
Expand Down

0 comments on commit 56d03f7

Please sign in to comment.