[SCM] qtcreator packaging branch, master, updated. debian/3.2.1+dfsg-3-4-gf6fa040

Lisandro Damián Nicanor Pérez lisandro at moszumanska.debian.org
Tue Oct 21 18:40:13 UTC 2014


Gitweb-URL: http://git.debian.org/?p=pkg-kde/qt/qtcreator.git;a=commitdiff;h=f6fa040

The following commit has been merged in the master branch:
commit f6fa040e3253b01c1702738df53b51054529d5f6
Author: Lisandro Damián Nicanor Pérez Meyer <perezmeyer at gmail.com>
Date:   Tue Oct 21 15:39:46 2014 -0300

    Add patch to detect Qt available versions.
---
 debian/changelog                                  |   2 +
 debian/patches/qt_versions_trough_qtchooser.patch | 256 ++++++++++++++++++++++
 debian/patches/series                             |   1 +
 3 files changed, 259 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index f4769a3..7651480 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ qtcreator (3.2.1+dfsg-4) UNRELEASED; urgency=medium
 
   [ Lisandro Damián Nicanor Pérez Meyer ]
   * Refresh from_header_to_body.diff.
+  * Add qt_versions_trough_qtchooser.patch to detect available Qt versions
+    using qtchooser.
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Sat, 04 Oct 2014 10:40:52 -0300
 
