Merge lp:~robru/phablet-tools/citrain-on-rtm into lp:phablet-tools

Proposed by Robert Bruce Park
Status: Merged
Approved by: Oliver Grawert
Approved revision: 331
Merged at revision: 321
Proposed branch: lp:~robru/phablet-tools/citrain-on-rtm
Merge into: lp:phablet-tools
Diff against target: 48 lines (+16/-7)
1 file modified
citrain (+16/-7)
To merge this branch: bzr merge lp:~robru/phablet-tools/citrain-on-rtm
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Brendan Donegan (community) Approve
Robert Bruce Park (community) Approve
Oliver Grawert Approve
Mathieu Trudel-Lapierre Pending
Review via email: mp+235069@code.launchpad.net

Commit message

Support RTM in citrain tool.

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
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Oliver Grawert (ogra) wrote :

hmm, this perl command prints nothing on a devel-proposed install ...

phablet@ubuntu-phablet:~$ system-image-cli -i
current build number: 244
device name: mako
channel: ubuntu-touch/devel-proposed
alias: ubuntu-touch/utopic-proposed
last update: 2014-09-17 09:24:18
version version: 244
version ubuntu: 20140917
version device: 20140917
version custom: mako-0.5
phablet@ubuntu-phablet:~$ system-image-cli -i | perl -lne 'm|^channel.*/(.*)/.*$| && print "$1"'
phablet@ubuntu-phablet:~$

how about instead something like:

DISTRO=""
if system-image-cli -i | grep ^channel: |grep -q rtm; then
    DISTRO="ubuntu-rtm/"
fi

phablet-config writable-image --ppa $PPA/${DISTRO}${SILO}

(also note that this phablet-config command will fail if you dont hand over the sudo password with the -r or --remotepassword options, you should add a citrain option to hand this through to the phablet-config command)

Revision history for this message
Oliver Grawert (ogra) wrote :

whoops, i just noticed you execute this remotely, in this case:

if [ -n "$(adb shell "system-image-cli -i | grep ^channel: |grep rtm")" ]; then
...

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Oliver Grawert (ogra) wrote :

looks good

review: Approve
Revision history for this message
Robert Bruce Park (robru) wrote :

This works for me on utopic images, and well, doesn't work in RTM but it Does The Right Thing and RTM should soon be fixed:

http://paste.ubuntu.com/8373889/

review: Approve
317. By Robert Bruce Park

Special case for RTM.

318. By Robert Bruce Park

Why doesn't this shit work?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
319. By Robert Bruce Park

It works!!!!

Revision history for this message
Robert Bruce Park (robru) wrote :

Ok, this is really working for real for me on RTM images, please approve.

review: Approve
320. By Robert Bruce Park

Don't hard-code utopic.

321. By Robert Bruce Park

Apparently no universe.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

First of all, thanks for this - it will make our lives a lot easier. Just a couple of queries:

1. If cjwatsons change to software-properties is landing soon, why the hack to write the .list file?
2. The logic to add a PPA was originally in phablet-config writable-image, why are we duplicating it here?
3. Won't adding the PPA without the key break other tools? You should probably fit recv-key for the ci-train-ppa-service in here if you continue with adding the .list file instead of using add-apt-repository

review: Needs Information
Revision history for this message
Robert Bruce Park (robru) wrote :

1. Cyphermox suggested that even once add-apt-repository gets fixed in rtm, it would attempt to add distro series as "utopic" even though that's not valid. So the only way to get the distro and series correct is to write the full deb line manually.

You can pass the full deb line to add-apt-repository, but if you do, it adds the line to /etc/apt/sources.list rather than to sources.list.d, which breaks the logic of "set sources.list to /dev/null to isolate the silo contents" hack below.

So I realized, since I'm reduced to writing my own deb line anyway, i might as well just make my own sources.list and reference it myself.

2. Because phablet-config just wraps add-apt-repository which I'm not convinced can be fixed for rtm, due to what cyphermox said about it.

3. I dunno, will it break other tools? Patches welcome.

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

> 1. Cyphermox suggested that even once add-apt-repository gets fixed in rtm, it
> would attempt to add distro series as "utopic" even though that's not valid.
> So the only way to get the distro and series correct is to write the full deb
> line manually.

