Merge lp:~sergiusens/phablet-tools/click-buddy into lp:phablet-tools

Proposed by Sergio Schvezov
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 236
Merged at revision: 233
Proposed branch: lp:~sergiusens/phablet-tools/click-buddy
Merge into: lp:phablet-tools
Diff against target: 166 lines (+140/-0)
3 files modified
click-buddy (+138/-0)
debian/control (+1/-0)
setup.py (+1/-0)
To merge this branch: bzr merge lp:~sergiusens/phablet-tools/click-buddy
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+202178@code.launchpad.net

Commit message

Tool to make it easier to build and test clicks

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

Adding no-clean option and CMAKE_PARAMS

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Worked for me!

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

129 + adb $ADBOPTS shell mkdir -p /home/phablet/autopilot
130 + adb $ADBOPTS push $SOURCE/tests/autopilot /home/phablet/autopilot
131 + adb $ADBOPTS shell chown -R "$DEVICE_USER":"$DEVICE_USER" /home/phablet/autopilot

You have the username in a var already, use it to build the home dir path.

review: Needs Fixing
235. By Sergio Schvezov

Removing phablet and using DEVICE_USER

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
236. By Sergio Schvezov

Adding click dep

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Good, tested, worked as expected.

Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'click-buddy'
2--- click-buddy 1970-01-01 00:00:00 +0000
3+++ click-buddy 2014-01-20 19:19:19 +0000
4@@ -0,0 +1,138 @@
5+#!/bin/sh
6+# This program is free software: you can redistribute it and/or modify it
7+# under the terms of the the GNU General Public License version 3, as
8+# published by the Free Software Foundation.
9+#
10+# This program is distributed in the hope that it will be useful, but
11+# WITHOUT ANY WARRANTY; without even the implied warranties of
12+# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
13+# PURPOSE. See the applicable version of the GNU General Public
14+# License for more details.
15+#.
16+# You should have received a copy of the GNU General Public License
17+# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+#
19+# Copyright (C) 2014 Canonical, Ltd.
20+#
21+# Author: Sergio Schvezov <sergio.schvezov@canonical.com>
22+
23+export LC_ALL=C
24+
25+usage() {
26+cat <<EOF
27+usage: $0 [OPTIONS]
28+
29+Creates and runs click apps
30+
31+OPTIONS:
32+ -h Show this message
33+ -s Specify the serial of the device to install (see adb $ADBOPTS devices)
34+
35+ --bzr-source bzr sources used to backreference the package
36+ --dir directory holding the package to build
37+ --provision Install resulting click and run tests
38+ --no-clean Don't clean temporary directories
39+EOF
40+}
41+
42+ADBOPTS=""
43+PROVISION=""
44+SOURCE=""
45+BZR_SOURCE=""
46+NO_CLEAN=""
47+
48+TEST_DIR='tests/autopilot'
49+DEVICE_USER='phablet'
50+
51+ARGS=$(getopt -o s:h -l "bzr-source:,provision,no-clean,dir:,help" -n "$0" -- "$@")
52+
53+if [ $? -ne 0 ] ; then
54+ exit 1
55+fi
56+eval set -- "$ARGS"
57+
58+while true; do
59+ case "$1" in
60+ -h|--help)
61+ usage
62+ exit 0
63+ ;;
64+ -s)
65+ shift;
66+ ADBOPTS="-s $1"
67+ shift;
68+ ;;
69+ --provision)
70+ shift;
71+ PROVISION=1
72+ ;;
73+ --bzr-source)
74+ shift
75+ BZR_SOURCE="$1"
76+ shift
77+ ;;
78+ --dir)
79+ shift
80+ SOURCE="$(readlink -f $1)"
81+ shift
82+ ;;
83+ --no-clean)
84+ shift
85+ NO_CLEAN=1
86+ ;;
87+ --)
88+ shift;
89+ break;
90+ ;;
91+ esac
92+done
93+
94+builddir=$(mktemp -d)
95+installdir=$(mktemp -d)
96+if [ -z "$NO_CLEAN" ]; then
97+ trap 'rm -rf "$builddir" "$installdir"' EXIT
98+fi
99+
100+if [ ! -f $SOURCE/CMakeLists.txt ]; then
101+ echo "$SOURCE not a valid source dir"
102+ usage
103+ exit 1
104+fi
105+
106+workdir=$(pwd)
107+cd $builddir
108+
109+CMAKE_PARAMS="-DINSTALL_TESTS=off -DCLICK_MODE=on \
110+ -DBZR_REVNO=$(cd $SOURCE; bzr revno)"
111+
112+if [ -n "$BZR_SOURCE" ]; then
113+ CMAKE_PARAMS="$CMAKE_PARAMS -DBZR_SOURCE=$BZR_SOURCE"
114+fi
115+
116+cmake "$SOURCE" $CMAKE_PARAMS
117+
118+make DESTDIR=$installdir install
119+click build $installdir
120+cp *.click $workdir
121+
122+if [ -n "$PROVISION" ]; then
123+ set -e
124+ for click in *.click; do
125+ adb $ADBOPTS push "$click" /tmp
126+ adb $ADBOPTS shell sudo -u $DEVICE_USER bash -ic "pkcon install-local /tmp/$click"
127+ done
128+
129+ adb $ADBOPTS shell mkdir -p /home/$DEVICE_USER/autopilot
130+ adb $ADBOPTS push $SOURCE/tests/autopilot /home/$DEVICE_USER/autopilot
131+ adb $ADBOPTS shell chown -R "$DEVICE_USER":"$DEVICE_USER" /home/$DEVICE_USER/autopilot
132+ set +e
133+
134+ echo Allowing autopilot to play well with apparmor
135+ phablet-config autopilot --dbus-probe enable
136+ echo "Ready to run autopilot"
137+fi
138+
139+if [ -n "$NO_CLEAN" ]; then
140+ echo build dir was $builddir
141+ echo install dir was $installdir
142+fi
143
144=== modified file 'debian/control'
145--- debian/control 2013-12-12 23:45:16 +0000
146+++ debian/control 2014-01-20 19:19:19 +0000
147@@ -29,6 +29,7 @@
148 android-tools-adb (>= 4.2.2),
149 android-tools-fastboot (>= 4.2.2),
150 bzr,
151+ click,
152 curl,
153 dpkg-dev,
154 python-configobj,
155
156=== modified file 'setup.py'
157--- setup.py 2013-11-09 11:04:28 +0000
158+++ setup.py 2014-01-20 19:19:19 +0000
159@@ -16,6 +16,7 @@
160 'phablet-network',
161 'phablet-screenshot',
162 'phablet-test-run',
163+ 'click-buddy',
164 ]
165
166 if __name__ == "__main__":

Subscribers

People subscribed via source and target branches