Merge lp:~timo-jyrinki/kubuntu-packaging/qtchooser_qmlscene_fallback into lp:~kubuntu-packagers/kubuntu-packaging/qtchooser

Proposed by Timo Jyrinki
Status: Merged
Merged at revision: 17
Proposed branch: lp:~timo-jyrinki/kubuntu-packaging/qtchooser_qmlscene_fallback
Merge into: lp:~kubuntu-packagers/kubuntu-packaging/qtchooser
Diff against target: 312 lines (+152/-120)
6 files modified
debian/changelog (+7/-0)
debian/control (+2/-1)
debian/patches/Implement-fallback-mechanism.patch (+142/-0)
debian/patches/create-a-system-default-path.patch (+0/-41)
debian/patches/series (+1/-0)
debian/qtchooser.1 (+0/-78)
To merge this branch: bzr merge lp:~timo-jyrinki/kubuntu-packaging/qtchooser_qmlscene_fallback
Reviewer Review Type Date Requested Status
Kubuntu Packagers Pending
Review via email: mp+230595@code.launchpad.net

Commit message

* Add a proposed patch from upstream:
  - Implement-fallback-mechanism.patch

Description of the change

RFC, an updated upstream proposed patch not yet accepted by upstream.

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

on Ubuntu 14.10.

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

To post a comment you must log in.
Revision history for this message
Scott Kitterman (kitterman) wrote :

Why was it not accepted upstream?

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

I guess it can be interpreted as disagreeing on the development tools definition. Qtchooser is used to manage development tools, which includes everything but the Qt Creator according to the upstream. But Ubuntu uses qmlscene for normal users, and Kubuntu qdbus, without any other developer software installed, so there rises this subtle conflict.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

I think we should whitelist qdbus and all tools that didn't exist in Qt 4 (like qml or qtpaths). For the latter category, I think even upstream will agree to do that.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Whitelisting a bit more sounds like a good way to go, let's see what upstream has to say about that. It should a more safe approach to the problem compared to the blacklisting, so maybe upstream would accept it.

I haven't received more urgent pushing on the issue now, so we can probably wait a bit. But I believe we'd need this one way or another, since the issue seems to come up also for users on IRC every now and then. People just use their Qt:s in various ways and end up with various configurations where the tools don't anymore behave like they would assume.

19. By Timo Jyrinki

New proposal to upstream

20. By Timo Jyrinki

One line adjustment to compile against our older qtchooser version.

Revision history for this message
Scott Kitterman (kitterman) wrote :

Let's see what upstream says before uploading this.

Revision history for this message
Harald Sitter (apachelogger) wrote :

FWIW, waiting for upstream can be problematic because the qdbus thing causes issues with plasma startup in various forms and fashions depending on which packages are installed (or not)

Revision history for this message
Sebastien Bacher (seb128) wrote :

The ppa package resolves the issue and make qmlscene works out of the box in an unity8 session with qt5 examples

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Despite pinging on the upstream codereview and directly on IRC, there's no update. The difference with qtchooser to normal Qt project repositories is that there's essentially only one reviewer.

I'd like to upload this as a distro patch to Ubuntu for utopic release to have a solution for the Unity8 desktop session. It can be reverted if needed, but it should be safe and actually prevent problems compared to people installing qt5-default/qt4-default.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Now uploaded and in queue, after discussions on #kubuntu-devel with apachelogger and mitya57.

21. By Timo Jyrinki

Remove two non-used files that should have been removed during the import.

22. By Timo Jyrinki

