Merge lp:~dbarth/qtcreator-plugin-ubuntu/download_prebuilt_cordova_runtime into lp:qtcreator-plugin-ubuntu

Proposed by David Barth
Status: Merged
Approved by: Alexandre Abreu
Approved revision: 84
Merged at revision: 87
Proposed branch: lp:~dbarth/qtcreator-plugin-ubuntu/download_prebuilt_cordova_runtime
Merge into: lp:qtcreator-plugin-ubuntu
Diff against target: 125 lines (+102/-0)
3 files modified
debian/changelog (+6/-0)
share/qtcreator/ubuntu/menu.json (+7/-0)
share/qtcreator/ubuntu/scripts/local_get_cordova_runtime (+89/-0)
To merge this branch: bzr merge lp:~dbarth/qtcreator-plugin-ubuntu/download_prebuilt_cordova_runtime
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Alexandre Abreu (community) Approve
Zoltan Balogh Approve
Review via email: mp+205436@code.launchpad.net

Commit message

tool to download a pre-compiled cordova runtime

Description of the change

tool to download a pre-compiled cordova runtime

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

Would it be possible to use different name for the script?

For example instead of download_prebuilt_cordova_runtime the local_get_cordova_runtime. Whatever short name what tells that it is not a device script.

Revision history for this message
David Barth (dbarth) wrote :

Le 09/02/2014 14:15, Zoltan Balogh a écrit :
> Would it be possible to use different name for the script?
>
> For example instead of download_prebuilt_cordova_runtime the local_get_cordova_runtime. Whatever short name what tells that it is not a device script.
Updated as per your recommendation.

Revision history for this message
Zoltan Balogh (bzoltan) wrote :

It is safe to land

review: Approve
82. By David Barth

renamed script to local_get_cordova_runtime

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
83. By David Barth

adjust the script to point to the new runtime location in the deb packages

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

