Permalink
Browse files

Merge pull request #2573 from mvo5/bugfix/snap-info-real-channel-trac…

…king

snap: add information about tracking channel (not just actual channel)
  • Loading branch information...
2 parents 5112ff4 + 2c29f7c commit 1e17f043fba2af146c6e012c05f57d00aae90853 @mvo5 mvo5 committed on GitHub Jan 11, 2017
Showing with 65 additions and 61 deletions.
  1. +22 −21 client/packages.go
  2. +1 −1 cmd/snap/cmd_info.go
  3. +21 −19 daemon/api_test.go
  4. +21 −20 daemon/snap.go
View
@@ -30,27 +30,28 @@ import (
// Snap holds the data for a snap as obtained from snapd.
type Snap struct {
- ID string `json:"id"`
- Summary string `json:"summary"`
- Description string `json:"description"`
- DownloadSize int64 `json:"download-size"`
- Icon string `json:"icon"`
- InstalledSize int64 `json:"installed-size"`
- InstallDate time.Time `json:"install-date"`
- Name string `json:"name"`
- Developer string `json:"developer"`
- Status string `json:"status"`
- Type string `json:"type"`
- Version string `json:"version"`
- Channel string `json:"channel"`
- Revision snap.Revision `json:"revision"`
- Confinement string `json:"confinement"`
- Private bool `json:"private"`
- DevMode bool `json:"devmode"`
- JailMode bool `json:"jailmode"`
- TryMode bool `json:"trymode"`
- Apps []AppInfo `json:"apps"`
- Broken string `json:"broken"`
+ ID string `json:"id"`
+ Summary string `json:"summary"`
+ Description string `json:"description"`
+ DownloadSize int64 `json:"download-size"`
+ Icon string `json:"icon"`
+ InstalledSize int64 `json:"installed-size"`
+ InstallDate time.Time `json:"install-date"`
+ Name string `json:"name"`
+ Developer string `json:"developer"`
+ Status string `json:"status"`
+ Type string `json:"type"`
+ Version string `json:"version"`
+ Channel string `json:"channel"`
+ TrackingChannel string `json:"tracking-channel"`
+ Revision snap.Revision `json:"revision"`
+ Confinement string `json:"confinement"`
+ Private bool `json:"private"`
+ DevMode bool `json:"devmode"`
+ JailMode bool `json:"jailmode"`
+ TryMode bool `json:"trymode"`
+ Apps []AppInfo `json:"apps"`
+ Broken string `json:"broken"`
Prices map[string]float64 `json:"prices"`
Screenshots []Screenshot `json:"screenshots"`
@@ -239,7 +239,7 @@ func (x *infoCmd) Execute([]string) error {
notes = NotesFromLocal(local)
}
- fmt.Fprintf(w, "tracking:\t%s\n", local.Channel)
+ fmt.Fprintf(w, "tracking:\t%s\n", local.TrackingChannel)
fmt.Fprintf(w, "installed:\t%s\t(%s)\t%s\t%s\n", local.Version, local.Revision, strutil.SizeToStr(local.InstalledSize), notes)
fmt.Fprintf(w, "refreshed:\t%s\n", local.InstallDate)
}
View
@@ -289,6 +289,7 @@ version: %s
snapst.Active = active
snapst.Sequence = append(snapst.Sequence, &snapInfo.SideInfo)
snapst.Current = snapInfo.SideInfo.Revision
+ snapst.Channel = "beta"
snapstate.Set(st, name, &snapst)
}
@@ -343,25 +344,26 @@ func (s *apiSuite) TestSnapInfoOneIntegration(c *check.C) {
Type: ResponseTypeSync,
Status: http.StatusOK,
Result: map[string]interface{}{
- "id": "foo-id",
- "name": "foo",
- "revision": snap.R(10),
- "version": "v1",
- "channel": "stable",
- "summary": "summary",
- "description": "description",
- "developer": "bar",
- "status": "active",
- "icon": "/v2/icons/foo/icon",
- "type": string(snap.TypeApp),
- "resource": "/v2/snaps/foo",
- "private": false,
- "devmode": false,
- "jailmode": false,
- "confinement": snap.StrictConfinement,
- "trymode": false,
- "apps": []appJSON{},
- "broken": "",
+ "id": "foo-id",
+ "name": "foo",
+ "revision": snap.R(10),
+ "version": "v1",
+ "channel": "stable",
+ "tracking-channel": "beta",
+ "summary": "summary",
+ "description": "description",
+ "developer": "bar",
+ "status": "active",
+ "icon": "/v2/icons/foo/icon",
+ "type": string(snap.TypeApp),
+ "resource": "/v2/snaps/foo",
+ "private": false,
+ "devmode": false,
+ "jailmode": false,
+ "confinement": snap.StrictConfinement,
+ "trymode": false,
+ "apps": []appJSON{},
+ "broken": "",
},
Meta: meta,
}
View
@@ -183,26 +183,27 @@ func mapLocal(about aboutSnap) map[string]interface{} {
}
return map[string]interface{}{
- "description": localSnap.Description(),
- "developer": about.publisher,
- "icon": snapIcon(localSnap),
- "id": localSnap.SnapID,
- "install-date": snapDate(localSnap),
- "installed-size": localSnap.Size,
- "name": localSnap.Name(),
- "revision": localSnap.Revision,
- "status": status,
- "summary": localSnap.Summary(),
- "type": string(localSnap.Type),
- "version": localSnap.Version,
- "channel": localSnap.Channel,
- "confinement": localSnap.Confinement,
- "devmode": snapst.DevMode,
- "trymode": snapst.TryMode,
- "jailmode": snapst.JailMode,
- "private": localSnap.Private,
- "apps": apps,
- "broken": localSnap.Broken,
+ "description": localSnap.Description(),
+ "developer": about.publisher,
+ "icon": snapIcon(localSnap),
+ "id": localSnap.SnapID,
+ "install-date": snapDate(localSnap),
+ "installed-size": localSnap.Size,
+ "name": localSnap.Name(),
+ "revision": localSnap.Revision,
+ "status": status,
+ "summary": localSnap.Summary(),
+ "type": string(localSnap.Type),
+ "version": localSnap.Version,
+ "channel": localSnap.Channel,
+ "tracking-channel": snapst.Channel,
+ "confinement": localSnap.Confinement,
+ "devmode": snapst.DevMode,
+ "trymode": snapst.TryMode,
+ "jailmode": snapst.JailMode,
+ "private": localSnap.Private,
+ "apps": apps,
+ "broken": localSnap.Broken,
}
}

0 comments on commit 1e17f04

Please sign in to comment.