Merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/qmakefix into lp:~bzoltan/qtcreator-plugin-ubuntu/support_named_chroots

Proposed by Benjamin Zeller
Status: Merged
Merged at revision: 278
Proposed branch: lp:~zeller-benjamin/qtcreator-plugin-ubuntu/qmakefix
Merge into: lp:~bzoltan/qtcreator-plugin-ubuntu/support_named_chroots
Diff against target: 195 lines (+82/-8)
4 files modified
share/qtcreator/ubuntu/scripts/qtc_chroot_qmake (+9/-3)
src/ubuntu/ubuntukitmanager.cpp (+19/-3)
src/ubuntu/ubuntuqtversion.cpp (+41/-2)
src/ubuntu/ubuntuqtversion.h (+13/-0)
To merge this branch: bzr merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/qmakefix
Reviewer Review Type Date Requested Status
Zoltan Balogh Pending
Review via email: mp+236302@code.launchpad.net

Commit message

- Add versioning for UbuntuQtVersion and qmake scripts created in
~/.config/ubuntu-sdk
- Fix qtc_chroot_qmake template
- Automatically recreate QtVersions if they are obsolete

Description of the change

- Add versioning for UbuntuQtVersion and qmake scripts created in
~/.config/ubuntu-sdk
- Fix qtc_chroot_qmake template
- Automatically recreate QtVersions if they are obsolete

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'share/qtcreator/ubuntu/scripts/qtc_chroot_qmake'
2--- share/qtcreator/ubuntu/scripts/qtc_chroot_qmake 2014-07-29 07:58:30 +0000
3+++ share/qtcreator/ubuntu/scripts/qtc_chroot_qmake 2014-09-29 11:30:09 +0000
4@@ -18,6 +18,7 @@
5
6 CLICK_CHROOT_ARCH="%1"
7 CLICK_CHROOT_FW="%2"
8+CLICK_CHROOT_NAME="%3"
9
10 if [ -z "$CLICK_CHROOT_ARCH" ]; then
11 echo "Need to set CLICK_CHROOT_ARCH"
12@@ -29,6 +30,11 @@
13 exit 1
14 fi
15
16+if [ -z "$CLICK_CHROOT_NAME" ]; then
17+ echo "Need to set CLICK_CHROOT_NAME"
18+ exit 1
19+fi
20+
21 if [[ $1 != "-query" ]];
22 then
23 exit 1
24@@ -43,7 +49,7 @@
25 POSTFIX=""
26 fi
27
28-SYSROOT_PATH="/var/lib/schroot/chroots/click-${CLICK_CHROOT_FW}-${CLICK_CHROOT_ARCH}"
29+SYSROOT_PATH="/var/lib/schroot/chroots/${CLICK_CHROOT_NAME}-${CLICK_CHROOT_FW}-${CLICK_CHROOT_ARCH}"
30 QMAKE_PATH="${SYSROOT_PATH}/usr/lib/${ARCH_TRIPLET}-linux-gnu${POSTFIX}/qt5/bin/qmake"
31
32
33@@ -71,8 +77,8 @@
34 STRINGS=${STRINGS/qt_hdatpath=/QT_HOST_DATA:$SYSROOT_PATH}
35 STRINGS=${STRINGS/qt_hbinpath=/QT_HOST_BINS:$SYSROOT_PATH}
36 STRINGS=${STRINGS/qt_hlibpath=/QT_HOST_LIBS:$SYSROOT_PATH}
37-STRINGS=${STRINGS/qt_hostspec=/QMAKE_SPEC:$SYSROOT_PATH}
38-STRINGS=${STRINGS/qt_targspec=/QMAKE_XSPEC:$SYSROOT_PATH}
39+STRINGS=${STRINGS/qt_hostspec=/QMAKE_SPEC:}
40+STRINGS=${STRINGS/qt_targspec=/QMAKE_XSPEC:}
41 STRINGS=${STRINGS//# Generated by qmake (/QMAKE_VERSION:}
42 STRINGS=${STRINGS//) (Qt /$'\n'QT_VERSION:}
43 STRINGS=${STRINGS//)/}
44
45=== modified file 'src/ubuntu/ubuntukitmanager.cpp'
46--- src/ubuntu/ubuntukitmanager.cpp 2014-08-01 13:11:09 +0000
47+++ src/ubuntu/ubuntukitmanager.cpp 2014-09-29 11:30:09 +0000
48@@ -72,10 +72,11 @@
49 UbuntuQtVersion *UbuntuKitManager::createOrFindQtVersion(ClickToolChain *tc)
50 {
51
52- QString qmakePath = QStringLiteral("%1/.config/ubuntu-sdk/qmake-%2-%3")
53+ QString qmakePath = QStringLiteral("%1/.config/ubuntu-sdk/qmake-%2-%3-%4")
54 .arg(QDir::homePath())
55 .arg(tc->clickTarget().framework)
56- .arg(tc->clickTarget().architecture);
57+ .arg(tc->clickTarget().architecture)
58+ .arg(UbuntuClickTool::clickChrootSuffix());
59
60 if(!QFile::exists(qmakePath)) {
61 QFile qmakeTemplate(Constants::UBUNTU_RESOURCE_PATH+QStringLiteral("/ubuntu/scripts/qtc_chroot_qmake"));
62@@ -86,7 +87,8 @@
63
64 templ = templ
65 .arg(tc->clickTarget().architecture)
66- .arg(tc->clickTarget().framework);
67+ .arg(tc->clickTarget().framework)
68+ .arg(UbuntuClickTool::clickChrootSuffix());
69
70
71 QFile qmakeScript(qmakePath);
72@@ -185,6 +187,20 @@
73
74 void UbuntuKitManager::autoDetectKits()
75 {
76+ //destroy all obsolete QtVersions, they are recreated later on in fixKit()
77+ foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::versions()) {
78+ if (qtVersion->type() != QLatin1String(Constants::UBUNTU_QTVERSION_TYPE))
79+ continue;
80+
81+ UbuntuQtVersion* ver = static_cast<UbuntuQtVersion*> (qtVersion);
82+ if(ver->scriptVersion() < UbuntuQtVersion::minimalScriptVersion()) {
83+ //we need to remove that QtVersion
84+ QFile::remove(ver->qmakeCommand().toString());
85+ QtSupport::QtVersionManager::removeVersion(ver);
86+
87+ }
88+ }
89+
90 // having a empty toolchains list will remove all autodetected kits for android
91 // exactly what we want in that case
92 QList<ClickToolChain *> toolchains = clickToolChains();
93
94=== modified file 'src/ubuntu/ubuntuqtversion.cpp'
95--- src/ubuntu/ubuntuqtversion.cpp 2014-07-29 07:48:09 +0000
96+++ src/ubuntu/ubuntuqtversion.cpp 2014-09-29 11:30:09 +0000
97@@ -9,12 +9,23 @@
98 namespace Ubuntu {
99 namespace Internal {
100
101+const char SCRIPT_VERSION_KEY[] = "UbuntuQtVersion.ScriptVersion";
102+
103+/*!
104+ * \brief MIN_SCRIPT_VERSION
105+ * Increment this version if all qmake scripts in ~/.config/ubuntu-sdk
106+ * need to be recreated
107+ */
108+const int MIN_SCRIPT_VERSION = 1;
109+
110 UbuntuQtVersion::UbuntuQtVersion()
111- : BaseQtVersion()
112+ : BaseQtVersion(),
113+ m_scriptVersion(MIN_SCRIPT_VERSION)
114 { }
115
116 UbuntuQtVersion::UbuntuQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
117- : BaseQtVersion(path, isAutodetected, autodetectionSource)
118+ : BaseQtVersion(path, isAutodetected, autodetectionSource),
119+ m_scriptVersion(MIN_SCRIPT_VERSION)
120 {
121 setDisplayName(defaultDisplayName(qtVersionString(), path, false));
122 }
123@@ -22,6 +33,19 @@
124 UbuntuQtVersion::~UbuntuQtVersion()
125 { }
126
127+void UbuntuQtVersion::fromMap(const QVariantMap &map)
128+{
129+ BaseQtVersion::fromMap(map);
130+ m_scriptVersion = map.value(QLatin1String(SCRIPT_VERSION_KEY),0).toInt();
131+}
132+
133+QVariantMap UbuntuQtVersion::toMap() const
134+{
135+ QVariantMap map = BaseQtVersion::toMap();
136+ map.insert(QLatin1String(SCRIPT_VERSION_KEY),m_scriptVersion);
137+ return map;
138+}
139+
140 UbuntuQtVersion *UbuntuQtVersion::clone() const
141 {
142 return new UbuntuQtVersion(*this);
143@@ -51,6 +75,21 @@
144 {
145 return QLatin1String(Constants::UBUNTU_PLATFORM_NAME_TR);
146 }
147+int UbuntuQtVersion::scriptVersion() const
148+{
149+ return m_scriptVersion;
150+}
151+
152+void UbuntuQtVersion::setScriptVersion(int scriptVersion)
153+{
154+ m_scriptVersion = scriptVersion;
155+}
156+
157+int UbuntuQtVersion::minimalScriptVersion()
158+{
159+ return MIN_SCRIPT_VERSION;
160+}
161+
162
163 bool UbuntuQtVersionFactory::canRestore(const QString &type)
164 {
165
166=== modified file 'src/ubuntu/ubuntuqtversion.h'
167--- src/ubuntu/ubuntuqtversion.h 2014-07-29 07:48:09 +0000
168+++ src/ubuntu/ubuntuqtversion.h 2014-09-29 11:30:09 +0000
169@@ -13,6 +13,11 @@
170 UbuntuQtVersion();
171 UbuntuQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
172 ~UbuntuQtVersion() override;
173+
174+ // BaseQtVersion interface
175+ virtual void fromMap(const QVariantMap &map) override;
176+ virtual QVariantMap toMap() const override;
177+
178 UbuntuQtVersion *clone() const override;
179
180 QString type() const override;
181@@ -23,6 +28,14 @@
182
183 QString platformName() const override;
184 QString platformDisplayName() const override;
185+
186+ int scriptVersion() const;
187+ void setScriptVersion(int scriptVersion);
188+
189+ static int minimalScriptVersion ();
190+
191+private:
192+ int m_scriptVersion;
193 };
194
195 class UbuntuQtVersionFactory : public QtSupport::QtVersionFactory

Subscribers

People subscribed via source and target branches

to all changes: