Timo Jyrinki has proposed merging 
lp:~timo-jyrinki/kubuntu-packaging/qtchooser_qmlscene_fallback into 
lp:~kubuntu-packagers/kubuntu-packaging/qtchooser.

Commit message:
* Add a proposed patch from upstream:
  - Implement-fallback-mechanism.patch
* Modify the proposed to patch to be more restrictive by only whitelisting
  qmlscene to be handled.

Requested reviews:
  Kubuntu Packagers (kubuntu-packagers)

For more details, see:
https://code.launchpad.net/~timo-jyrinki/kubuntu-packaging/qtchooser_qmlscene_fallback/+merge/230595

RFC, a way to make a proposed patch not accepted by upstream restricted to 
qmlscene only.

Can be tested by:
sudo apt-add-repository ppa:canonical-qt5-edgers/qt5-beta1
sudo apt update
sudo apt dist-upgrade

on Ubuntu 14.10.

Upstream discussion: https://codereview.qt-project.org/#/c/82702/

Unanswered questions, feel free to answer:
- are we happy with this kind of delta to upstream, or should we try to propose 
still another iteration of the patch (see upstream discussion)?
- would Debian want this (they have not so far distro patched), would 
KDE/Kubuntu want this, and would they want it in its original form instead of 
the restricted-to-qmlscene? if not, are they ok with us doing this special 
treatment of qmlscene?
-- 
https://code.launchpad.net/~timo-jyrinki/kubuntu-packaging/qtchooser_qmlscene_fallback/+merge/230595
Your team Kubuntu Packagers is requested to review the proposed merge of 
lp:~timo-jyrinki/kubuntu-packaging/qtchooser_qmlscene_fallback into 
lp:~kubuntu-packagers/kubuntu-packaging/qtchooser.
=== modified file 'debian/changelog'
--- debian/changelog	2014-08-13 08:41:01 +0000
+++ debian/changelog	2014-08-13 09:11:23 +0000
@@ -1,3 +1,12 @@
+qtchooser (39-g4717841-3ubuntu1) UNRELEASED; urgency=medium
+
+  * Add a proposed patch from upstream:
+    - Implement-fallback-mechanism.patch
+  * Modify the proposed to patch to be more restrictive by only whitelisting 
+    qmlscene to be handled.
+
+ -- Timo Jyrinki <[email protected]>  Wed, 13 Aug 2014 11:41:37 +0300
+
 qtchooser (39-g4717841-3) unstable; urgency=medium
 
   * Add a patch from Daniel Schepler to allow easier bootstraping of qtchooser

=== modified file 'debian/control'
--- debian/control	2014-08-13 08:41:01 +0000
+++ debian/control	2014-08-13 09:11:23 +0000
@@ -1,7 +1,8 @@
 Source: qtchooser
 Section: libdevel
 Priority: optional
-Maintainer: Debian Qt/KDE Maintainers <[email protected]>
+Maintainer: Ubuntu Developers <[email protected]>
+XSBC-Original-Maintainer: Debian Qt/KDE Maintainers <[email protected]>
 Uploaders: Timo Jyrinki <[email protected]>,
            Lisandro Damián Nicanor Pérez Meyer <[email protected]>
 Build-Depends: debhelper (>= 9), libqt4-dev

