2011-09-27 18:18:06 +02:00
|
|
|
From: Yury G. Kudryashov <urkud.urkud@gmail.com>
|
|
|
|
Subject: [PATCH] Find virtuoso if virtuoso-t is in PATH
|
|
|
|
|
|
|
|
---
|
|
|
|
backends/virtuoso/virtuosobackend.cpp | 31 ++++++++++++++++++++++---------
|
|
|
|
backends/virtuoso/virtuosobackend.h | 2 +-
|
|
|
|
2 files changed, 23 insertions(+), 10 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/backends/virtuoso/virtuosobackend.cpp b/backends/virtuoso/virtuosobackend.cpp
|
2012-06-09 15:09:24 +02:00
|
|
|
index c245101..249958a 100644
|
2011-09-27 18:18:06 +02:00
|
|
|
--- a/backends/virtuoso/virtuosobackend.cpp
|
|
|
|
+++ b/backends/virtuoso/virtuosobackend.cpp
|
2012-06-09 15:09:24 +02:00
|
|
|
@@ -28,6 +28,7 @@
|
2011-09-27 18:18:06 +02:00
|
|
|
#include "odbcconnectionpool.h"
|
|
|
|
|
|
|
|
#include "sopranodirs.h"
|
|
|
|
+#include "soprano-config.h"
|
|
|
|
|
|
|
|
#include <QtCore/QDebug>
|
|
|
|
#include <QtCore/QtPlugin>
|
2012-06-09 15:09:24 +02:00
|
|
|
@@ -210,19 +211,19 @@ Soprano::BackendFeatures Soprano::Virtuoso::BackendPlugin::supportedFeatures() c
|
2011-09-27 18:18:06 +02:00
|
|
|
|
|
|
|
bool Soprano::Virtuoso::BackendPlugin::isAvailable() const
|
|
|
|
{
|
|
|
|
-#ifndef Q_OS_WIN
|
|
|
|
- if ( findVirtuosoDriver().isEmpty() ) {
|
|
|
|
- qDebug() << Q_FUNC_INFO << "could not find Virtuoso ODBC driver";
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
-
|
2012-06-09 15:09:24 +02:00
|
|
|
QString virtuosoBin = locateVirtuosoBinary();
|
2011-09-27 18:18:06 +02:00
|
|
|
if ( virtuosoBin.isEmpty() ) {
|
|
|
|
qDebug() << Q_FUNC_INFO << "could not find virtuoso-t binary";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef Q_OS_WIN
|
2012-06-09 15:09:24 +02:00
|
|
|
+ if ( findVirtuosoDriver( virtuosoBin ).isEmpty() ) {
|
2011-09-27 18:18:06 +02:00
|
|
|
+ qDebug() << Q_FUNC_INFO << "could not find Virtuoso ODBC driver";
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
QString vs = determineVirtuosoVersion( virtuosoBin );
|
|
|
|
if ( vs.isEmpty() ) {
|
|
|
|
qDebug() << Q_FUNC_INFO << "Failed to determine version of the Virtuoso server at" << virtuosoBin;
|
2012-06-09 15:09:24 +02:00
|
|
|
@@ -267,9 +268,21 @@ QString Soprano::Virtuoso::BackendPlugin::locateVirtuosoBinary()
|
2011-09-27 18:18:06 +02:00
|
|
|
|
|
|
|
#ifndef Q_OS_WIN
|
2012-06-09 15:09:24 +02:00
|
|
|
// static
|
|
|
|
-QString Soprano::Virtuoso::BackendPlugin::findVirtuosoDriver()
|
|
|
|
+QString Soprano::Virtuoso::BackendPlugin::findVirtuosoDriver( const QString &virtuosoBinHint )
|
2011-09-27 18:18:06 +02:00
|
|
|
{
|
|
|
|
- return Soprano::findLibraryPath( "virtodbc_r", QStringList(), QStringList() << QLatin1String( "virtuoso/plugins/" ) << QLatin1String( "odbc/" ) );
|
|
|
|
+ QString virtuosoBin;
|
|
|
|
+ if (virtuosoBinHint.isEmpty())
|
2012-06-09 15:09:24 +02:00
|
|
|
+ virtuosoBin = locateVirtuosoBinary();
|
2011-09-27 18:18:06 +02:00
|
|
|
+ else
|
|
|
|
+ virtuosoBin = virtuosoBinHint;
|
|
|
|
+
|
|
|
|
+ QDir virtuosoBinDir = QFileInfo(virtuosoBin).absoluteDir();
|
|
|
|
+ return Soprano::findLibraryPath( "virtodbc_r",
|
|
|
|
+ QStringList()
|
|
|
|
+ << virtuosoBinDir.absoluteFilePath("../lib"SOPRANO_LIB_SUFFIX)
|
|
|
|
+ << virtuosoBinDir.absoluteFilePath("../lib"),
|
|
|
|
+ QStringList() << QLatin1String( "virtuoso/plugins/" ) <<
|
|
|
|
+ QLatin1String( "odbc/" ) );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
diff --git a/backends/virtuoso/virtuosobackend.h b/backends/virtuoso/virtuosobackend.h
|
2012-06-09 15:09:24 +02:00
|
|
|
index 646b9f8..535fbb9 100644
|
2011-09-27 18:18:06 +02:00
|
|
|
--- a/backends/virtuoso/virtuosobackend.h
|
|
|
|
+++ b/backends/virtuoso/virtuosobackend.h
|
2012-06-09 15:09:24 +02:00
|
|
|
@@ -52,7 +52,7 @@ namespace Soprano {
|
2011-09-27 18:18:06 +02:00
|
|
|
|
|
|
|
#ifndef Q_OS_WIN
|
|
|
|
private:
|
2012-06-09 15:09:24 +02:00
|
|
|
- static QString findVirtuosoDriver();
|
|
|
|
+ static QString findVirtuosoDriver(const QString &virtuosoBinHint = QString());
|
2011-09-27 18:18:06 +02:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
}
|
|
|
|
--
|
2012-06-09 15:09:24 +02:00
|
|
|
tg: (2321148..) t/find-virtuoso (depends on: master)
|