diff --git a/debian/patches/qt_versions_trough_qtchooser.patch b/debian/patches/qt_versions_trough_qtchooser.patch
new file mode 100644
index 0000000..1c9286d
--- /dev/null
+++ b/debian/patches/qt_versions_trough_qtchooser.patch
@@ -0,0 +1,256 @@
+commit f5ef9451c30b1b3c9c6f7b314148af22e34d606e
+Author: Sune Vuorela <sune at vuorela.dk>
+Date:   Thu Oct 16 13:52:28 2014 +0200
+ 
+    Gather Qt versions from qtchooser on first run
+   
+    Change-Id: I33ae062c3225fb3d7b7d1a62e0e287d326bb4276
+ 
+diff --git a/src/plugins/qtsupport/qtchooserqtgatherer.cpp b/src/plugins/qtsupport/qtchooserqtgatherer.cpp
+new file mode 100644
+index 0000000..cecc4f2
+--- /dev/null
++++ b/src/plugins/qtsupport/qtchooserqtgatherer.cpp
+@@ -0,0 +1,117 @@
++/****************************************************************************
++ * *
++ ** Copyright (C) 2014 Sune Vuorela <sune at kde.org>
++ ** Contact: http://www.qt-project.org/
++ **
++ ** This file is part of Qt Creator
++ **
++ ** $QT_BEGIN_LICENSE:BSD$
++ ** You may use this file under the terms of the BSD license as follows:
++ **
++ ** "Redistribution and use in source and binary forms, with or without
++ ** modification, are permitted provided that the following conditions are
++ ** met:
++ **   * Redistributions of source code must retain the above copyright
++ **     notice, this list of conditions and the following disclaimer.
++ **   * Redistributions in binary form must reproduce the above copyright
++ **     notice, this list of conditions and the following disclaimer in
++ **     the documentation and/or other materials provided with the
++ **     distribution.
++ **   * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
++ **     of its contributors may be used to endorse or promote products derived
++ **     from this software without specific prior written permission.
++ **
++ **
++ ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++ ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++ ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++ ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
++ ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++ ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
++ ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
++ **
++ ** $QT_END_LICENSE$
++ **
++ ****************************************************************************/
++
++#include "qtchooserqtgatherer.h"
++#include <QStandardPaths>
++#include <QProcess>
++#include <QSet>
++
++namespace QtSupport {
++namespace Internal {
++
++/**
++ * @brief extractPath extracts the path component from the QTTOOLDIR line in the qtchooser -print-env output
++ * @param data QTTOOLDIR line in qtchooser output
++ * @return path extracted
++ */
++static QString extractPath(const QByteArray &data)
++{
++    QByteArray data2 = data.left(data.length() - 1); // remove end apostrophe
++    QByteArray data3 = data2.right(data2.length() - 11); // remove QTTOOLDIR="
++    return QString::fromLocal8Bit(data3);
++}
++
++/**
++ * @brief runQtChooser executes qtchooser in a process and returns it's output
++ * @param qtchooser path to qtchooser
++ * @param args arguments passed to qtchooser
++ * @return output of the qtchooser command as a list of bytearrays.
++ */
++static QList<QByteArray> runQtChooser(const QString &qtchooser, const QStringList &args)
++{
++    QProcess p;
++    p.start(qtchooser,args);
++    bool success = p.waitForFinished();
++    if (!success)
++        return QList<QByteArray>();
++
++    QByteArray outputString = p.readAllStandardOutput();
++    QList<QByteArray> outputs = outputString.split('
');
++    return outputs;
++}
++
++/**
++ * @brief qmakePath asks qtchooser for the qmake path of a given version
++ * @param qtchooser path to qtchooser
++ * @param version the version according to qtchooser output
++ * @return
++ */
++static QString qmakePath(const QString &qtchooser, const QString &version)
++{
++    QList<QByteArray> outputs = runQtChooser(qtchooser, QStringList()
++                                             << QStringLiteral("-qt=%1").arg(version)
++                                             << QStringLiteral("-print-env"));
++    foreach (const QByteArray &output, outputs) {
++        if (output.startsWith("QTTOOLDIR=\""))
++            return QStandardPaths::findExecutable(QStringLiteral("qmake"), QStringList()
++                                                  << extractPath(output));
++    }
++    return QString();
++}
++
++QStringList gatherQmakePathsFromQtChooser()
++{
++    const QString qtchooser = QStandardPaths::findExecutable(QStringLiteral("qtchooser"));
++    if (qtchooser.isNull())
++        return QList<QString>();
++
++    QList<QByteArray> versions = runQtChooser(qtchooser, QStringList()
++                                              << QStringLiteral("-l"));
++
++    QSet<QString> foundQMakes;
++    foreach (const QByteArray &version, versions) {
++        QString possibleQMake = qmakePath(qtchooser, QString::fromLocal8Bit(version));
++        if (!possibleQMake.isEmpty())
++            foundQMakes << possibleQMake;
++    }
++    return QStringList(foundQMakes.toList());
++}
++} // namespace Internal
++} // namespace QtSupport
+diff --git a/src/plugins/qtsupport/qtchooserqtgatherer.h b/src/plugins/qtsupport/qtchooserqtgatherer.h
+new file mode 100644
+index 0000000..ab26602
+--- /dev/null
++++ b/src/plugins/qtsupport/qtchooserqtgatherer.h
+@@ -0,0 +1,57 @@
++/****************************************************************************
++ * *
++ ** Copyright (C) 2014 Sune Vuorela <sune at kde.org>
++ ** Contact: http://www.qt-project.org/
++ **
++ ** This file is part of Qt Creator.
++ **
++ ** $QT_BEGIN_LICENSE:BSD$
++ ** You may use this file under the terms of the BSD license as follows:
++ **
++ ** "Redistribution and use in source and binary forms, with or without
++ ** modification, are permitted provided that the following conditions are
++ ** met:
++ **   * Redistributions of source code must retain the above copyright
++ **     notice, this list of conditions and the following disclaimer.
++ **   * Redistributions in binary form must reproduce the above copyright
++ **     notice, this list of conditions and the following disclaimer in
++ **     the documentation and/or other materials provided with the
++ **     distribution.
++ **   * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
++ **     of its contributors may be used to endorse or promote products derived
++ **     from this software without specific prior written permission.
++ **
++ **
++ ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++ ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++ ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++ ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
++ ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++ ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
++ ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
++ **
++ ** $QT_END_LICENSE$
++ **
++ ****************************************************************************/
++
++
++#ifndef QTCHOOSERQTGATHERER_H
++#define QTCHOOSERQTGATHERER_H
++#include <QList>
++#include <QString>
++
++namespace QtSupport {
++namespace Internal {
++    /**
++     * @brief gatherQmakePathsFromQtChooser asks qtchooser for available qmakes
++     * @return list of paths to qmakes found with qtchooser
++     */
++    QStringList gatherQmakePathsFromQtChooser();
++} // namespace Internal
++} // namespace QtSupport
++
++#endif // QTCHOOSERQTGATHERER_H
+diff --git a/src/plugins/qtsupport/qtsupport.pro b/src/plugins/qtsupport/qtsupport.pro
+index 94c772e..bebc160 100644
+--- a/src/plugins/qtsupport/qtsupport.pro
++++ b/src/plugins/qtsupport/qtsupport.pro
+@@ -11,6 +11,7 @@ HEADERS += \
+     codegensettings.h \
+     codegensettingspage.h \
+     gettingstartedwelcomepage.h \
++    qtchooserqtgatherer.h \
+     qtsupportplugin.h \
+     qtsupport_global.h \
+     qtkitconfigwidget.h \
+@@ -43,6 +44,7 @@ SOURCES += \
+     codegensettings.cpp \
+     codegensettingspage.cpp \
+     gettingstartedwelcomepage.cpp \
++    qtchooserqtgatherer.cpp \
+     qtsupportplugin.cpp \
+     qtkitconfigwidget.cpp \
+     qtkitinformation.cpp \
+diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp
+index 59f7f34..92e8039 100644
+--- a/src/plugins/qtsupport/qtversionmanager.cpp
++++ b/src/plugins/qtsupport/qtversionmanager.cpp
+@@ -34,6 +34,7 @@
+ #include "qtversionfactory.h"
+ #include "baseqtversion.h"
+ #include "qtsupportconstants.h"
++#include "qtchooserqtgatherer.h"
+ 
+ #include <coreplugin/icore.h>
+ #include <coreplugin/helpmanager.h>
+@@ -436,14 +437,24 @@ static void saveQtVersions()
+ 
+ static void findSystemQt()
+ {
++    QList<FileName> systemQMakes;
+     FileName systemQMakePath = BuildableHelperLibrary::findSystemQt(Environment::systemEnvironment());
+-    if (systemQMakePath.isNull())
+-        return;
++    if (!systemQMakePath.isNull())
++        systemQMakes << systemQMakePath;
++
++    QStringList qmakePathsFromQtChooser = gatherQmakePathsFromQtChooser();
++    qmakePathsFromQtChooser.removeAll(systemQMakePath.toString());
++    foreach (const QString &qmakePath, qmakePathsFromQtChooser)  {
++        FileName qmake = FileName::fromString(qmakePath);
++        systemQMakes << qmake;
++    }
+ 
+-    BaseQtVersion *version = QtVersionFactory::createQtVersionFromQMakePath(systemQMakePath);
+-    if (version) {
+-        version->setUnexpandedDisplayName(BaseQtVersion::defaultUnexpandedDisplayName(systemQMakePath, true));
+-        m_versions.insert(version->uniqueId(), version);
++    foreach (const FileName &qmakePath, systemQMakes) {
++        BaseQtVersion *version = QtVersionFactory::createQtVersionFromQMakePath(qmakePath);
++        if (version) {
++            version->setUnexpandedDisplayName(BaseQtVersion::defaultUnexpandedDisplayName(qmakePath, true));
++            m_versions.insert(version->uniqueId(), version);
++        }
+     }
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 0f60dff..7faa612 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1,6 @@
 02_use_x-terminal-emulator.diff
 rpath_nonlinux.diff
+qt_versions_trough_qtchooser.patch
 
 # Debian patches.
 botan_system_lib.diff

-- 
qtcreator packaging



More information about the pkg-kde-commits mailing list