Merge lp:~sergiusens/goget-ubuntu-touch/space-errors into lp:goget-ubuntu-touch

Proposed by Sergio Schvezov
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 36
Merged at revision: 34
Proposed branch: lp:~sergiusens/goget-ubuntu-touch/space-errors
Merge into: lp:goget-ubuntu-touch
Diff against target: 63 lines (+29/-3)
2 files modified
devices/adb.go (+11/-0)
ubuntu-device-flash/main.go (+18/-3)
To merge this branch: bzr merge lp:~sergiusens/goget-ubuntu-touch/space-errors
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Manuel de la Peña (community) Approve
Review via email: mp+216154@code.launchpad.net

Commit message

ubuntu-device-flash: remove previous failed flashing artifacts and if still not enough space, fail with an error message with the amount of available space on the target

Description of the change

You can trigger the error path by doing
dd if=/dev/zero of=/cache/recovery/bigfile bs=1024k count=510

Or make sure it works later by
mv /cache/recovery/bigfile /cache/recovery/bigfile.xz

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
Manuel de la Peña (mandel) wrote :

Looks like there is an error handeling here:

39 + if len(free) > 3 {
40 + freeSpace = free[3]
41 + }

probably you want to do something when the length is not the correct one, right?

review: Needs Information
36. By Sergio Schvezov

Adding default displays when input not of expected minimum length

Revision history for this message
Manuel de la Peña (mandel) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
XiaoGuo, Liu (liu-xiao-guo) wrote :

liuxg@liuxg:~/copu$ ubuntu-device-flash --channel ubuntu-touch/utopic-proposed --wipe --revision=75 --bootstrap
2014/06/26 17:11:14 Expecting the device to be in the bootloader... waiting
2014/06/26 17:11:14 Device is |mako|
2014/06/26 17:11:18 Flashing version 75 from ubuntu-touch/utopic-proposed channel and server https://system-image.ubuntu.com to device mako
334.02 MB / 334.02 MB [==================================] 100.00 % 715.31 KB/s
/home/liuxg/.cache/ubuntuimages/pool/device-8e3e30aa503cbe9b6fdf3497ad5cf38398f8bcf88c80d98a988a4ad464b3db28.tar.xz
2014/06/26 17:20:34 Cannot cleanup tree to ensure clean deploymentexit status 255

I got this error too when I am trying to flash my phone software. no matter which version is being flashed. I am going to have a demo tomorrow. Could you please help to provide a solution to it?

thanks!

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

How is this related to the merge proposal? Please take time to read: http://developer.ubuntu.com/start/ubuntu-for-devices/installing-ubuntu-for-devices/

or log a proper bug report

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'devices/adb.go'
2--- devices/adb.go 2014-02-24 15:10:17 +0000
3+++ devices/adb.go 2014-04-16 17:35:43 +0000
4@@ -49,6 +49,17 @@
5 adb.params = append(adb.params, []string{"-s", serial}...)
6 }
7
8+// Shell runs a specific command on the target device
9+func (adb *AndroidDebugBridge) Shell(command ...string) (string, error) {
10+ cmd := append(adb.params, "shell")
11+ cmd = append(cmd, command...)
12+ out, err := exec.Command(adbCommand, cmd...).Output()
13+ if err != nil {
14+ return "", err
15+ }
16+ return strings.TrimSpace(string(out)), nil
17+}
18+
19 // GetDevice parses the android property system to determine the device being used
20 func (adb *AndroidDebugBridge) GetDevice() (deviceName string, err error) {
21 cmd := append(adb.params, []string{"shell", "getprop", "ro.product.device"}...)
22
23=== modified file 'ubuntu-device-flash/main.go'
24--- ubuntu-device-flash/main.go 2014-04-16 11:43:38 +0000
25+++ ubuntu-device-flash/main.go 2014-04-16 17:35:43 +0000
26@@ -202,19 +202,34 @@
27
28 // bitPusher
29 func bitPusher(adb devices.UbuntuDebugBridge, files <-chan Files, done chan<- bool) {
30+ if _, err := adb.Shell("rm -rf /cache/recovery/*.xz /cache/recovery/*.xz.asc"); err != nil {
31+ log.Fatal("Cannot cleanup tree to ensure clean deployment", err)
32+ }
33+ freeSpace := "unknown"
34+ dfCacheCmd := "df -h | grep /dev/disk/by-partlabel/cache"
35+ if free, err := adb.Shell(dfCacheCmd); err != nil {
36+ log.Fatal("Unable to retrieve free space on target")
37+ } else {
38+ //Filesystem Size Used Avail Use% Mounted on
39+ free := strings.Fields(free)
40+ if len(free) > 3 {
41+ freeSpace = free[3]
42+ }
43+ }
44+ errMsg := "Cannot push %s to device: free space on /cache/recovery is %s"
45 for {
46 file := <-files
47 go func() {
48 log.Printf("Start pushing %s to device", file.FilePath)
49 err := adb.Push(file.FilePath, "/cache/recovery/")
50 if err != nil {
51- log.Fatalf("Cannot push %s to device", file.FilePath)
52+ log.Fatalf(errMsg, file.SigPath, freeSpace)
53 }
54 err = adb.Push(file.SigPath, "/cache/recovery/")
55 if err != nil {
56- log.Fatalf("Cannot push %s to device", file.SigPath)
57+ log.Fatalf(errMsg, file.SigPath, freeSpace)
58 }
59- log.Printf("Done pushing %s to device", file.SigPath)
60+ log.Printf("Done pushing %s to device", file.FilePath)
61 done <- true
62 }()
63 }

Subscribers

People subscribed via source and target branches