Merge lp:~sergiusens/snappy/storeManifest into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Sergio Schvezov
Status: Merged
Approved by: John Lenton
Approved revision: 534
Merged at revision: 537
Proposed branch: lp:~sergiusens/snappy/storeManifest
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Prerequisite: lp:~sergiusens/snappy/removeIcon
Diff against target: 82 lines (+28/-0)
4 files modified
snappy/dirs.go (+2/-0)
snappy/parts.go (+5/-0)
snappy/snapp.go (+18/-0)
snappy/snapp_test.go (+3/-0)
To merge this branch: bzr merge lp:~sergiusens/snappy/storeManifest
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
John Lenton (community) Approve
Review via email: mp+263313@code.launchpad.net

Commit message

Store store manifest data upon package install

To post a comment you must log in.
Revision history for this message
John Lenton (chipaca) wrote :

One nit.

review: Approve
lp:~sergiusens/snappy/storeManifest updated
533. By Sergio Schvezov

Merged removeIcon into storeManifest.

534. By Sergio Schvezov

Merged removeIcon into storeManifest.

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
1=== modified file 'snappy/dirs.go'
2--- snappy/dirs.go 2015-06-30 12:37:02 +0000
3+++ snappy/dirs.go 2015-06-30 12:37:02 +0000
4@@ -34,6 +34,7 @@
5 snapUdevRulesDir string
6 localeDir string
7 snapIconsDir string
8+ snapMetaDir string
9
10 snapBinariesDir string
11 snapServicesDir string
12@@ -57,6 +58,7 @@
13 snapAppArmorDir = filepath.Join(rootdir, "/var/lib/apparmor/clicks")
14 snapSeccompDir = filepath.Join(rootdir, snappyDir, "seccomp", "profiles")
15 snapIconsDir = filepath.Join(rootdir, snappyDir, "icons")
16+ snapMetaDir = filepath.Join(rootdir, snappyDir, "meta")
17
18 snapBinariesDir = filepath.Join(snapAppsDir, "bin")
19 snapServicesDir = filepath.Join(rootdir, "/etc/systemd/system")
20
21=== modified file 'snappy/parts.go'
22--- snappy/parts.go 2015-06-30 12:37:02 +0000
23+++ snappy/parts.go 2015-06-30 12:37:02 +0000
24@@ -328,3 +328,8 @@
25 // TODO: care about extension ever being different than png
26 return filepath.Join(snapIconsDir, fmt.Sprintf("%s_%s.png", QualifiedName(s), s.Version()))
27 }
28+
29+// manifestPath returns the would be path for the store manifest meta data
30+func manifestPath(s Part) string {
31+ return filepath.Join(snapMetaDir, fmt.Sprintf("%s_%s.manifest", QualifiedName(s), s.Version()))
32+}
33
34=== modified file 'snappy/snapp.go'
35--- snappy/snapp.go 2015-06-30 12:37:02 +0000
36+++ snappy/snapp.go 2015-06-30 12:37:02 +0000
37@@ -1527,6 +1527,20 @@
38 return w.Sync()
39 }
40
41+func (s *RemoteSnapPart) saveStoreManifest() error {
42+ content, err := yaml.Marshal(s.pkg)
43+ if err != nil {
44+ return err
45+ }
46+
47+ if err := os.MkdirAll(snapMetaDir, 0755); err != nil {
48+ return err
49+ }
50+
51+ // don't worry about previous contents
52+ return ioutil.WriteFile(manifestPath(s), content, 0644)
53+}
54+
55 // Install installs the snap
56 func (s *RemoteSnapPart) Install(pbar progress.Meter, flags InstallFlags) (string, error) {
57 downloadedSnap, err := s.Download(pbar)
58@@ -1539,6 +1553,10 @@
59 return "", err
60 }
61
62+ if err := s.saveStoreManifest(); err != nil {
63+ return "", err
64+ }
65+
66 return installClick(downloadedSnap, flags, pbar, s.Origin())
67 }
68
69
70=== modified file 'snappy/snapp_test.go'
71--- snappy/snapp_test.go 2015-06-30 12:37:02 +0000
72+++ snappy/snapp_test.go 2015-06-30 12:37:02 +0000
73@@ -693,6 +693,9 @@
74
75 iconPath := filepath.Join(snapIconsDir, "foo.bar_1.0.png")
76 c.Check(installed[0].Icon(), Equals, iconPath)
77+
78+ _, err = os.Stat(filepath.Join(snapMetaDir, "foo.bar_1.0.manifest"))
79+ c.Check(err, IsNil)
80 }
81
82 func (s *SnapTestSuite) TestRemoteSnapUpgradeService(c *C) {

Subscribers

People subscribed via source and target branches