=== added file 'debian/patches/Implement-fallback-mechanism.patch'
--- debian/patches/Implement-fallback-mechanism.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/Implement-fallback-mechanism.patch	2014-08-13 09:11:23 +0000
@@ -0,0 +1,145 @@
+From ba851bf59b76331dbca2541a7b188557d6abea24 Mon Sep 17 00:00:00 2001
+From: Dmitry Shachnev <[email protected]>
+Date: Fri, 4 Apr 2014 13:53:15 +0400
+Subject: [PATCH] Implement fallback mechanism
+
+If some tool was requested without specifying the Sdk name, and
+the default Sdk does not have that tool, fall back to any installed
+Sdk that contains that tool.
+
+Blacklisted tools are moc, qmake, rcc and uic.
+
+Updated 20140813/Timo Jyrinki:
+ Upstream has not accepted this patch. Make it more restrictive by only 
+ whitelisting qmlscene, instead of a blacklist. 
+
+Change-Id: I19a82a06c75fe9cd624aa51b086d72e75310ba35
+---
+ src/qtchooser/main.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 51 insertions(+), 9 deletions(-)
+
+diff --git a/src/qtchooser/main.cpp b/src/qtchooser/main.cpp
+index cf84a51..3d5f3fc 100644
+--- a/src/qtchooser/main.cpp
++++ b/src/qtchooser/main.cpp
+@@ -61,13 +61,16 @@
+ #include <string.h>
+ #include <stdlib.h>
+ 
++#include <sys/types.h>
++#include <sys/stat.h>
++
+ #if defined(_WIN32) || defined(__WIN32__)
+ #  include <process.h>
+ #  define execv _execv
++#  define stat _stat
+ #  define PATH_SEP "\\"
+ #  define EXE_SUFFIX ".exe"
+ #else
+-#  include <sys/types.h>
+ #  include <dirent.h>
+ #  include <libgen.h>
+ #  include <pwd.h>
+@@ -98,8 +101,21 @@ struct Sdk
+     string librariesPath;
+ 
+     bool isValid() const { return !toolsPath.empty(); }
++    bool hasTool(const string &targetTool) const;
+ };
+ 
++bool Sdk::hasTool(const string &targetTool) const {
++    struct stat st;
++    if (toolsPath.empty())
++        return false;
++    if (stat((toolsPath + PATH_SEP + targetTool).c_str(), &st))
++        return false;
++#ifdef S_IEXEC
++    return (st.st_mode & S_IEXEC);
++#endif
++    return true;
++}
++
+ struct ToolWrapper
+ {
+     int printHelp();
+@@ -112,8 +128,9 @@ private:
+ 
+     typedef bool (*VisitFunction)(const string &targetSdk, Sdk &item);
+     typedef void (*FinishFunction)(const set<string> &seenSdks);
+-    Sdk iterateSdks(const string &targetSdk, VisitFunction visit, FinishFunction finish = 0);
+-    Sdk selectSdk(const string &targetSdk);
++    Sdk iterateSdks(const string &targetSdk, VisitFunction visit, FinishFunction finish = 0,
++                    const string &targetTool = "");
++    Sdk selectSdk(const string &targetSdk, const string &targetTool = "");
+ 
+     static void printSdks(const set<string> &seenNames);
+     static bool matchSdk(const string &targetSdk, Sdk &sdk);
+@@ -206,7 +223,7 @@ bool linksBackToSelf(const char *link, const char *target)
+ 
+ int ToolWrapper::runTool(const string &targetSdk, const string &targetTool, char **argv)
+ {
+-    Sdk sdk = selectSdk(targetSdk);
++    Sdk sdk = selectSdk(targetSdk, targetTool);
+     if (!sdk.isValid())
+         return 1;
+ 
+@@ -295,7 +312,8 @@ vector<string> ToolWrapper::searchPaths() const
+     return paths;
+ }
+ 
+-Sdk ToolWrapper::iterateSdks(const string &targetSdk, VisitFunction visit, FinishFunction finish)
++Sdk ToolWrapper::iterateSdks(const string &targetSdk, VisitFunction visit, FinishFunction finish,
++                             const string &targetTool)
+ {
+     vector<string> paths = searchPaths();
+     set<string> seenNames;
+@@ -324,11 +342,20 @@ Sdk ToolWrapper::iterateSdks(const string &targetSdk, VisitFunction visit, Finis
+                 continue;
+ 
+             seenNames.insert(d->d_name);
+-            sdk.name = d->d_name;
+-            sdk.name.resize(fnamelen + 1 - sizeof confSuffix);
++            if (targetTool.empty()) {
++                sdk.name = d->d_name;
++                sdk.name.resize(fnamelen + 1 - sizeof confSuffix);
++            } else {
++                // To make the check in matchSdk() succeed
++                sdk.name = "default";
++            }
+             sdk.configFile = path + PATH_SEP + d->d_name;
+-            if (visit && visit(targetSdk, sdk))
++            if (visit && visit(targetSdk, sdk)) {
++                // If a tool was requested, but not found here, skip this sdk
++                if (!targetTool.empty() && !sdk.hasTool(targetTool))
++                    continue;
+                 return sdk;
++            }
+         }
+ 
+         closedir(dir);
+@@ -340,9 +367,21 @@ Sdk ToolWrapper::iterateSdks(const string &targetSdk, VisitFunction visit, Finis
+     return Sdk();
+ }
+ 
+-Sdk ToolWrapper::selectSdk(const string &targetSdk)
++// check if the tool is compatible across Qt versions
++bool isVersionCompatible(const string &tool)
+ {
++    return !tool.empty() &&
++        tool == "qmlscene";
++}
++
++Sdk ToolWrapper::selectSdk(const string &targetSdk, const string &targetTool)
++{
++    // first, try the default Sdk
+     Sdk matchedSdk = iterateSdks(targetSdk, &ToolWrapper::matchSdk);
++    if (targetSdk.empty() && !matchedSdk.hasTool(targetTool) && isVersionCompatible(targetTool)) {
++        // if a tool was requested, fall back to any Sdk that has it
++        matchedSdk = iterateSdks(string(), &ToolWrapper::matchSdk, 0, targetTool);
++    }
+     if (!matchedSdk.isValid()) {
+         fprintf(stderr, "%s: could not find a Qt installation of '%s'\n", argv0, targetSdk.c_str());
+     }
+-- 
+2.1.0.rc1
+

=== modified file 'debian/patches/series'
--- debian/patches/series	2014-08-13 08:41:01 +0000
+++ debian/patches/series	2014-08-13 09:11:23 +0000
@@ -1,2 +1,3 @@
 enable-tests.patch
 Add-qmlimportscanner-qtpaths.patch
+Implement-fallback-mechanism.patch

-- 
kubuntu-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/kubuntu-devel

Reply via email to