Merge lp:~sergiusens/goget-ubuntu-touch/tarmac into lp:goget-ubuntu-touch

Proposed by Sergio Schvezov on 2015-04-16
Status: Merged
Approved by: Sergio Schvezov on 2015-04-17
Approved revision: 165
Merged at revision: 162
Proposed branch: lp:~sergiusens/goget-ubuntu-touch/tarmac
Merge into: lp:goget-ubuntu-touch
Prerequisite: lp:~sergiusens/goget-ubuntu-touch/catchupToInstall
Diff against target: 302 lines (+106/-25)
13 files modified
.tarmac.sh (+14/-0)
bootimg/bootimg.go (+7/-7)
bootimg/example/abootimg-extract/main.go (+2/-1)
dependencies.tsv (+8/-0)
devices/fastboot.go (+1/-1)
diskimage/bootloader_test.go (+2/-2)
diskimage/core_grub.go (+1/-1)
diskimage/image.go (+1/-1)
run-checks (+56/-0)
ubuntu-emulator/common.go (+3/-2)
ubuntu-emulator/constants.go (+8/-8)
ubuntu-emulator/run_test.go (+1/-0)
ubuntuimage/channels.go (+2/-2)
To merge this branch: bzr merge lp:~sergiusens/goget-ubuntu-touch/tarmac
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve on 2015-04-17
John Lenton Approve on 2015-04-16
Review via email: mp+256604@code.launchpad.net

Commit Message

Getting onto the tarmac for a ride

