Merge lp:~cwayne18/phablet-tools/clickbuddy-with-sessions into lp:phablet-tools

Proposed by Chris Wayne on 2014-10-07
Status: Merged
Approved by: Sergio Schvezov on 2014-11-19
Approved revision: 331
Merged at revision: 360
Proposed branch: lp:~cwayne18/phablet-tools/clickbuddy-with-sessions
Merge into: lp:phablet-tools
Diff against target: 79 lines (+20/-15)
1 file modified
click-buddy (+20/-15)
To merge this branch: bzr merge lp:~cwayne18/phablet-tools/clickbuddy-with-sessions
Reviewer Review Type Date Requested Status
Colin Watson 2014-10-07 Approve on 2014-11-12
PS Jenkins bot continuous-integration Approve on 2014-11-06
Review via email: mp+237477@code.launchpad.net

Commit message

Allow click-buddy to use sessions, so we can install stuff without polluting the main chroot

Description of the change

Allow click-buddy to use sessions, so we can install stuff without polluting the main chroot

To post a comment you must log in.
330. By Chris Wayne on 2014-10-07

bzr somehow thought I removed the whole contents of click-buddy?

Colin Watson (cjwatson) wrote :

There's bad indentation throughout - it may not be visible in your editor depending on tab stop settings, but it's quite visible in the LP web UI. Could you fix that? Other than that, here's a drive-by review.

review: Needs Fixing
Francis Ginther (fginther) wrote :

I attempted to address Colin's comments and was able to get this working in my jenkins test environment before getting pulled onto other work. Here's my changes which are based on this MP:

lp:~fginther/phablet-tools/clickbuddy-with-sessions

331. By Chris Wayne on 2014-11-06

Fixes from fginther, thanks francis!

Chris Wayne (cwayne18) wrote :

Merged in fginther's branch

Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'click-buddy'
2--- click-buddy 2014-09-09 14:46:55 +0000
3+++ click-buddy 2014-11-06 14:33:50 +0000
4@@ -37,6 +37,7 @@
5 (defaults to arch all)
6 --framework Target click framework, requires a created click chroot
7 (defaults to ubuntu-sdk-13.10)
8+ --session Run in a chroot session.
9 EOF
10 }
11
12@@ -49,11 +50,13 @@
13 ARCH="all"
14 FRAMEWORK="ubuntu-sdk-13.10"
15 MAINTMODE=""
16+SESSION_NAME="click-buddy."`date +%Y%m%d`".$$"
17+SESSION_OPTS=""
18
19 TEST_DIR='tests/autopilot'
20 DEVICE_USER='phablet'
21
22-ARGS=$(getopt -o s:h -l "maint-mode,extra-deps:,bzr-source:,provision,no-clean,framework:,dir:,arch:,help" -n "$0" -- "$@")
23+ARGS=$(getopt -o s:h -l "maint-mode,extra-deps:,bzr-source:,provision,no-clean,framework:,dir:,arch:,help,session" -n "$0" -- "$@")
24
25 if [ $? -ne 0 ] ; then
26 exit 1
27@@ -108,6 +111,10 @@
28 shift
29 MAINTMODE=1
30 ;;
31+ --session)
32+ shift
33+ SESSION_OPTS="--session-name $SESSION_NAME"
34+ ;;
35 --)
36 shift
37 break
38@@ -146,29 +153,27 @@
39 cmake "$SOURCE" $CMAKE_PARAMS
40 make DESTDIR=$installdir install
41 else
42- if [ -n "$EXTRA_DEPS" ] && [ -z "$MAINTMODE" ]; then
43- echo "click chroot still doesn\'t support sessions and deps outside the"
44- echo "default sdk were requested, you can optionally use click maint"
45- echo "to install $EXTRA_DEPS by running"
46- echo " click chroot -a$ARCH -f$FRAMEWORK maint apt-get update"
47- echo " click chroot -a$ARCH -f$FRAMEWORK maint apt-get install $EXTRA_DEPS"
48- echo
49- echo "Your chroot will be unclean from then on, so if you want to"
50- echo "guarantee clean builds the chroot would need to be recreated."
51- echo
52- echo "Use the undocumented --maint-mode if you want this automated."
53+ if [ -n "$EXTRA_DEPS" ] && [ -z "$SESSION_OPTS" ]; then
54+ echo "Please either give a session name, or pass --maint-mode to install in main chroot"
55 exit 1
56 fi
57 cd "$SOURCE"
58+ if [ -n "$EXTRA_DEPS" ] && [ -n "$SESSION_OPTS" ]; then
59+ trap 'click chroot -a$ARCH -f$FRAMEWORK end-session $SESSION_NAME' \
60+ EXIT HUP INT TERM
61+ click chroot -a$ARCH -f$FRAMEWORK begin-session "$SESSION_NAME"
62+ click chroot -a$ARCH -f$FRAMEWORK maint $SESSION_OPTS apt-get update
63+ click chroot -a$ARCH -f$FRAMEWORK maint $SESSION_OPTS apt-get install --yes $EXTRA_DEPS
64+ fi
65 if [ -n "$MAINTMODE" ]; then
66 trap 'click chroot -a$ARCH -f$FRAMEWORK maint apt-get autoremove --yes $EXTRA_DEPS' \
67 EXIT HUP INT TERM
68 click chroot -a$ARCH -f$FRAMEWORK maint apt-get update
69 click chroot -a$ARCH -f$FRAMEWORK maint apt-get install --yes $EXTRA_DEPS
70 fi
71- click chroot -a$ARCH -f$FRAMEWORK run cmake $CMAKE_PARAMS
72- click chroot -a$ARCH -f$FRAMEWORK run make
73- click chroot -a$ARCH -f$FRAMEWORK run make DESTDIR=$installdir install
74+ click chroot -a$ARCH -f$FRAMEWORK run $SESSION_OPTS cmake $CMAKE_PARAMS
75+ click chroot -a$ARCH -f$FRAMEWORK run $SESSION_OPTS make
76+ click chroot -a$ARCH -f$FRAMEWORK run $SESSION_OPTS make DESTDIR=$installdir install
77 fi
78
79 if [ ! -f "$installdir/manifest.json" ]; then

Subscribers

People subscribed via source and target branches