Release ubuntu1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-08-13 08:41:01 +0000
3+++ debian/changelog 2014-10-07 06:42:00 +0000
4@@ -1,3 +1,10 @@
5+qtchooser (39-g4717841-3ubuntu1) utopic; urgency=medium
6+
7+ * Add a proposed patch from upstream:
8+ - Implement-fallback-mechanism.patch (LP: #1295835)
9+
10+ -- Timo Jyrinki <timo-jyrinki@ubuntu.com> Mon, 06 Oct 2014 16:39:42 +0300
11+
12 qtchooser (39-g4717841-3) unstable; urgency=medium
13
14 * Add a patch from Daniel Schepler to allow easier bootstraping of qtchooser
15
16=== modified file 'debian/control'
17--- debian/control 2014-08-13 08:41:01 +0000
18+++ debian/control 2014-10-07 06:42:00 +0000
19@@ -1,7 +1,8 @@
20 Source: qtchooser
21 Section: libdevel
22 Priority: optional
23-Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
24+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
25+XSBC-Original-Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
26 Uploaders: Timo Jyrinki <timo@debian.org>,
27 Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
28 Build-Depends: debhelper (>= 9), libqt4-dev
29
30=== added file 'debian/patches/Implement-fallback-mechanism.patch'
31--- debian/patches/Implement-fallback-mechanism.patch 1970-01-01 00:00:00 +0000
32+++ debian/patches/Implement-fallback-mechanism.patch 2014-10-07 06:42:00 +0000
33@@ -0,0 +1,142 @@
34+From bd72414b48571b294e43dec06298308a2cfa7da9 Mon Sep 17 00:00:00 2001
35+From: Dmitry Shachnev <mitya57@gmail.com>
36+Date: Fri, 4 Apr 2014 13:53:15 +0400
37+Subject: [PATCH] Implement fallback mechanism for some tools
38+
39+If a tool was requested without specifying the Sdk name, and the
40+default Sdk does not have that tool, fall back to any installed
41+Sdk that contains that tool.
42+
43+Currently this is enabled only for qdbus, qmlscene, and for tools
44+that are new in Qt 5.
45+
46+Change-Id: I19a82a06c75fe9cd624aa51b086d72e75310ba35
47+---
48+ src/qtchooser/main.cpp | 58 +++++++++++++++++++++++++++++++++++++++++++-------
49+ 1 file changed, 50 insertions(+), 8 deletions(-)
50+
51+diff --git a/src/qtchooser/main.cpp b/src/qtchooser/main.cpp
52+index 5e6e9cb..314b089 100644
53+--- a/src/qtchooser/main.cpp
54++++ b/src/qtchooser/main.cpp
55+@@ -65,10 +65,12 @@
56+ #if defined(_WIN32) || defined(__WIN32__)
57+ # include <process.h>
58+ # define execv _execv
59++# define stat _stat
60+ # define PATH_SEP "\\"
61+ # define EXE_SUFFIX ".exe"
62+ #else
63+ # include <sys/types.h>
64++# include <sys/stat.h>
65+ # include <dirent.h>
66+ # include <libgen.h>
67+ # include <pwd.h>
68+@@ -111,8 +112,21 @@ struct Sdk
69+ string librariesPath;
70+
71+ bool isValid() const { return !toolsPath.empty(); }
72++ bool hasTool(const string &targetTool) const;
73+ };
74+
75++bool Sdk::hasTool(const string &targetTool) const {
76++ struct stat st;
77++ if (toolsPath.empty())
78++ return false;
79++ if (stat((toolsPath + PATH_SEP + targetTool).c_str(), &st))
80++ return false;
81++#ifdef S_IEXEC
82++ return (st.st_mode & S_IEXEC);
83++#endif
84++ return true;
85++}
86++
87+ struct ToolWrapper
88+ {
89+ int printHelp();
90+@@ -126,8 +140,9 @@ private:
91+
92+ typedef bool (*VisitFunction)(const string &targetSdk, Sdk &item);
93+ typedef void (*FinishFunction)(const set<string> &seenSdks);
94+- Sdk iterateSdks(const string &targetSdk, VisitFunction visit, FinishFunction finish = 0);
95+- Sdk selectSdk(const string &targetSdk);
96++ Sdk iterateSdks(const string &targetSdk, VisitFunction visit, FinishFunction finish = 0,
97++ const string &targetTool = "");
98++ Sdk selectSdk(const string &targetSdk, const string &targetTool = "");
99+
100+ static void printSdks(const set<string> &seenNames);
101+ static bool matchSdk(const string &targetSdk, Sdk &sdk);
102+@@ -266,7 +281,7 @@ static bool mkparentdir(string name)
103+
104+ int ToolWrapper::runTool(const string &targetSdk, const string &targetTool, char **argv)
105+ {
106+- Sdk sdk = selectSdk(targetSdk);
107++ Sdk sdk = selectSdk(targetSdk, targetTool);
108+ if (!sdk.isValid())
109+ return 1;
110+
111+@@ -454,7 +469,8 @@ vector<string> ToolWrapper::searchPaths() const
112+ return paths;
113+ }
114+
115+-Sdk ToolWrapper::iterateSdks(const string &targetSdk, VisitFunction visit, FinishFunction finish)
116++Sdk ToolWrapper::iterateSdks(const string &targetSdk, VisitFunction visit, FinishFunction finish,
117++ const string &targetTool)
118+ {
119+ vector<string> paths = searchPaths();
120+ set<string> seenNames;
121+@@ -483,11 +499,20 @@ Sdk ToolWrapper::iterateSdks(const string &targetSdk, VisitFunction visit, Finis
122+ continue;
123+
124+ seenNames.insert(d->d_name);
125+- sdk.name = d->d_name;
126+- sdk.name.resize(fnamelen + 1 - sizeof confSuffix);
127++ if (targetTool.empty()) {
128++ sdk.name = d->d_name;
129++ sdk.name.resize(fnamelen + 1 - sizeof confSuffix);
130++ } else {
131++ // To make the check in matchSdk() succeed
132++ sdk.name = "default";
133++ }
134+ sdk.configFile = path + PATH_SEP + d->d_name;
135+- if (visit && visit(targetSdk, sdk))
136++ if (visit && visit(targetSdk, sdk)) {
137++ // If a tool was requested, but not found here, skip this sdk
138++ if (!targetTool.empty() && !sdk.hasTool(targetTool))
139++ continue;
140+ return sdk;
141++ }
142+ }
143+
144+ closedir(dir);
145+@@ -499,9 +524,26 @@ Sdk ToolWrapper::iterateSdks(const string &targetSdk, VisitFunction visit, Finis
146+ return Sdk();
147+ }
148+
149+-Sdk ToolWrapper::selectSdk(const string &targetSdk)
150++// All tools that exist for only one Qt version should be
151++// here. Other tools in this list are qdbus and qmlscene.
152++bool fallbackAllowed(const string &tool)
153+ {
154++ return tool == "qdbus" ||
155++ tool == "qml" ||
156++ tool == "qmlimportscanner" ||
157++ tool == "qmlscene" ||
158++ tool == "qtdiag" ||
159++ tool == "qtpaths";
160++}
161++
162++Sdk ToolWrapper::selectSdk(const string &targetSdk, const string &targetTool)
163++{
164++ // first, try the default Sdk
165+ Sdk matchedSdk = iterateSdks(targetSdk, &ToolWrapper::matchSdk);
166++ if (targetSdk.empty() && !matchedSdk.hasTool(targetTool) && fallbackAllowed(targetTool)) {
167++ // if a tool was requested, fall back to any Sdk that has it
168++ matchedSdk = iterateSdks(string(), &ToolWrapper::matchSdk, 0, targetTool);
169++ }
170+ if (!matchedSdk.isValid()) {
171+ fprintf(stderr, "%s: could not find a Qt installation of '%s'\n", argv0, targetSdk.c_str());
172+ }
173+--
174+2.1.0
175+
176
177=== removed file 'debian/patches/create-a-system-default-path.patch'
178--- debian/patches/create-a-system-default-path.patch 2013-03-20 14:03:30 +0000
179+++ debian/patches/create-a-system-default-path.patch 1970-01-01 00:00:00 +0000
180@@ -1,41 +0,0 @@
181---- a/src/qtchooser/Makefile
182-+++ b/src/qtchooser/Makefile
183-@@ -17,6 +17,10 @@ TARGET = qtchooser
184- OBJECTS_TEST = main-test.o
185- TARGET_TEST = test/qtchooser
186-
187-+ifneq ($(QTCHOOSER_GLOBAL_DIR),)
188-+ QTCHOOSER_GLOBAL_DIR_VAR:=-DQTCHOOSER_GLOBAL_DIR=\"$(QTCHOOSER_GLOBAL_DIR)\"
189-+endif
190-+
191- first: all
192- check: $(TARGET_TEST)
193-
194-@@ -49,10 +53,10 @@ uninstall:
195- ####### Compile
196-
197- main.o: main.cpp
198-- $(CXX) -c -Wall -Wextra $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
199-+ $(CXX) -c -Wall -Wextra $(QTCHOOSER_GLOBAL_DIR_VAR) $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
200-
201- main-test.o: main.cpp
202-- $(CXX) -c -Wall -Wextra -DQTCHOOSER_TEST_MODE -g $(CXXFLAGS) $(INCPATH) -o main-test.o main.cpp
203-+ $(CXX) -c -Wall -Wextra -DQTCHOOSER_TEST_MODE $(QTCHOOSER_GLOBAL_DIR_VAR) -g $(CXXFLAGS) $(INCPATH) -o main-test.o main.cpp
204-
205- ####### Install
206-
207---- a/src/qtchooser/main.cpp
208-+++ b/src/qtchooser/main.cpp
209-@@ -265,6 +265,12 @@ vector<string> ToolWrapper::searchPaths(
210- // search the XDG config location directories
211- paths = stringSplit(qgetenv("XDG_CONFIG_DIRS", "/etc/xdg").c_str());
212-
213-+#if defined(QTCHOOSER_GLOBAL_DIR)
214-+ // Add QTCHOOSER_GLOBAL_DIR at the beginning.
215-+ vector<string> globalDir = stringSplit(QTCHOOSER_GLOBAL_DIR);
216-+ paths.insert(paths.begin(), globalDir.begin(), globalDir.end());
217-+#endif
218-+
219- string localDir = qgetenv("XDG_CONFIG_HOME", userHome() + PATH_SEP ".config");
220- paths.push_back(localDir);
221-
222
223=== modified file 'debian/patches/series'
224--- debian/patches/series 2014-08-13 08:41:01 +0000
225+++ debian/patches/series 2014-10-07 06:42:00 +0000
226@@ -1,2 +1,3 @@
227 enable-tests.patch
228 Add-qmlimportscanner-qtpaths.patch
229+Implement-fallback-mechanism.patch
230
231=== removed file 'debian/qtchooser.1'
232--- debian/qtchooser.1 2013-02-06 12:00:59 +0000
233+++ debian/qtchooser.1 1970-01-01 00:00:00 +0000
234@@ -1,78 +0,0 @@
235-.TH QTCHOOSER 1 "JANUARY 2, 2013"
236-.\" Please adjust this date whenever revising the manpage.
237-.SH NAME
238-qtchooser \- a wrapper used to select between Qt development binary versions
239-.SH SYNOPSIS
240-.B qtchooser
241-\fB\-list\-versions\fR
242-.br
243-.B qtchooser
244-\fB\-print\-env\fR [\fB\-qt=\fIversion\fR]
245-.br
246-.B qtchooser
247-\fB\-run\-tool=\fItool\fR [\fB\-qt=\fIversion\fR] [\fIprogram_arguments\fR]
248-.br
249-.B <executable_name>
250-[\fB\-qt=\fIversion\fR] [\fIprogram_arguments\fR]
251-.br
252-.SH DESCRIPTION
253-Qt is a cross-platform C++ application framework. Qt's primary feature
254-is its rich set of widgets that provide standard GUI functionality.
255-
256-The Qt Chooser provides a wrapper to switch between versions of Qt
257-development binaries when multiple versions like 4 and 5 are installed
258-or local Qt builds are to be used.
259-
260-It is commonly used via a symlink from an \fIexecutable_name\fR like qmake.
261-.SH OPTIONS
262-The options which apply to the
263-\fBqtchooser\fR
264-command are:
265-.PP
266-\fB\-list\-versions\fR
267-.RS 4
268-Lists available Qt versions from the configuration files
269-.RE
270-.PP
271-\fB\-print\-env\fR
272-.RS 4
273-Prints environment information
274-.RE
275-.PP
276-\fB\-qt=\fIversion\fR
277-.RS 4
278-Selects \fIversion\fR as the Qt version to be used
279-.RE
280-.PP
281-\fB\-run\-tool=\fItool\fR
282-.RS 4
283-Runs the selected \fItool\fR.
284-.RE
285-.SH ENVIRONMENT
286-.TP
287-.B QT_SELECT
288-Same as \fB\-qt=\fIversion\fR. If set, the selected configuration is used and binaries
289-symlinked to qtchooser will be executed without additional paramenters.
290-.RE
291-.TP
292-.B XDG_CONFIG_HOME
293-.TP
294-.B XDG_CONFIG_DIRS
295-Used as specified in
296-<\fBhttp://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html\fR>
297-.SH FILES
298-.TP
299-.I /etc/xdg/qtchooser/*.conf
300-System-wide configuration files. Each has two lines, the first is the path
301-to the binaries and the second is the path to the Qt libraries. If a
302-\fIdefault.conf\fR is provided, the settings from it will be automatically
303-used in case nothing else is selected.
304-.TP
305-.I \fB$HOME\fP/.config/qtchooser/*.conf
306-User configuration files.
307-
308-.SH AUTHOR
309-qtchooser was written by Thiago Macieira from Intel.
310-.PP
311-This manual page was written by Timo Jyrinki <timo@debian.org>,
312-for the Debian project (but may be used by others).

Subscribers

People subscribed via source and target branches