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
=== modified file 'devices/adb.go'
--- devices/adb.go 2014-02-24 15:10:17 +0000
+++ devices/adb.go 2014-04-16 17:35:43 +0000
@@ -49,6 +49,17 @@
49 adb.params = append(adb.params, []string{"-s", serial}...)49 adb.params = append(adb.params, []string{"-s", serial}...)
50}50}
5151
52// Shell runs a specific command on the target device
53func (adb *AndroidDebugBridge) Shell(command ...string) (string, error) {
54 cmd := append(adb.params, "shell")
55 cmd = append(cmd, command...)
56 out, err := exec.Command(adbCommand, cmd...).Output()
57 if err != nil {
58 return "", err
59 }
60 return strings.TrimSpace(string(out)), nil
61}
62
52// GetDevice parses the android property system to determine the device being used63// GetDevice parses the android property system to determine the device being used
53func (adb *AndroidDebugBridge) GetDevice() (deviceName string, err error) {64func (adb *AndroidDebugBridge) GetDevice() (deviceName string, err error) {
54 cmd := append(adb.params, []string{"shell", "getprop", "ro.product.device"}...)65 cmd := append(adb.params, []string{"shell", "getprop", "ro.product.device"}...)
5566
=== modified file 'ubuntu-device-flash/main.go'
--- ubuntu-device-flash/main.go 2014-04-16 11:43:38 +0000
+++ ubuntu-device-flash/main.go 2014-04-16 17:35:43 +0000
@@ -202,19 +202,34 @@
202202
203// bitPusher203// bitPusher
204func bitPusher(adb devices.UbuntuDebugBridge, files <-chan Files, done chan<- bool) {204func bitPusher(adb devices.UbuntuDebugBridge, files <-chan Files, done chan<- bool) {
205 if _, err := adb.Shell("rm -rf /cache/recovery/*.xz /cache/recovery/*.xz.asc"); err != nil {
206 log.Fatal("Cannot cleanup tree to ensure clean deployment", err)
207 }
208 freeSpace := "unknown"
209 dfCacheCmd := "df -h | grep /dev/disk/by-partlabel/cache"
210 if free, err := adb.Shell(dfCacheCmd); err != nil {
211 log.Fatal("Unable to retrieve free space on target")
212 } else {
213 //Filesystem Size Used Avail Use% Mounted on
214 free := strings.Fields(free)
215 if len(free) > 3 {
216 freeSpace = free[3]
217 }
218 }
219 errMsg := "Cannot push %s to device: free space on /cache/recovery is %s"
205 for {220 for {
206 file := <-files221 file := <-files
207 go func() {222 go func() {
208 log.Printf("Start pushing %s to device", file.FilePath)223 log.Printf("Start pushing %s to device", file.FilePath)
209 err := adb.Push(file.FilePath, "/cache/recovery/")224 err := adb.Push(file.FilePath, "/cache/recovery/")
210 if err != nil {225 if err != nil {
211 log.Fatalf("Cannot push %s to device", file.FilePath)226 log.Fatalf(errMsg, file.SigPath, freeSpace)
212 }227 }
213 err = adb.Push(file.SigPath, "/cache/recovery/")228 err = adb.Push(file.SigPath, "/cache/recovery/")
214 if err != nil {229 if err != nil {
215 log.Fatalf("Cannot push %s to device", file.SigPath)230 log.Fatalf(errMsg, file.SigPath, freeSpace)
216 }231 }
217 log.Printf("Done pushing %s to device", file.SigPath)232 log.Printf("Done pushing %s to device", file.FilePath)
218 done <- true233 done <- true
219 }()234 }()
220 }235 }

Subscribers

People subscribed via source and target branches