I keep hearing mixed messages on that - cjwatson told me earlier today he thought it was possible and just had to confer with mvo over the exact right way to do it. Keep an eye on https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu-rtm/landing-017 to see what happens with it.
>
> You can pass the full deb line to add-apt-repository, but if you do, it adds
> the line to /etc/apt/sources.list rather than to sources.list.d, which breaks
> the logic of "set sources.list to /dev/null to isolate the silo contents" hack
> below.
>
> So I realized, since I'm reduced to writing my own deb line anyway, i might as
> well just make my own sources.list and reference it myself.
>
> 2. Because phablet-config just wraps add-apt-repository which I'm not
> convinced can be fixed for rtm, due to what cyphermox said about it.
>
> 3. I dunno, will it break other tools? Patches welcome.

Yes, apt-get install and dist-upgrade will fail unless they have --force-yes specified, which many tools in phablet-tools don't. I could submit a patch but it's as simple as adding:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECF1204C # <- the ci-train-ppa-service key

prior to running apt-get update

322. By Robert Bruce Park

Add apt-get for Brendan.

323. By Robert Bruce Park

Slightly less sloppy set -x output.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
324. By Robert Bruce Park

More fixes from Brendan.

325. By Robert Bruce Park

Well that didn't work.

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

You can't echo into /etc/apt/sources.list.d/citrain.list using adb shell, even if you use sudo. I'm not sure why - maybe some restriction on creating files. I had to create it in /tmp/ and then mv it.

review: Needs Fixing
326. By Robert Bruce Park

So this is just totally broken.

327. By Robert Bruce Park

So that's a thing.

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

On Thu, Sep 18, 2014 at 8:36 PM, Brendan Donegan <
<email address hidden>> wrote:

> Review: Needs Fixing
>
> You can't echo into /etc/apt/sources.list.d/citrain.list using adb shell,
> even if you use sudo. I'm not sure why - maybe some restriction on creating
> files. I had to create it in /tmp/ and then mv it.
>

You need to "echo blah | sudo tee file" it

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
328. By Robert Bruce Park

Switch back to add-apt-repository now that it landed.

Revision history for this message
Robert Bruce Park (robru) wrote :

Ok guys, this is ready for testing again, please test both utopic and rtm.

review: Approve
329. By Robert Bruce Park

Drop unused variable.

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

I'll test this - although it seems like it should work. Just two things inline.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
330. By Robert Bruce Park

--yes

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Bruce Park (robru) wrote :

> Why not pass --ppa=$PPA/$DISTRO/$SILO to phablet-config writable-image instead of calling that seperately?

Well, I didn't check, but I was just assuming that phablet-config didn't support the $PPA/$DISTRO/$SILO syntax for PPAs, so I was working around that.

Even if phablet-config really does work on RTM, it's just calling add-apt-repository anyway. What benefit do we get from going through a middleman?

> I don't think --force-yes is necessary any more and might even be a little unsafe since we should be dealing with a PPA whose key we have received already.

Yeah I can fix that tomorrow, EOD now!

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

On Thu, Sep 25, 2014 at 2:22 AM, ♫ Robert Bruce Park ♫ <
<email address hidden>> wrote:

> > Why not pass --ppa=$PPA/$DISTRO/$SILO to phablet-config writable-image
> instead of calling that seperately?
>
> Well, I didn't check, but I was just assuming that phablet-config didn't
> support the $PPA/$DISTRO/$SILO syntax for PPAs, so I was working around
> that.
>
> Even if phablet-config really does work on RTM, it's just calling
> add-apt-repository anyway. What benefit do we get from going through a
> middleman?
>
phablet-config calls add-apt-repository so basically you're just avoiding
code duplication where possible - it's sound practice

>
> > I don't think --force-yes is necessary any more and might even be a
> little unsafe since we should be dealing with a PPA whose key we have
> received already.
>
> Yeah I can fix that tomorrow, EOD now!
> --
>
> https://code.launchpad.net/~robru/phablet-tools/citrain-on-rtm/+merge/235069
> You are reviewing the proposed merge of
> lp:~robru/phablet-tools/citrain-on-rtm into lp:phablet-tools.
>

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Having said that, assuming this works I'm not going to block too hard on
that discrepancy

