Merge lp:~sergiusens/goget-ubuntu-touch/installYaml into lp:goget-ubuntu-touch
- installYaml
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Sergio Schvezov |
Approved revision: | 191 |
Merged at revision: | 184 |
Proposed branch: | lp:~sergiusens/goget-ubuntu-touch/installYaml |
Merge into: | lp:goget-ubuntu-touch |
Prerequisite: | lp:~sergiusens/goget-ubuntu-touch/beBetter |
Diff against target: |
111 lines (+59/-2) 3 files modified
dependencies.tsv (+1/-1) diskimage/common.go (+1/-0) ubuntu-device-flash/core.go (+57/-1) |
To merge this branch: | bzr merge lp:~sergiusens/goget-ubuntu-touch/installYaml |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sergio Schvezov | Approve | ||
John Lenton (community) | Approve | ||
Michael Vogt (community) | Approve | ||
Snappy Developers | continuous-integration | Pending | |
Review via email: mp+261865@code.launchpad.net |
This proposal supersedes a proposal from 2015-04-14.
Commit message
Stamp a yaml with install/setup information
Description of the change
* Record sideloads to ensure "snappy update" doesn't try to upgrade a system that uses custom
assets.
Creates a stamp file on the writable partition when --device-part= is specified. This is clearly trivial to defeat, but will allow snappy to refuse to update a system with such a stamp file.
There is a potential gotcha with this approach (albeit unlikely for anyone to hit it): if u-d-f is used to first download the set of s-i tar files and then u-d-f is called again with --device-part= pointing to the valid, official device part just downloaded, the stamp will still be created.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
The snappy part of this work is on MP: https:/
Sergio Schvezov (sergiusens) wrote : Posted in a previous version of this proposal | # |
As I said on irc, this looks great; I would change:
- writeLocation to a factory reset safe location
- maybe instead of storing sideLoaded and do if sideLoaded you can just if coreCmd.
- remove the changelog change, I will draft a proper one when this is released into the archive.
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
Thanks for the comments. Branch updated.
Sergio Schvezov (sergiusens) wrote : Posted in a previous version of this proposal | # |
This looks really good, I liked the yaml idea you proposed on irc; and discussed it a bit with mvo and he was in favor of it too.
Just make it /boot/provision
Regarding the layout, I'd just keep these:
meta:
timestamp: 1429185020
initial-
system-
provisioning-tool:
name: ubuntu-device-flash
path: /usr/bin/
version: 0.20snappy3-
installation-
size: 3
size-unit: GB
output: /tmp/bbb.img
channel: ubuntu-
device-part: /some/path/file.tgz
developer-mode: true
Since platform and architecture are already in the oem snap, so it would be duplicate information (oem snaps will become mandatory).
Can't wait to see this make it in!
Oh, there's one minor inline comment.
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
This branch + lp:~jamesodhunt/snappy/install.yaml are what I have so far.
Any thoughts on how we set Version sensibly in writeInstallYaml()? We have the same problem in snappy.
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
The other slight wart is the "GB" in writeInstallYaml().
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
lp:~jamesodhunt/snappy/install.yaml is now essentially complete.
Sergio Schvezov (sergiusens) wrote : Posted in a previous version of this proposal | # |
looks good, we just need to adjust some knobs here and there.
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
Thanks for reviewing. Branch updated.
Sergio Schvezov (sergiusens) : Posted in a previous version of this proposal | # |
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
It tested fine, but it looks like a snappy change earlier today has broken 'udf ... --oem file.snap':
_______
$ sudo ubuntu-device-flash --verbose core --size 3 --channel devel-proposed --developer-mode --output=amd64.img --device-part device-
Determining oem configuration
2015-04-21 16:46:57 ERROR snappy logger.go:199 ./generic-
./generic-
_______
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
This branch could be the offending one?
https:/
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
Or is it that udf just needs this branch merging?
https:/
Sergio Schvezov (sergiusens) wrote : Posted in a previous version of this proposal | # |
> Or is it that udf just needs this branch merging?
>
> https:/
> touch/oemFlag/
yes, that is blocked in the pipeline from an MP by steve
Sergio Schvezov (sergiusens) wrote : Posted in a previous version of this proposal | # |
> > Or is it that udf just needs this branch merging?
> >
> > https:/
> > touch/oemFlag/
>
> yes, that is blocked in the pipeline from an MP by steve
Rebased and landed
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
Re-tested:
= amd64 =
$ sudo ubuntu-device-flash --verbose core --size 3 --channel edge --output=amd64.img --device-part device-
0_all.snap 15.04
Determining oem configuration
Fetching information from server...
Downloading and setting up...
Using a custom device tarball
Searching for hardware.yaml in device part
Download finished for /home/james/
Partitioning...
Download finished for /home/james/
Download finished for /home/james/
Mapping...
Formatting...
Mapping...
Mounting...
Provisioning...
Installing ./generic-
Unmounting...
Unmapping...
New image complete
Summary:
Output: amd64.img
Architecture: amd64
Channel: edge
Version: 26
Launch by running: kvm -m 768 amd64.img
$ sudo kpartx -avs amd64.img
$ sudo mount /dev/mapper/loop0p2 /mnt
$ cat /mnt/install.yaml
meta:
timestamp: 2015-04-
initial-version: "26"
system-
tool:
name: ubuntu-device-flash
path: /usr/bin/
version: ""
options:
size: 3
size-unit: GB
output: amd64.img
channel: edge
device-part: device-
oem: ./generic-
= armhf =
$ sudo ubuntu-device-flash --verbose core --size 3 --channel edge --output=armhf.img --device-part device-
Determining oem configuration
Fetching information from server...
WARNING: this option should only be used to build azure images
Downloading and setting up...
Using a custom device tarball
Searching for hardware.yaml in device part
Download finished for /home/james/
Download finished for /home/james/
Download finished for /home/james/
Partitioning...
Mapping...
Formatting...
Mapping...
Mounting...
Provisioning...
Installing ./beagleblack.
Replicating system-a into system-b
Unmounting...
Unmapping...
New image complete
Summary:
Output: armhf.img
Architecture: armhf
Channel: edge
Version: 22
$ sudo kpartx -avs armhf.img
$ sudo mount /dev/mapper/loop0p2 /mnt
$ cat /mnt/install.yaml
meta:
timestamp: 2015-04-
initial-version: "22"
system-
tool:
name: ubuntu-device-flash
path: /usr/bin/
version: ""
options:
size: 3
size-unit: GB
output: armhf.img
channel: edge
device-part: device-
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
Grr, of course although this "works" for grub, it won't work on a running system where it will have to live in /boot/grub/.
Sergio Schvezov (sergiusens) wrote : Posted in a previous version of this proposal | # |
> Grr, of course although this "works" for grub, it won't work on a running
> system where it will have to live in /boot/grub/.
Right, but actually wrong, this is what I mentioned wrt can't find it on a running system, it's actually under /boot/efi/
James Hunt (jamesodhunt) wrote : Posted in a previous version of this proposal | # |
Branch updated.
Sergio Schvezov (sergiusens) wrote : Posted in a previous version of this proposal | # |
For this to land an updated lp:snappy needs to make it to wily
Sergio Schvezov (sergiusens) : | # |
Snappy Tarmac (snappydevtarmac) wrote : | # |
The attempt to merge lp:~sergiusens/goget-ubuntu-touch/installYaml into lp:goget-ubuntu-touch failed. Below is the output from the failed tests.
Checking formatting
Formatting wrong in following files
ubuntu-
# we always run in a fresh dir in tarmac
export GOPATH=$(mktemp -d)
trap 'rm -rf "$GOPATH"' EXIT
# this is a hack, but not sure tarmac is golang friendly
mkdir -p $GOPATH/
cp -a . $GOPATH/
cd $GOPATH/
./run-checks
Sergio Schvezov (sergiusens) : | # |
Snappy Tarmac (snappydevtarmac) wrote : | # |
The attempt to merge lp:~sergiusens/goget-ubuntu-touch/installYaml into lp:goget-ubuntu-touch failed. Below is the output from the failed tests.
Checking formatting
Installing godeps
Install golint
Obtaining dependencies
update github.
update github.
github.
update github.
github.
update github.
github.
update gopkg.in/yaml.v2 failed; trying to fetch newer version
github.
update launchpad.
gopkg.in/yaml.v2 now at 49c95bdc2184325
update launchpad.
launchpad.
launchpad.
Building
# we always run in a fresh dir in tarmac
export GOPATH=$(mktemp -d)
trap 'rm -rf "$GOPATH"' EXIT
# this is a hack, but not sure tarmac is golang friendly
mkdir -p $GOPATH/
cp -a . $GOPATH/
cd $GOPATH/
./run-checks
ubuntu-
/usr/lib/
/home/
- 191. By Sergio Schvezov
-
godeps godeps godeps...
Sergio Schvezov (sergiusens) : | # |
Preview Diff
1 | === modified file 'dependencies.tsv' |
2 | --- dependencies.tsv 2015-06-09 13:57:34 +0000 |
3 | +++ dependencies.tsv 2015-06-17 12:21:42 +0000 |
4 | @@ -4,4 +4,4 @@ |
5 | github.com/mvo5/goconfigparser git 26426272dda20cc76aa1fa44286dc743d2972fe8 2015-02-12T09:37:50Z |
6 | gopkg.in/yaml.v2 git 49c95bdc21843256fb6c4e0d370a05f24a0bf213 2015-02-24T22:57:58Z |
7 | launchpad.net/gocheck bzr gustavo@niemeyer.net-20140225173054-xu9zlkf9kxhvow02 87 |
8 | -launchpad.net/snappy bzr snappy_tarmac-20150609131158-tl9ndj3aor8m3kna 493 |
9 | +launchpad.net/snappy bzr snappy_tarmac-20150617101203-6hsfxqrckt6koobw 512 |
10 | |
11 | === modified file 'diskimage/common.go' |
12 | --- diskimage/common.go 2015-06-15 15:32:25 +0000 |
13 | +++ diskimage/common.go 2015-06-17 12:21:42 +0000 |
14 | @@ -54,6 +54,7 @@ |
15 | } |
16 | |
17 | type SystemImage interface { |
18 | + Boot() string |
19 | System() string |
20 | Writable() string |
21 | } |
22 | |
23 | === modified file 'ubuntu-device-flash/core.go' |
24 | --- ubuntu-device-flash/core.go 2015-06-12 04:39:13 +0000 |
25 | +++ ubuntu-device-flash/core.go 2015-06-17 12:21:42 +0000 |
26 | @@ -25,6 +25,7 @@ |
27 | "gopkg.in/yaml.v2" |
28 | "launchpad.net/snappy/helpers" |
29 | "launchpad.net/snappy/progress" |
30 | + "launchpad.net/snappy/provisioning" |
31 | "launchpad.net/snappy/release" |
32 | "launchpad.net/snappy/snappy" |
33 | |
34 | @@ -277,6 +278,9 @@ |
35 | return err |
36 | } |
37 | |
38 | + // avoid passing more args to setup() |
39 | + globalArgs.Revision = image.Version |
40 | + |
41 | if err := coreCmd.setup(img, filePathChan, len(image.Files)); err != nil { |
42 | return err |
43 | } |
44 | @@ -392,7 +396,7 @@ |
45 | } |
46 | } |
47 | |
48 | - return nil |
49 | + return coreCmd.writeInstallYaml(img.Boot()) |
50 | } |
51 | |
52 | func (coreCmd *CoreCmd) install(systemPath string) error { |
53 | @@ -586,6 +590,58 @@ |
54 | return oem, nil |
55 | } |
56 | |
57 | +// Creates a YAML file inside the image that contains metadata relating |
58 | +// to the installation. |
59 | +func (coreCmd CoreCmd) writeInstallYaml(bootMountpoint string) error { |
60 | + selfPath, err := exec.LookPath(os.Args[0]) |
61 | + if err != nil { |
62 | + return err |
63 | + } |
64 | + |
65 | + bootDir := "" |
66 | + |
67 | + switch coreCmd.oem.OEM.Hardware.Bootloader { |
68 | + // Running systems use a bindmount for /boot/grub, but |
69 | + // since the system isn't booted, create the file in the |
70 | + // real location. |
71 | + case "grub": |
72 | + bootDir = "/EFI/ubuntu/grub" |
73 | + } |
74 | + |
75 | + installYamlFilePath := filepath.Join(bootMountpoint, bootDir, provisioning.InstallYamlFile) |
76 | + |
77 | + i := provisioning.InstallYaml{ |
78 | + InstallMeta: provisioning.InstallMeta{ |
79 | + Timestamp: time.Now(), |
80 | + InitialVersion: fmt.Sprintf("%d", globalArgs.Revision), |
81 | + SystemImageServer: globalArgs.Server, |
82 | + }, |
83 | + InstallTool: provisioning.InstallTool{ |
84 | + Name: filepath.Base(selfPath), |
85 | + Path: selfPath, |
86 | + // FIXME: we don't know our own version yet :) |
87 | + // Version: "???", |
88 | + }, |
89 | + InstallOptions: provisioning.InstallOptions{ |
90 | + Size: coreCmd.Size, |
91 | + SizeUnit: "GB", |
92 | + Output: coreCmd.Output, |
93 | + Channel: coreCmd.Channel, |
94 | + DevicePart: coreCmd.Development.DevicePart, |
95 | + Oem: coreCmd.Oem, |
96 | + DeveloperMode: coreCmd.Development.DeveloperMode, |
97 | + }, |
98 | + } |
99 | + |
100 | + data, err := yaml.Marshal(&i) |
101 | + if err != nil { |
102 | + return err |
103 | + } |
104 | + |
105 | + // the file isn't supposed to be modified, hence r/o. |
106 | + return ioutil.WriteFile(installYamlFilePath, data, 0444) |
107 | +} |
108 | + |
109 | func extractHWDescription(path string) (hw diskimage.HardwareDescription, err error) { |
110 | // hack to circumvent https://code.google.com/p/go/issues/detail?id=1435 |
111 | if syscall.Getuid() == 0 { |
FAILED: Continuous integration, rev:160 /code.launchpad .net/~jamesodhu nt/goget- ubuntu- touch/record- sideload/ +merge/ 256190/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ goget-ubuntu- touch-ci/ 171/ jenkins. qa.ubuntu. com/job/ goget-ubuntu- touch-vivid- amd64-ci/ 84/console jenkins. qa.ubuntu. com/job/ goget-ubuntu- touch-vivid- armhf-ci/ 84/console jenkins. qa.ubuntu. com/job/ goget-ubuntu- touch-vivid- i386-ci/ 84/console
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/goget- ubuntu- touch-ci/ 171/rebuild
http://