many: save media info when installing, show it when listing (#6034)
Before this change, `media` wasn't part of the `/v2/snaps` nor
`/v2/snaps/<snap>` endpoints' responses.
This change:
* in `overlord/snapstate/backend`, it adds the `ExtraInfo` type,
```
// ExtraInfo is information about a snap that is not in the snap.yaml,
// not needed in the state, but may be cached to augment the
// information returned for locally-installed snaps
```
> initially, `ExtraInfo` holds just a `snap.MediaInfos`.
It also adds two methods to managerBackend:
* `SaveExtraInfo` which saves an `ExtraInfo` for a given snap, and
* `DeleteExtraInfo` which removes it
> initially these two are very simplistic, writing it out as json to
> a directory, one file per snap name.
Lastly it adds a `backend.LoadExtraInfo` which fills in the fields
of a passed-in `*snap.Info`.
* in `overlord/snapstate`, it adds `"save-extra-info"` and
`"delete-extra-info"` tasks and handlers that call the corresponding
methods in the backend. It also adds a flag for `readInfo` to call
`backend.LoadExtraInfo`, and changes `(*SnapState).CurrentInfo()`'s
`readInfo` call to use that flag.
Lots of tests tweaks here to accommodate the new tasks (bleeding
over into `hookstate`).
* in `daemon`, it updates `mapLocal` to now copy `Media`. With the
above changes, this means that the returned snaps from `/v2/snaps`
(as well as `/v2/snaps/<snap>`) now have `media` popuplated as long
as `select=all` isn't used. I thought this reasonable as a first
step (I don't even know if any `media`-using frontends use
`select=all`).
tadaah...
```json
// ...
"installed-size": 131207168,
"jailmode": false,
"media": [
{
"type": "screenshot",
"url": "https://dashboard.snapcraft.io/site_media/appmedia/2018/05/trackmania.png"
},
{
"type": "screenshot",
"url": "https://dashboard.snapcraft.io/site_media/appmedia/2018/06/tnmationsforver640x360.gif"
}
],
"mounted-from": "/var/lib/snapd/snaps/tmnationsforever_26.snap",
"name": "tmnationsforever",
// ...
```