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

Proposed by Sergio Schvezov
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 162
Merged at revision: 161
Proposed branch: lp:~sergiusens/goget-ubuntu-touch/catchupToInstall
Merge into: lp:goget-ubuntu-touch
Prerequisite: lp:~sergiusens/goget-ubuntu-touch/polishit
Diff against target: 146 lines (+90/-5)
4 files modified
diskimage/common.go (+12/-2)
diskimage/common_test.go (+62/-0)
diskimage/core_uboot.go (+6/-1)
ubuntu-device-flash/core.go (+10/-2)
To merge this branch: bzr merge lp:~sergiusens/goget-ubuntu-touch/catchupToInstall
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
John Lenton (community) Approve
Review via email: mp+256602@code.launchpad.net

Commit message

Update to the sideload bandwagon

To post a comment you must log in.
Revision history for this message
John Lenton (chipaca) :
review: Approve
Revision history for this message
Sergio Schvezov (sergiusens) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'diskimage/common.go'
--- diskimage/common.go 2015-04-16 22:59:21 +0000
+++ diskimage/common.go 2015-04-16 22:59:21 +0000
@@ -8,6 +8,7 @@
8package diskimage8package diskimage
99
10import (10import (
11 "errors"
11 "fmt"12 "fmt"
12 "io/ioutil"13 "io/ioutil"
13 "os"14 "os"
@@ -108,8 +109,17 @@
108 Config map[string]interface{} `yaml:"config,omitempty"`109 Config map[string]interface{} `yaml:"config,omitempty"`
109}110}
110111
111func (o OemDescription) InstallPath() string {112func (o OemDescription) InstallPath(rootPath string) (string, error) {
112 return filepath.Join("/oem", o.Name, o.Version)113 glob, err := filepath.Glob(fmt.Sprintf("/%s/oem/%s.*/%s", rootPath, o.Name, o.Version))
114 if err != nil {
115 return "", err
116 }
117
118 if len(glob) != 1 {
119 return "", errors.New("oem package not installed")
120 }
121
122 return glob[0], nil
113}123}
114124
115func (o OemDescription) Architecture() string {125func (o OemDescription) Architecture() string {
116126
=== added file 'diskimage/common_test.go'
--- diskimage/common_test.go 1970-01-01 00:00:00 +0000
+++ diskimage/common_test.go 2015-04-16 22:59:21 +0000
@@ -0,0 +1,62 @@
1//
2// diskimage - handles ubuntu disk images
3//
4// Copyright (c) 2015 Canonical Ltd.
5//
6// Written by Sergio Schvezov <sergio.schvezov@canonical.com>
7//
8package diskimage
9
10// This program is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License version 3, as published
12// by the Free Software Foundation.
13//
14// This program is distributed in the hope that it will be useful, but
15// WITHOUT ANY WARRANTY; without even the implied warranties of
16// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
17// PURPOSE. See the GNU General Public License for more details.
18//
19// You should have received a copy of the GNU General Public License along
20// with this program. If not, see <http://www.gnu.org/licenses/>.
21
22import (
23 "fmt"
24 "os"
25 "path/filepath"
26
27 . "launchpad.net/gocheck"
28)
29
30type CommonTestSuite struct {
31 tmpdir string
32 oem OemDescription
33 packageInst string
34}
35
36var _ = Suite(&CommonTestSuite{})
37
38func (s *CommonTestSuite) SetUpTest(c *C) {
39 s.tmpdir = c.MkDir()
40 s.oem = OemDescription{Name: "packagename", Version: "42"}
41 s.packageInst = fmt.Sprintf("%s.%s", s.oem.Name, "sideload")
42}
43
44func (s *CommonTestSuite) TestOemInstallPath(c *C) {
45 err := os.MkdirAll(filepath.Join(s.tmpdir, "oem", s.packageInst, s.oem.Version), 0755)
46 c.Assert(err, IsNil)
47
48 installPath, err := s.oem.InstallPath(s.tmpdir)
49
50 c.Assert(err, IsNil)
51 c.Assert(installPath, Equals, filepath.Join(s.tmpdir, "/oem/packagename.sideload/42"))
52}
53
54func (s *CommonTestSuite) TestOemInstallPathNoOem(c *C) {
55 err := os.MkdirAll(filepath.Join(s.tmpdir, "oem", s.packageInst), 0755)
56 c.Assert(err, IsNil)
57
58 installPath, err := s.oem.InstallPath(s.tmpdir)
59
60 c.Assert(err, NotNil)
61 c.Assert(installPath, Equals, "")
62}
063
=== modified file 'diskimage/core_uboot.go'
--- diskimage/core_uboot.go 2015-04-01 19:07:26 +0000
+++ diskimage/core_uboot.go 2015-04-16 22:59:21 +0000
@@ -404,7 +404,12 @@
404 // if there is a specific dtb for the platform, copy it.404 // if there is a specific dtb for the platform, copy it.
405 // First look in oem and then in device.405 // First look in oem and then in device.
406 if oemDtb := img.oem.OEM.Hardware.Dtb; oemDtb != "" && img.oem.Platform() != "" {406 if oemDtb := img.oem.OEM.Hardware.Dtb; oemDtb != "" && img.oem.Platform() != "" {
407 oemDtb := filepath.Join(img.System(), img.oem.InstallPath(), oemDtb)407 oemInstallPath, err := img.oem.InstallPath(img.System())
408 if err != nil {
409 return err
410 }
411
412 oemDtb := filepath.Join(oemInstallPath, oemDtb)
408 dst := filepath.Join(bootDtbPath, filepath.Base(dtb))413 dst := filepath.Join(bootDtbPath, filepath.Base(dtb))
409 if err := sysutils.CopyFile(oemDtb, dst); err != nil {414 if err := sysutils.CopyFile(oemDtb, dst); err != nil {
410 return err415 return err
411416
=== modified file 'ubuntu-device-flash/core.go'
--- ubuntu-device-flash/core.go 2015-04-16 22:59:21 +0000
+++ ubuntu-device-flash/core.go 2015-04-16 22:59:21 +0000
@@ -285,7 +285,11 @@
285 return err285 return err
286 }286 }
287287
288 oemRootPath := filepath.Join(coreCmd.stagingRootPath, coreCmd.oem.InstallPath())288 oemRootPath, err := coreCmd.oem.InstallPath(coreCmd.stagingRootPath)
289 if err != nil {
290 return err
291 }
292
289 if err := img.FlashExtra(oemRootPath, devicePart); err != nil {293 if err := img.FlashExtra(oemRootPath, devicePart); err != nil {
290 return err294 return err
291 }295 }
@@ -361,7 +365,11 @@
361 return err365 return err
362 }366 }
363367
364 oemRootPath := filepath.Join(coreCmd.stagingRootPath, coreCmd.oem.InstallPath())368 oemRootPath, err := coreCmd.oem.InstallPath(coreCmd.stagingRootPath)
369 if err != nil {
370 return err
371 }
372
365 if err := img.SetupBoot(oemRootPath); err != nil {373 if err := img.SetupBoot(oemRootPath); err != nil {
366 return err374 return err
367 }375 }

Subscribers

People subscribed via source and target branches