To post a comment you must log in.
John Lenton (chipaca) :
review: Approve
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.tarmac.sh'
2--- .tarmac.sh 1970-01-01 00:00:00 +0000
3+++ .tarmac.sh 2015-04-16 23:16:20 +0000
4@@ -0,0 +1,14 @@
5+#!/bin/sh
6+
7+set -ev
8+
9+# we always run in a fresh dir in tarmac
10+export GOPATH=$(mktemp -d)
11+trap 'rm -rf "$GOPATH"' EXIT
12+
13+# this is a hack, but not sure tarmac is golang friendly
14+mkdir -p $GOPATH/src/launchpad.net/goget-ubuntu-touch
15+cp -a . $GOPATH/src/launchpad.net/goget-ubuntu-touch
16+cd $GOPATH/src/launchpad.net/goget-ubuntu-touch
17+
18+./run-checks
19
20=== modified file 'bootimg/bootimg.go'
21--- bootimg/bootimg.go 2014-01-07 15:19:28 +0000
22+++ bootimg/bootimg.go 2015-04-16 23:16:20 +0000
23@@ -22,8 +22,8 @@
24 import (
25 "bytes"
26 "encoding/binary"
27+ "errors"
28 "io/ioutil"
29- "errors"
30 )
31
32 type bootHeader map[uint]uint32
33@@ -40,13 +40,13 @@
34 pageSize
35 )
36
37-type AndroidBootImg struct{
38+type AndroidBootImg struct {
39 kernelOffset, ramdiskOffset, secondOffset uint32
40- hdr bootHeader
41- img []byte
42+ hdr bootHeader
43+ img []byte
44 }
45
46-// readChunk reads a chunk o b []bytes returns it's Little Endian
47+// readChunk reads a chunk o b []bytes returns it's Little Endian
48 // unsigned size(4) value
49 func readChunk(b []byte) (value uint32, err error) {
50 if len(b) != 4 {
51@@ -66,10 +66,10 @@
52 if BOOT_MAGIC != string(magic) {
53 return boot, errors.New("This is not on an android bootimg")
54 }
55-
56+
57 boot.hdr = make(bootHeader)
58 for i, start := kernelSize, len(BOOT_MAGIC); i <= pageSize; i++ {
59- if boot.hdr[uint(i)], err = readChunk(img[start:start + 4]); err != nil {
60+ if boot.hdr[uint(i)], err = readChunk(img[start : start+4]); err != nil {
61 return boot, err
62 }
63 // sizeof(unsigned)
64
65=== modified file 'bootimg/example/abootimg-extract/main.go'
66--- bootimg/example/abootimg-extract/main.go 2014-01-08 12:04:18 +0000
67+++ bootimg/example/abootimg-extract/main.go 2015-04-16 23:16:20 +0000
68@@ -20,9 +20,10 @@
69 // with this program. If not, see <http://www.gnu.org/licenses/>.
70
71 import (
72+ "io/ioutil"
73 "log"
74- "io/ioutil"
75 "os"
76+
77 "launchpad.net/goget-ubuntu-touch/bootimg"
78 )
79
80
81=== added file 'dependencies.tsv'
82--- dependencies.tsv 1970-01-01 00:00:00 +0000
83+++ dependencies.tsv 2015-04-16 23:16:20 +0000
84@@ -0,0 +1,8 @@
85+github.com/blakesmith/ar git c9a977dd0cc1392b023382c7bfa5a22af8d3b730 2013-02-19T04:59:55Z
86+github.com/cheggaaa/pb git e8c7cc515bfde3e267957a3b110080ceed51354e 2014-12-02T07:01:21Z
87+github.com/jessevdk/go-flags git 15347ef417a300349807983f15af9e65cd2e1b3a 2015-01-25T08:53:51Z
88+github.com/juju/loggo git 4c7cbce140ca070eeb59a28f4bf9507e511711f9 2015-02-26T05:51:10Z
89+github.com/mvo5/goconfigparser git 26426272dda20cc76aa1fa44286dc743d2972fe8 2015-02-12T09:37:50Z
90+gopkg.in/yaml.v2 git 49c95bdc21843256fb6c4e0d370a05f24a0bf213 2015-02-24T22:57:58Z
91+launchpad.net/gocheck bzr gustavo@niemeyer.net-20140225173054-xu9zlkf9kxhvow02 87
92+launchpad.net/snappy bzr snappy_tarmac-20150416201159-kvpgniq8mp64bimf 382
93
94=== modified file 'devices/fastboot.go'
95--- devices/fastboot.go 2014-01-07 15:19:28 +0000
96+++ devices/fastboot.go 2015-04-16 23:16:20 +0000
97@@ -76,7 +76,7 @@
98 cmd := append(fastboot.params, []string{"getvar", "product"}...)
99 deviceOutput, err := exec.Command(fastbootCommand, cmd...).CombinedOutput()
100 lines := strings.Split(string(deviceOutput), "\n")
101- for _, line := range(lines) {
102+ for _, line := range lines {
103 fields := strings.Split(line, ":")
104 if strings.Contains(fields[0], "product") {
105 device = strings.TrimSpace(fields[1])
106
107=== modified file 'diskimage/bootloader_test.go'
108--- diskimage/bootloader_test.go 2015-03-30 14:39:55 +0000
109+++ diskimage/bootloader_test.go 2015-04-16 23:16:20 +0000
110@@ -171,7 +171,7 @@
111 }
112
113 func (s *BootAssetRawFilesTestSuite) TestRawWriteNoValidOffset(c *C) {
114- f := fmt.Sprintf(fileName)
115+ f := fileName
116 fAbsolutePath := filepath.Join(s.oemRootPathDir, f)
117 c.Assert(ioutil.WriteFile(fAbsolutePath, []byte(f), 0644), IsNil)
118 offset := "NaN"
119@@ -181,7 +181,7 @@
120 }
121
122 func (s *BootAssetRawFilesTestSuite) TestRawWriteNoValidFile(c *C) {
123- f := fmt.Sprintf(fileName)
124+ f := fileName
125 offset := "10"
126 s.files = []BootAssetRawFiles{BootAssetRawFiles{Path: f, Offset: offset}}
127
128
129=== modified file 'diskimage/core_grub.go'
130--- diskimage/core_grub.go 2015-03-31 12:46:01 +0000
131+++ diskimage/core_grub.go 2015-04-16 23:16:20 +0000
132@@ -331,7 +331,7 @@
133 }
134 grubFile, err := os.Create(filepath.Join(grubDir, "50-system-image.cfg"))
135 if err != nil {
136- return fmt.Errorf("unable to create %s file: %s", grubFile, err)
137+ return fmt.Errorf("unable to create %s file: %s", grubFile.Name(), err)
138 }
139 defer grubFile.Close()
140 if _, err := io.WriteString(grubFile, grubCfgContent); err != nil {
141
142=== modified file 'diskimage/image.go'
143--- diskimage/image.go 2015-01-21 23:22:53 +0000
144+++ diskimage/image.go 2015-04-16 23:16:20 +0000
145@@ -221,7 +221,7 @@
146 return err
147 }
148 } else if !fi.IsDir() {
149- return fmt.Errorf("extract dir %s is not a directory")
150+ return fmt.Errorf("extract dir %s is not a directory", fi.Name())
151 }
152 dstFile, err := os.Create(filepath.Join(dir, filePath))
153 if err != nil {
154
155=== added file 'run-checks'
156--- run-checks 1970-01-01 00:00:00 +0000
157+++ run-checks 2015-04-16 23:16:20 +0000
158@@ -0,0 +1,56 @@
159+#!/bin/sh
160+
161+set -e
162+
163+if which goctest >/dev/null; then
164+ goctest="goctest"
165+else
166+ goctest="go test"
167+fi
168+
169+echo Checking formatting
170+fmt=$(gofmt -l .)
171+
172+if [ -n "$fmt" ]; then
173+ echo "Formatting wrong in following files"
174+ echo $fmt
175+ exit 1
176+fi
177+
178+echo Installing godeps
179+go get launchpad.net/godeps
180+export PATH=$PATH:$GOPATH/bin
181+
182+echo Install golint
183+go get github.com/golang/lint/golint
184+export PATH=$PATH:$GOPATH/bin
185+
186+echo Obtaining dependencies
187+godeps -u dependencies.tsv
188+
189+
190+
191+echo Building
192+go build -v launchpad.net/goget-ubuntu-touch/...
193+
194+
195+# tests
196+echo Running tests from $(pwd)
197+$goctest -v -cover ./...
198+
199+
200+# go vet
201+echo Running vet
202+go vet ./...
203+
204+# golint
205+# TODO enable!
206+#echo Running lint
207+#lint=$(golint ./...)
208+#if [ -n "$lint" ]; then
209+# echo "Lint complains:"
210+# echo $lint
211+# exit 1
212+#fi
213+
214+echo "All good, what could possibly go wrong"
215
216=== modified file 'ubuntu-emulator/common.go'
217--- ubuntu-emulator/common.go 2014-06-06 15:15:03 +0000
218+++ ubuntu-emulator/common.go 2015-04-16 23:16:20 +0000
219@@ -23,10 +23,11 @@
220 "errors"
221 "fmt"
222 "io/ioutil"
223- "launchpad.net/goget-ubuntu-touch/bootimg"
224 "os"
225 "path/filepath"
226 "strings"
227+
228+ "launchpad.net/goget-ubuntu-touch/bootimg"
229 )
230
231 func getDeviceTar(files []string) (string, error) {
232@@ -52,7 +53,7 @@
233 if err := boot.WriteRamdisk(ramdiskPath); err != nil {
234 return err
235 }
236- if (ramdiskName == bootRamdisk) {
237+ if ramdiskName == bootRamdisk {
238 kernelPath := filepath.Join(dataDir, kernelName)
239 if boot.WriteKernel(kernelPath); err != nil {
240 return err
241
242=== modified file 'ubuntu-emulator/constants.go'
243--- ubuntu-emulator/constants.go 2014-06-06 15:15:03 +0000
244+++ ubuntu-emulator/constants.go 2015-04-16 23:16:20 +0000
245@@ -21,14 +21,14 @@
246
247 //Global constansts
248 const (
249- kernelName = "ubuntu-kernel"
250- dataImage = "userdata.img"
251- sdcardImage = "sdcard.img"
252- systemImage = "system.img"
253- cacheImage = "cache.img"
254- bootImage = "boot.img"
255- bootRamdisk = "ramdisk.img"
256- recoveryImage = "recovery.img"
257+ kernelName = "ubuntu-kernel"
258+ dataImage = "userdata.img"
259+ sdcardImage = "sdcard.img"
260+ systemImage = "system.img"
261+ cacheImage = "cache.img"
262+ bootImage = "boot.img"
263+ bootRamdisk = "ramdisk.img"
264+ recoveryImage = "recovery.img"
265 recoveryRamdisk = "recovery-ramdisk.img"
266 )
267
268
269=== modified file 'ubuntu-emulator/run_test.go'
270--- ubuntu-emulator/run_test.go 2014-07-08 19:24:20 +0000
271+++ ubuntu-emulator/run_test.go 2015-04-16 23:16:20 +0000
272@@ -25,6 +25,7 @@
273 "os"
274 "path/filepath"
275 "testing"
276+
277 . "launchpad.net/gocheck"
278 )
279
280
281=== modified file 'ubuntuimage/channels.go'
282--- ubuntuimage/channels.go 2014-10-02 08:48:42 +0000
283+++ ubuntuimage/channels.go 2015-04-16 23:16:20 +0000
284@@ -25,8 +25,8 @@
285 "encoding/json"
286 "errors"
287 "fmt"
288+ "io/ioutil"
289 "net/http"
290- "io/ioutil"
291 )
292
293 const (
294@@ -106,7 +106,7 @@
295 return err
296 }
297
298- if (resp.StatusCode != 200) {
299+ if resp.StatusCode != 200 {
300 statusErr := errors.New(fmt.Sprintf("Invalid HTTP response: %d", resp.StatusCode))
301 return statusErr
302 }

Subscribers

People subscribed via source and target branches