On Thu, Sep 25, 2014 at 9:47 AM, Brendan Donegan <
<email address hidden>> wrote:

> On Thu, Sep 25, 2014 at 2:22 AM, ♫ Robert Bruce Park ♫ <
> <email address hidden>> wrote:
>
>> > Why not pass --ppa=$PPA/$DISTRO/$SILO to phablet-config writable-image
>> instead of calling that seperately?
>>
>> Well, I didn't check, but I was just assuming that phablet-config didn't
>> support the $PPA/$DISTRO/$SILO syntax for PPAs, so I was working around
>> that.
>>
>> Even if phablet-config really does work on RTM, it's just calling
>> add-apt-repository anyway. What benefit do we get from going through a
>> middleman?
>>
> phablet-config calls add-apt-repository so basically you're just avoiding
> code duplication where possible - it's sound practice
>
>>
>> > I don't think --force-yes is necessary any more and might even be a
>> little unsafe since we should be dealing with a PPA whose key we have
>> received already.
>>
>> Yeah I can fix that tomorrow, EOD now!
>> --
>>
>> https://code.launchpad.net/~robru/phablet-tools/citrain-on-rtm/+merge/235069
>> You are reviewing the proposed merge of
>> lp:~robru/phablet-tools/citrain-on-rtm into lp:phablet-tools.
>>
>
>

331. By Robert Bruce Park

Fixes requested by brendand.

Revision history for this message
Robert Bruce Park (robru) wrote :

Ok, addressed all of Brendan's concerns.

> assuming this works

Yeah that's the trick, please actually test it.

review: Approve
Revision history for this message
Robert Bruce Park (robru) wrote :

Ok, I finally found some time to actually test this, and found it to be working in both Utopic and RTM, so I'm happy to finally merge this as long as everybody else is satisfied with the code!

review: Approve
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

LGTM +1

(N.B. I only tested on RTM)

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 'citrain'
2--- citrain 2014-08-20 01:30:24 +0000
3+++ citrain 2014-09-25 16:10:27 +0000
4@@ -16,7 +16,7 @@
5
6 usage () {
7 cat <<EOF
8-usage: $0 COMMAND SILO-NUMBER
9+usage: $0 COMMAND SILO-NUMBER [DEVICE-PASSWORD]
10
11 COMMANDS:
12 host-install Deprecated. Please use host-upgrade instead.
13@@ -43,8 +43,6 @@
14
15 # Defaults
16 PPA="ppa:ci-train-ppa-service"
17-HTTP="http://ppa.launchpad.net/ci-train-ppa-service"
18-SOURCES="ubuntu/dists/devel/main/source/Sources"
19
20 # Read the first positional argument.
21 COMMAND="$1"
22@@ -75,12 +73,23 @@
23
24 device-upgrade)
25 check_devices
26- echo "These PPAs are enabled on the device:"
27+ # Read the third positional argument.
28+ PASSWORD="$1"
29+ [ $# -gt 0 ] && shift || usage
30+
31 set -x
32 adb shell egrep ^deb /etc/apt/sources.list.d/\*.list
33- phablet-config writable-image --ppa $PPA/$SILO
34- adb shell sudo apt-get -o Dir::Etc::SourceList=/dev/null update
35- adb shell sudo apt-get dist-upgrade --yes
36+ if adb shell system-image-cli -i | grep -q ubuntu-rtm; then
37+ DISTRO="ubuntu-rtm"
38+ else
39+ DISTRO="ubuntu"
40+ fi
41+ phablet-config writable-image -r $PASSWORD --ppa $PPA/$DISTRO/$SILO
42+ adb shell "echo -e '#\x21/bin/sh\necho $PASSWORD' >/tmp/askpass.sh"
43+ adb shell chmod +x /tmp/askpass.sh
44+ adb shell SUDO_ASKPASS=/tmp/askpass.sh sudo -A apt-get -o Dir::Etc::SourceList=/dev/null update
45+ adb shell SUDO_ASKPASS=/tmp/askpass.sh sudo -A apt-get dist-upgrade --yes
46+ adb shell rm -f /tmp/askpass.sh
47 adb reboot
48 ;;
49

Subscribers

People subscribed via source and target branches