Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Add new info.Info interface and add minimal package yaml parser #271
Conversation
mvo5
added some commits
Dec 22, 2015
|
retest this please |
|
I like what you're doing here. I don't like the name |
mvo5
added some commits
Dec 22, 2015
|
Thanks @chipaca ! I renamed it to snapfile.Open now and moved the pkg.File in there too (but I can easily revert that last commit if you prefer it as pkg.File). |
|
Fwiw, the integration tests shold be ok again once bugfix/oem-compat is merged into master. |
|
Once this has landed we can land a branch for ubuntu-device-flash in 16.04 that can create all-snap images (and only all-snap images). |
|
And once we have u-d-f in 16.04 with all-snap support the integration-tests can be updated to all-snap images too. |
chipaca
reviewed
Jan 5, 2016
| + Type pkg.Type | ||
| +} | ||
| + | ||
| +// SnapInfoPackageYaml implements the meta/snap.yaml data |
|
|
|
For the record, we discussed this online and @mvo5 is working on some changes right now. |
mvo5
added some commits
Jan 6, 2016
|
The branch is updated now based on the feedback from @niemeyer (thanks!). Its a bit long unfortunately mostly due to the renames. Feedback (very) welcome. |
niemeyer
reviewed
Jan 6, 2016
| +} | ||
| + | ||
| +// Backend implements a specific snap format | ||
| +type Backend struct { |
niemeyer
Jan 6, 2016
Contributor
Looks like this should be private for now. I'd also take the chance we have a good term for it after "file format" (e.g. "snapFormat" and "RegisterFormat", or something similar of your liking) and reserve the generic "backend" wildcard term for something else.
niemeyer
reviewed
Jan 6, 2016
| +) | ||
| + | ||
| +// NewFromPackageYaml creates a new info based on the given packageYaml | ||
| +func NewFromPackageYaml(yamlData []byte) (*Info, error) { |
niemeyer
Jan 6, 2016
Contributor
This should probably be snap.InfoFromPackageYaml now that it sits under the snap package (it's not a "new snap").
|
Just a couple of trivials now.. really like the outcome, though! LGTM |
|
This changed enough that would be good for @chipaca to have another look. |
chipaca
reviewed
Jan 6, 2016
| @@ -48,6 +49,12 @@ var ( | ||
| ErrMemberNotFound = errors.New("member not found") | ||
| ) | ||
| +func init() { | ||
| + snap.RegisterBackend([]byte("!<arch>\ndebian"), func(path string) (snap.File, error) { | ||
| + return Open(path) |
chipaca
reviewed
Jan 6, 2016
| @@ -1,7 +1,7 @@ | ||
| // -*- Mode: Go; indent-tabs-mode: t -*- | ||
| /* | ||
| - * Copyright (C) 2014-2015 Canonical Ltd | ||
| + * Copyyright (C) 2014-2015 Canonical Ltd |
|
|
mvo5 commentedDec 22, 2015
This branch is motivated by the need to have the "type" of a snap available in ubuntu-device-flash so that I can infer if its a kernel or an OS snap. When those are detected u-d-f needs to setup the boot variables accordingly.
It also moves pkg.File:Open into its own package to avoid circular dependencies. If you prefer that in a separate branch I can do that.
I think this change has some potential and we could use it as a start to get packageYaml out of the main "snappy" package.