- I'd make sure that you fail gracefully when phony ARCH2 & ARCH3 are provided
NOTE: - just for the sake of it, quite a bit of the package/apt output manipulation can be factored out but that's fine,
NOTE: - CordovaUbuntu.?.? -> it should be fine, but is pretty restrictive in the kind of scheme that can be pulled and there is not clear error message when something else is found,
- L86: why dont you just wipe out ${CORDOVA_CACHE}/lib/${ARCH3 all together?

Revision history for this message
David Barth (dbarth) wrote :

ok, so put on hold for now.

84. By David Barth

argument checking

Revision history for this message
David Barth (dbarth) wrote :

> - I'd make sure that you fail gracefully when phony ARCH2 & ARCH3 are provided

updated with some argument checking.

> NOTE: - just for the sake of it, quite a bit of the package/apt output
> manipulation can be factored out but that's fine,
> NOTE: - CordovaUbuntu.?.? -> it should be fine, but is pretty restrictive in
> the kind of scheme that can be pulled and there is not clear error message
> when something else is found,

this needs to be kept in sync with the runtime package indeed

> - L86: why dont you just wipe out ${CORDOVA_CACHE}/lib/${ARCH3 all together?

otherwise i would remove the very .so file i'm trying to preserve! :)

Revision history for this message
Alexandre Abreu (abreu-alexandre) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

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 2013-12-19 16:36:14 +0000
3+++ debian/changelog 2014-02-12 15:25:19 +0000
4@@ -1,3 +1,9 @@
5+qtcreator-plugin-ubuntu (2.8.1.1~campo~saucy) saucy; urgency=low
6+
7+ * Saucy test package
8+
9+ -- David Barth <david.barth@canonical.com> Wed, 12 Feb 2014 11:28:43 +0100
10+
11 qtcreator-plugin-ubuntu (2.8.1.1-0ubuntu1) trusty; urgency=low
12
13 [ Timo Jyrinki ]
14
15=== modified file 'share/qtcreator/ubuntu/menu.json'
16--- share/qtcreator/ubuntu/menu.json 2014-02-10 14:15:34 +0000
17+++ share/qtcreator/ubuntu/menu.json 2014-02-12 15:25:19 +0000
18@@ -289,6 +289,13 @@
19 ]
20 },
21 {
22+ "name": "Download pre-built Cordova runtime",
23+ "id": "Ubuntu.Menu.DownloadCordovaRuntime",
24+ "actions": [
25+ "%SCRIPTDIRECTORY%/local_get_cordova_runtime"
26+ ]
27+ },
28+ {
29 "name": "GPG",
30 "id": "Ubuntu.Menu.gpg",
31 "submenu": [
32
33=== added file 'share/qtcreator/ubuntu/scripts/local_get_cordova_runtime'
34--- share/qtcreator/ubuntu/scripts/local_get_cordova_runtime 1970-01-01 00:00:00 +0000
35+++ share/qtcreator/ubuntu/scripts/local_get_cordova_runtime 2014-02-12 15:25:19 +0000
36@@ -0,0 +1,89 @@
37+#!/bin/bash
38+# Copyright 2013 Canonical Ltd.
39+#
40+# This program is free software; you can redistribute it and/or modify
41+# it under the terms of the GNU Lesser General Public License as published by
42+# the Free Software Foundation; version 2.1.
43+#
44+# This program is distributed in the hope that it will be useful,
45+# but WITHOUT ANY WARRANTY; without even the implied warranty of
46+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47+# GNU Lesser General Public License for more details.
48+#
49+# You should have received a copy of the GNU Lesser General Public License
50+# along with this program. If not, see <http://www.gnu.org/licenses/>.
51+#
52+# Author: David Barth <david.barth@canonical.com>
53+
54+SCRIPTPATH=`dirname $0`
55+PROJECTPATH=$1
56+
57+if [[ -z ${PROJECTPATH} ]]; then
58+ PROJECTPATH=`pwd`
59+fi
60+
61+CORDOVA_PACKAGE="cordova-ubuntu-3.4-dev"
62+PAYLOAD_DIR="/usr/share/cordova-ubuntu-3.4/"
63+CORDOVA_CACHE=${HOME}/.cache/cordova
64+
65+download_arch () {
66+ ARCH2=$1
67+ ARCH3=$2
68+
69+ [ -z "$ARCH2" -o -z "$ARCH3" ] && exit "download_arch"
70+
71+ ARCH=`apt-config dump | grep "APT::Architecture " | cut -d\" -f2`
72+ URI=`apt-get download --print-uris ${CORDOVA_PACKAGE} | grep ^\' | cut -d\' -f2`
73+ PACKAGE_FILENAME=`apt-get download --print-uris ${CORDOVA_PACKAGE} | grep ^\' | cut -d\ -f2 | sed "s/_${ARCH}.deb$/_${ARCH2}.deb/"`
74+
75+ mkdir -p ${CORDOVA_CACHE}/lib/${ARCH3}
76+
77+ (
78+ cd /tmp
79+ wget `echo $URI | sed "s/_${ARCH}.deb$/_${ARCH2}.deb/"`
80+
81+ dpkg-deb -x ${PACKAGE_FILENAME} ${CORDOVA_CACHE}/lib/${ARCH3}
82+
83+ rm -f ${PACKAGE_FILENAME}
84+ )
85+}
86+
87+install_arch () {
88+ ARCH3=$1
89+
90+ [ -z "$ARCH3" ] && exit "install_arch"
91+
92+ mv ${CORDOVA_CACHE}/lib/${ARCH3}/${PAYLOAD_DIR}/* ${CORDOVA_CACHE}/lib/${ARCH3}
93+
94+ for f in `find ${CORDOVA_CACHE}/lib/${ARCH3} | grep .so$`
95+ do
96+ mv ${f} ${CORDOVA_CACHE}/lib/${ARCH3}
97+ done
98+
99+ cp -Rf ${CORDOVA_CACHE}/lib/${ARCH3}/CordovaUbuntu.?.? ${CORDOVA_CACHE}
100+ cp -Rf ${CORDOVA_CACHE}/lib/${ARCH3}/www/* ${CORDOVA_CACHE}/CordovaUbuntu.?.?
101+ cp -Rf ${CORDOVA_CACHE}/lib/${ARCH3}/qml/* ${CORDOVA_CACHE}/CordovaUbuntu.?.?
102+
103+ rm -rf ${CORDOVA_CACHE}/lib/${ARCH3}/${PAYLOAD_DIR}
104+ rm -rf ${CORDOVA_CACHE}/lib/${ARCH3}/usr
105+ rm -rf ${CORDOVA_CACHE}/lib/${ARCH3}/www
106+ rm -rf ${CORDOVA_CACHE}/lib/${ARCH3}/qml
107+ rm -rf ${CORDOVA_CACHE}/lib/${ARCH3}/CordovaUbuntu.?.?
108+}
109+
110+
111+echo
112+echo "Trying to download a pre-built Cordova runtime to accelerate project creation..."
113+echo
114+
115+rm -rf ${CORDOVA_CACHE}
116+
117+download_arch "i386" "i386-linux-gnu"
118+download_arch "amd64" "x86_64-linux-gnu"
119+download_arch "armhf" "arm-linux-gnueabihf"
120+
121+install_arch "i386-linux-gnu"
122+install_arch "x86_64-linux-gnu"
123+install_arch "arm-linux-gnueabihf"
124+
125+find ${CORDOVA_CACHE}

Subscribers

People subscribed via source and target branches

to all changes: