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

Proposed by Sergio Schvezov
Status: Merged
Approved by: John Lenton
Approved revision: 468
Merged at revision: 468
Proposed branch: lp:~sergiusens/snappy/TheOrigin
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 1832 lines (+275/-274)
25 files modified
cmd/snappy/cmd_list.go (+2/-2)
cmd/snappy/cmd_search.go (+2/-2)
docs/frameworks.md (+2/-1)
docs/package-names.md (+17/-17)
docs/security.md (+8/-8)
snappy/click.go (+26/-26)
snappy/click_test.go (+60/-60)
snappy/common_test.go (+4/-4)
snappy/config.go (+2/-2)
snappy/config_test.go (+3/-3)
snappy/datadir.go (+14/-14)
snappy/datadir_test.go (+29/-29)
snappy/errors.go (+2/-2)
snappy/install.go (+1/-1)
snappy/parts.go (+10/-10)
snappy/parts_test.go (+12/-12)
snappy/purge.go (+2/-2)
snappy/purge_test.go (+1/-1)
snappy/remove.go (+1/-1)
snappy/security.go (+2/-2)
snappy/snapp.go (+34/-34)
snappy/snapp_test.go (+26/-26)
snappy/systemimage.go (+6/-6)
snappy/systemimage_test.go (+4/-4)
systemd/systemd.go (+5/-5)
To merge this branch: bzr merge lp:~sergiusens/snappy/TheOrigin
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+259660@code.launchpad.net

Commit message

Move away from namespaces to the origins

To post a comment you must log in.
lp:~sergiusens/snappy/TheOrigin updated
467. By Sergio Schvezov

merging trunk

Revision history for this message
John Lenton (chipaca) wrote :

You missed a couple of namespaces in security.md where it's a simple s/namespace/origin/; in package-names.md it's a little bit tricker but

“As part of that effort new requirements and feature nuances for snappy namespaces could arise that snappy will work with engineering teams to realize the best solution.”

a just a substitution would do.

“(for instance it might be that touch design might deem the need to allow
co-installation and co-runnability of namespaced snap variants needed to
realize their UX/app story, but we explicitly leave that problem out for now)”

there, “namespaced snap variants” -(perhaps)-> “snaps of different origin that share a name”

“The packages will continue to be accessed in the store using their full
namespaces,”

here we're using namespaces as something different, defined in situ (and changed), and is fine but makes changing the other ones more important.

review: Needs Fixing
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

> You missed a couple of namespaces in security.md where it's a simple
> s/namespace/origin/; in package-names.md it's a little bit tricker but
>
> “As part of that effort new requirements and feature nuances for snappy
> namespaces could arise that snappy will work with engineering teams to realize
> the best solution.”
>
> a just a substitution would do.
>
> “(for instance it might be that touch design might deem the need to allow
> co-installation and co-runnability of namespaced snap variants needed to
> realize their UX/app story, but we explicitly leave that problem out for now)”
>
> there, “namespaced snap variants” -(perhaps)-> “snaps of different origin that
> share a name”
>
> “The packages will continue to be accessed in the store using their full
> namespaces,”
>
> here we're using namespaces as something different, defined in situ (and
> changed), and is fine but makes changing the other ones more important.

Right, I left these on purpose as I could find nice wording, as the reference to namespace here seemed to be confusing, sometimes talking about a namespace as package_name.origin and sometimes saying it was namespaceless, I'm glad we are moving away from this confusion.

lp:~sergiusens/snappy/TheOrigin updated
468. By Sergio Schvezov

Updating from the bad security.md merge and applying the suggestions from Chipaca to package-names.md

Revision history for this message
John Lenton (chipaca) wrote :

I approve of this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmd/snappy/cmd_list.go'
2--- cmd/snappy/cmd_list.go 2015-05-19 17:32:01 +0000
3+++ cmd/snappy/cmd_list.go 2015-05-20 20:14:40 +0000
4@@ -93,7 +93,7 @@
5 fmt.Fprintln(w, "Name\tDate\tVersion\tDeveloper\t")
6 for _, part := range installed {
7 if part.IsActive() {
8- fmt.Fprintln(w, fmt.Sprintf("%s\t%s\t%s\t%s\t", part.Name(), formatDate(part.Date()), part.Version(), part.Namespace()))
9+ fmt.Fprintln(w, fmt.Sprintf("%s\t%s\t%s\t%s\t", part.Name(), formatDate(part.Date()), part.Version(), part.Origin()))
10 }
11 }
12 w.Flush()
13@@ -116,7 +116,7 @@
14 active = "!"
15 }
16
17- fmt.Fprintln(w, fmt.Sprintf("%s%s\t%s\t%s\t%s%s\t", part.Name(), needsReboot, formatDate(part.Date()), part.Version(), part.Namespace(), active))
18+ fmt.Fprintln(w, fmt.Sprintf("%s%s\t%s\t%s\t%s%s\t", part.Name(), needsReboot, formatDate(part.Date()), part.Version(), part.Origin(), active))
19 }
20 w.Flush()
21
22
23=== modified file 'cmd/snappy/cmd_search.go'
24--- cmd/snappy/cmd_search.go 2015-05-19 17:32:01 +0000
25+++ cmd/snappy/cmd_search.go 2015-05-20 20:14:40 +0000
26@@ -71,10 +71,10 @@
27 }
28 } else {
29 for _, part := range sharedName.Parts {
30- if sharedName.IsAlias(part.Namespace()) || part.Type() == pkg.TypeFramework {
31+ if sharedName.IsAlias(part.Origin()) || part.Type() == pkg.TypeFramework {
32 fmt.Fprintln(w, fmt.Sprintf("%s\t%s\t%s\t", part.Name(), part.Version(), part.Description()))
33 } else {
34- fmt.Fprintln(w, fmt.Sprintf("%s.%s\t%s\t%s\t", part.Name(), part.Namespace(), part.Version(), part.Description()))
35+ fmt.Fprintln(w, fmt.Sprintf("%s.%s\t%s\t%s\t", part.Name(), part.Origin(), part.Version(), part.Description()))
36 }
37 }
38 }
39
40=== modified file 'docs/frameworks.md'
41--- docs/frameworks.md 2015-05-12 17:39:14 +0000
42+++ docs/frameworks.md 2015-05-20 20:14:40 +0000
43@@ -8,7 +8,8 @@
44 * Frameworks provide a significant benefit for many users
45 * Frameworks are delivered via snaps
46 * Frameworks can be installed on the same system without conflicts
47-* Frameworks typically will use a toplevel namespace
48+* Frameworks are unique, multiple origins for a framework are not supported for which
49+ frameworks must be referred to without an `origin`.
50 * Framework `binaries` may be used without appending the package name and
51 these binary names are governed by the framework onboarding process (below)
52 * Frameworks must not depend on other frameworks
53
54=== modified file 'docs/package-names.md'
55--- docs/package-names.md 2015-05-19 11:46:49 +0000
56+++ docs/package-names.md 2015-05-20 20:14:40 +0000
57@@ -105,26 +105,26 @@
58 You can only sideload one fork of an app, there is no switching on sideloads.
59
60 ## Touch & other GUIs
61-Snappy will provide the basic building blocks, each platform can decide how to
62-deal with it.
63-The store will guarantee the uniqueness of a package name and origin
64-combination, Snappy will allow packages with the same name to be co-installed
65-but will not be co-runnable.
66-How UIs will be mapped to the primitives described in this document is not yet
67-defined. As part of that effort new requirements and feature nuances for
68-snappy namespaces could arise that snappy will work with engineering teams to
69-realize the best solution.
70-(for instance it might be that touch design might deem the need to allow
71-co-installation and co-runnability of namespaced snap variants needed to
72-realize their UX/app story, but we explicitly leave that problem out for now).
73+Snappy will provide the basic building blocks, each platform can decide how to
74+deal with it. The store will guarantee the uniqueness of a package name and
75+origin combination, Snappy will allow packages with the same name to be
76+co-installed but will not be co-runnable.
77+
78+How UIs will be mapped to the primitives described in this document is not yet
79+defined. As part of that effort new requirements and feature nuances for snappy
80+package origins could arise that snappy will work with engineering teams to
81+realize the best solution. (for instance it might be that touch design might
82+deem the need to allow co-installation and co-runnability of snappy packages of
83+different origin to realize their UX/app story, but we explicitly leave that
84+problem out for now).
85
86 ## Implementation details
87 The packages will continue to be accessed in the store using their full
88-namespaces (`/api/v1/vim.beuno`)
89-On install, Snappy will ask you to choose which vim to use on runtime
90-if you have more than one (defaults to what you are installing)
91-There will have to be a (secure) way of persisting the user’s selection
92-of which vim is active
93+namespaces, which would be composed from the `package name` and the `origin`
94+(`/api/v1/vim.beuno`) On install, Snappy will ask you to choose which vim to
95+use on runtime if you have more than one (defaults to what you are installing)
96+There will have to be a (secure) way of persisting the user’s selection of
97+which vim is active
98
99 ## Ecosystem details
100 Package names will now mean a specific piece of software. We will have to make
101
102=== modified file 'docs/security.md'
103--- docs/security.md 2015-05-19 11:46:49 +0000
104+++ docs/security.md 2015-05-20 20:14:40 +0000
105@@ -16,10 +16,10 @@
106
107 Applications are tracked by the system by using the concept of an
108 ApplicationId. The `APP_ID is` the composition of the package name, the app's
109-origin namespace from the store (if applicable-- only snaps of `type: app` (the
110-default) have an origin namespace as part of their `APP_ID`), the
111+origin from the store if applicable -- only snaps of `type: app` (the
112+default) use an origin to compose the `APP_ID`), the
113 service/binary name and package version. The `APP_ID` takes the form of
114-`<pkgname>.<namespace>_<appname>_<version>`. For example, if this is in
115+`<pkgname>.<origin>_<appname>_<version>`. For example, if this is in
116 `package.yaml`:
117
118 name: foo
119@@ -29,7 +29,7 @@
120 - name: bar
121 start: bin/bar
122
123-and the app was uploaded to the `myorigin` namespace in the store, then the
124+and the app was uploaded to the `myorigin` origin in the store, then the
125 `APP_ID` for the `bar` service is `foo.myorigin_bar_0.1`. The `APP_ID` is used
126 throughout the system including in the enforcement of security policy by the
127 app launcher.
128@@ -129,7 +129,7 @@
129 - name: cli-exe
130 caps: []
131
132-If this package is uploaded to the store in the `myorigin` namespace, then:
133+If this package is uploaded to the store in the `myorigin` origin, then:
134
135 * `APP_ID` for `bar` is `foo.myorigin_bar_1.0`. It uses the `default` template
136 and `network-client` (default) cap
137@@ -211,9 +211,9 @@
138 socket says that app is ok).
139 * `names`: (optional) list of abstract socket names
140 (`<name>_<binaryname>` is prepended)
141- * `allowed-clients`: `<name>.<namespace>` or
142- `<name>.<namespace>_<binaryname>` (ie, omit version and
143- `binaryname` to allow all from snap `<name>.<namespace>` or omit
144+ * `allowed-clients`: `<name>.<origin>` or
145+ `<name>.<origin>_<binaryname>` (ie, omit version and
146+ `binaryname` to allow all from snap `<name>.<origin>` or omit
147 version to allow only `binaryname` from snap `<name>`)
148
149 Eg:
150
151=== modified file 'snappy/click.go'
152--- snappy/click.go 2015-05-20 09:49:34 +0000
153+++ snappy/click.go 2015-05-20 20:14:40 +0000
154@@ -181,7 +181,7 @@
155
156 // iterHooks will run the callback "f" for the given manifest
157 // so that the call back can arrange e.g. a new link
158-func iterHooks(m *packageYaml, namespace string, inhibitHooks bool, f iterHooksFunc) error {
159+func iterHooks(m *packageYaml, origin string, inhibitHooks bool, f iterHooksFunc) error {
160 systemHooks, err := systemClickHooks()
161 if err != nil {
162 return err
163@@ -202,7 +202,7 @@
164 continue
165 }
166
167- dst := filepath.Join(globalRootDir, expandHookPattern(m.qualifiedName(namespace), app, m.Version, systemHook.pattern))
168+ dst := filepath.Join(globalRootDir, expandHookPattern(m.qualifiedName(origin), app, m.Version, systemHook.pattern))
169
170 if _, err := os.Stat(dst); err == nil {
171 if err := os.Remove(dst); err != nil {
172@@ -227,8 +227,8 @@
173 return nil
174 }
175
176-func installClickHooks(targetDir string, m *packageYaml, namespace string, inhibitHooks bool) error {
177- return iterHooks(m, namespace, inhibitHooks, func(src, dst string, systemHook clickHook) error {
178+func installClickHooks(targetDir string, m *packageYaml, origin string, inhibitHooks bool) error {
179+ return iterHooks(m, origin, inhibitHooks, func(src, dst string, systemHook clickHook) error {
180 // setup the new link target here, iterHooks will take
181 // care of running the hook
182 realSrc := stripGlobalRootDir(path.Join(targetDir, src))
183@@ -240,8 +240,8 @@
184 })
185 }
186
187-func removeClickHooks(m *packageYaml, namespace string, inhibitHooks bool) (err error) {
188- return iterHooks(m, namespace, inhibitHooks, func(src, dst string, systemHook clickHook) error {
189+func removeClickHooks(m *packageYaml, origin string, inhibitHooks bool) (err error) {
190+ return iterHooks(m, origin, inhibitHooks, func(src, dst string, systemHook clickHook) error {
191 // nothing we need to do here, the iterHookss will remove
192 // the hook symlink and call the hook itself
193 return nil
194@@ -267,7 +267,7 @@
195 return err
196 }
197
198- if err := removeClickHooks(m, namespaceFromBasedir(clickDir), false); err != nil {
199+ if err := removeClickHooks(m, originFromBasedir(clickDir), false); err != nil {
200 return err
201 }
202
203@@ -343,7 +343,7 @@
204
205 # app info
206 export SNAP_NAME="{{.Name}}"
207-export SNAP_ORIGIN="{{.Namespace}}"
208+export SNAP_ORIGIN="{{.Origin}}"
209 export SNAP_FULLNAME="{{.UdevAppName}}"
210
211 # app paths
212@@ -367,14 +367,14 @@
213 `
214
215 // it's fine for this to error out; we might be in a framework or sth
216- namespace := namespaceFromBasedir(pkgPath)
217+ origin := originFromBasedir(pkgPath)
218
219 if err := verifyBinariesYaml(binary); err != nil {
220 return "", err
221 }
222
223 actualBinPath := binPathForBinary(pkgPath, binary)
224- udevPartName := m.qualifiedName(namespace)
225+ udevPartName := m.qualifiedName(origin)
226
227 var templateOut bytes.Buffer
228 t := template.Must(template.New("wrapper").Parse(wrapperTemplate))
229@@ -385,7 +385,7 @@
230 Path string
231 AaProfile string
232 UdevAppName string
233- Namespace string
234+ Origin string
235 }{
236 Name: m.Name,
237 Version: m.Version,
238@@ -393,7 +393,7 @@
239 Path: pkgPath,
240 AaProfile: aaProfile,
241 UdevAppName: udevPartName,
242- Namespace: namespace,
243+ Origin: origin,
244 }
245 t.Execute(&templateOut, wrapperData)
246
247@@ -452,7 +452,7 @@
248 return "", err
249 }
250
251- udevPartName := m.qualifiedName(namespaceFromBasedir(baseDir))
252+ udevPartName := m.qualifiedName(originFromBasedir(baseDir))
253
254 return systemd.New(globalRootDir, nil).GenServiceFile(
255 &systemd.ServiceDescription{
256@@ -785,17 +785,17 @@
257 Notify(status string)
258 }
259
260-// this rewrites the json manifest to include the namespace in the on-disk
261+// this rewrites the json manifest to include the origin in the on-disk
262 // manifest.json to be compatible with click again
263-func writeCompatManifestJSON(clickMetaDir string, manifestData []byte, namespace string) error {
264+func writeCompatManifestJSON(clickMetaDir string, manifestData []byte, origin string) error {
265 var cm clickManifest
266 if err := json.Unmarshal(manifestData, &cm); err != nil {
267 return err
268 }
269
270 if cm.Type != pkg.TypeFramework && cm.Type != pkg.TypeOem {
271- // add the namespace to the name
272- cm.Name = fmt.Sprintf("%s.%s", cm.Name, namespace)
273+ // add the origin to the name
274+ cm.Name = fmt.Sprintf("%s.%s", cm.Name, origin)
275 }
276
277 outStr, err := json.MarshalIndent(cm, "", " ")
278@@ -809,7 +809,7 @@
279 return nil
280 }
281
282-func installClick(snapFile string, flags InstallFlags, inter interacter, namespace string) (name string, err error) {
283+func installClick(snapFile string, flags InstallFlags, inter interacter, origin string) (name string, err error) {
284 allowUnauthenticated := (flags & AllowUnauthenticated) != 0
285 if err := auditClick(snapFile, allowUnauthenticated); err != nil {
286 return "", err
287@@ -839,7 +839,7 @@
288 return "", err
289 }
290
291- if err := m.checkForPackageInstalled(namespace); err != nil {
292+ if err := m.checkForPackageInstalled(origin); err != nil {
293 return "", err
294 }
295
296@@ -874,7 +874,7 @@
297 }
298 }
299
300- fullName := m.qualifiedName(namespace)
301+ fullName := m.qualifiedName(origin)
302 instDir := filepath.Join(targetDir, fullName, m.Version)
303 currentActiveDir, _ := filepath.EvalSymlinks(filepath.Join(instDir, "..", "current"))
304
305@@ -909,7 +909,7 @@
306 if err := os.MkdirAll(clickMetaDir, 0755); err != nil {
307 return "", err
308 }
309- if err := writeCompatManifestJSON(clickMetaDir, manifestData, namespace); err != nil {
310+ if err := writeCompatManifestJSON(clickMetaDir, manifestData, origin); err != nil {
311 return "", err
312 }
313
314@@ -978,7 +978,7 @@
315
316 // oh, one more thing: refresh the security bits
317 if !inhibitHooks {
318- part, err := NewSnapPartFromYaml(filepath.Join(instDir, "meta", "package.yaml"), namespace, m)
319+ part, err := NewSnapPartFromYaml(filepath.Join(instDir, "meta", "package.yaml"), origin, m)
320 if err != nil {
321 return "", err
322 }
323@@ -1153,7 +1153,7 @@
324 }
325 }
326
327- if err := removeClickHooks(m, namespaceFromBasedir(clickDir), inhibitHooks); err != nil {
328+ if err := removeClickHooks(m, originFromBasedir(clickDir), inhibitHooks); err != nil {
329 return err
330 }
331
332@@ -1192,7 +1192,7 @@
333 return err
334 }
335
336- namespace := namespaceFromBasedir(baseDir)
337+ origin := originFromBasedir(baseDir)
338
339 if newActiveManifest.Type == pkg.TypeFramework {
340 if err := policy.Install(m.Name, baseDir); err != nil {
341@@ -1200,9 +1200,9 @@
342 }
343 }
344
345- if err := installClickHooks(baseDir, m, namespace, inhibitHooks); err != nil {
346+ if err := installClickHooks(baseDir, m, origin, inhibitHooks); err != nil {
347 // cleanup the failed hooks
348- removeClickHooks(m, namespace, inhibitHooks)
349+ removeClickHooks(m, origin, inhibitHooks)
350 return err
351 }
352
353
354=== modified file 'snappy/click_test.go'
355--- snappy/click_test.go 2015-05-19 19:34:13 +0000
356+++ snappy/click_test.go 2015-05-20 20:14:40 +0000
357@@ -151,16 +151,16 @@
358 },
359 },
360 }
361- err := installClickHooks(instDir, m, testNamespace, false)
362+ err := installClickHooks(instDir, m, testOrigin, false)
363 c.Assert(err, IsNil)
364- p := fmt.Sprintf("%s/%s.%s_%s_%s", testSymlinkDir, m.Name, testNamespace, "app", m.Version)
365+ p := fmt.Sprintf("%s/%s.%s_%s_%s", testSymlinkDir, m.Name, testOrigin, "app", m.Version)
366 _, err = os.Stat(p)
367 c.Assert(err, IsNil)
368 symlinkTarget, err := filepath.EvalSymlinks(p)
369 c.Assert(err, IsNil)
370 c.Assert(symlinkTarget, Equals, path.Join(instDir, "path-to-systemd-file"))
371
372- p = fmt.Sprintf("%s/%s.%s_%s_%s", testSymlinkDir2, m.Name, testNamespace, "app", m.Version)
373+ p = fmt.Sprintf("%s/%s.%s_%s_%s", testSymlinkDir2, m.Name, testOrigin, "app", m.Version)
374 _, err = os.Stat(p)
375 c.Assert(err, IsNil)
376 symlinkTarget, err = filepath.EvalSymlinks(p)
377@@ -168,15 +168,15 @@
378 c.Assert(symlinkTarget, Equals, path.Join(instDir, "path-to-apparmor-file"))
379
380 // now ensure we can remove
381- err = removeClickHooks(m, testNamespace, false)
382+ err = removeClickHooks(m, testOrigin, false)
383 c.Assert(err, IsNil)
384- _, err = os.Stat(fmt.Sprintf("%s/%s.%s_%s_%s", testSymlinkDir, m.Name, testNamespace, "app", m.Version))
385+ _, err = os.Stat(fmt.Sprintf("%s/%s.%s_%s_%s", testSymlinkDir, m.Name, testOrigin, "app", m.Version))
386 c.Assert(err, NotNil)
387 }
388
389 func (s *SnapTestSuite) testLocalSnapInstall(c *C) string {
390 snapFile := makeTestSnapPackage(c, "")
391- name, err := installClick(snapFile, 0, nil, testNamespace)
392+ name, err := installClick(snapFile, 0, nil, testOrigin)
393 c.Assert(err, IsNil)
394 c.Check(name, Equals, "foo")
395
396@@ -191,11 +191,11 @@
397 c.Assert(err, IsNil)
398
399 // ensure we have the data dir
400- _, err = os.Stat(path.Join(s.tempdir, "var", "lib", "apps", "foo."+testNamespace, "1.0"))
401+ _, err = os.Stat(path.Join(s.tempdir, "var", "lib", "apps", "foo."+testOrigin, "1.0"))
402 c.Assert(err, IsNil)
403
404 // ensure we have the hashes
405- snap, err := NewInstalledSnapPart(filepath.Join(baseDir, "meta", "package.yaml"), testNamespace)
406+ snap, err := NewInstalledSnapPart(filepath.Join(baseDir, "meta", "package.yaml"), testOrigin)
407 c.Assert(err, IsNil)
408 c.Assert(snap.Hash(), Not(Equals), "")
409
410@@ -209,7 +209,7 @@
411 func (s *SnapTestSuite) TestLocalSnapInstallFailsAlreadyInstalled(c *C) {
412 snapFile := s.testLocalSnapInstall(c)
413
414- _, err := installClick(snapFile, 0, nil, "namespaceother")
415+ _, err := installClick(snapFile, 0, nil, "originother")
416 c.Assert(err, Equals, ErrPackageNameAlreadyInstalled)
417 }
418
419@@ -219,7 +219,7 @@
420 defer func() { clickdeb.VerifyCmd = old }()
421
422 snapFile := makeTestSnapPackage(c, "")
423- _, err := installClick(snapFile, 0, nil, testNamespace)
424+ _, err := installClick(snapFile, 0, nil, testOrigin)
425 c.Assert(err, NotNil)
426
427 contentFile := path.Join(s.tempdir, "apps", fooComposedName, "1.0", "bin", "foo")
428@@ -238,11 +238,11 @@
429 defer func() { clickdeb.VerifyCmd = old }()
430
431 snapFile := makeTestSnapPackage(c, "")
432- name, err := installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
433+ name, err := installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
434 c.Assert(err, IsNil)
435 c.Check(name, Equals, "foo")
436
437- _, err = installClick(snapFile, 0, nil, testNamespace)
438+ _, err = installClick(snapFile, 0, nil, testOrigin)
439 c.Assert(err, NotNil)
440 }
441
442@@ -263,7 +263,7 @@
443 // install fails
444 func (s *SnapTestSuite) TestLocalSnapInstallMissingAccepterFails(c *C) {
445 pkg := makeTestSnapPackage(c, "explicit-license-agreement: Y")
446- _, err := installClick(pkg, 0, nil, testNamespace)
447+ _, err := installClick(pkg, 0, nil, testOrigin)
448 c.Check(err, Equals, ErrLicenseNotAccepted)
449 }
450
451@@ -271,7 +271,7 @@
452 // Agreed returns false, install fails
453 func (s *SnapTestSuite) TestLocalSnapInstallNegAccepterFails(c *C) {
454 pkg := makeTestSnapPackage(c, "explicit-license-agreement: Y")
455- _, err := installClick(pkg, 0, &agreerator{y: false}, testNamespace)
456+ _, err := installClick(pkg, 0, &agreerator{y: false}, testOrigin)
457 c.Check(err, Equals, ErrLicenseNotAccepted)
458 }
459
460@@ -282,7 +282,7 @@
461 defer func() { licenseChecker = checkLicenseExists }()
462
463 pkg := makeTestSnapPackageFull(c, "explicit-license-agreement: Y", false)
464- _, err := installClick(pkg, 0, &agreerator{y: true}, testNamespace)
465+ _, err := installClick(pkg, 0, &agreerator{y: true}, testOrigin)
466 c.Check(err, Equals, ErrLicenseNotProvided)
467 }
468
469@@ -290,7 +290,7 @@
470 // Agreed returns true, install succeeds
471 func (s *SnapTestSuite) TestLocalSnapInstallPosAccepterWorks(c *C) {
472 pkg := makeTestSnapPackage(c, "explicit-license-agreement: Y")
473- _, err := installClick(pkg, 0, &agreerator{y: true}, testNamespace)
474+ _, err := installClick(pkg, 0, &agreerator{y: true}, testOrigin)
475 c.Check(err, Equals, nil)
476 }
477
478@@ -298,7 +298,7 @@
479 func (s *SnapTestSuite) TestLocalSnapInstallAccepterReasonable(c *C) {
480 pkg := makeTestSnapPackage(c, "name: foobar\nexplicit-license-agreement: Y")
481 ag := &agreerator{y: true}
482- _, err := installClick(pkg, 0, ag, testNamespace)
483+ _, err := installClick(pkg, 0, ag, testOrigin)
484 c.Assert(err, Equals, nil)
485 c.Check(ag.intro, Matches, ".*foobar.*requires.*license.*")
486 c.Check(ag.license, Equals, "WTFPL")
487@@ -312,11 +312,11 @@
488 yamlFile, err := makeInstalledMockSnap(s.tempdir, yaml+"version: 1")
489 pkgdir := filepath.Dir(filepath.Dir(yamlFile))
490 c.Assert(os.MkdirAll(filepath.Join(pkgdir, ".click", "info"), 0755), IsNil)
491- c.Assert(ioutil.WriteFile(filepath.Join(pkgdir, ".click", "info", "foox."+testNamespace+".manifest"), []byte(`{"name": "foox"}`), 0644), IsNil)
492+ c.Assert(ioutil.WriteFile(filepath.Join(pkgdir, ".click", "info", "foox."+testOrigin+".manifest"), []byte(`{"name": "foox"}`), 0644), IsNil)
493 c.Assert(setActiveClick(pkgdir, true, ag), IsNil)
494
495 pkg := makeTestSnapPackage(c, yaml+"version: 2")
496- _, err = installClick(pkg, 0, ag, testNamespace)
497+ _, err = installClick(pkg, 0, ag, testOrigin)
498 c.Assert(err, Equals, nil)
499 c.Check(ag.intro, Equals, "")
500 c.Check(ag.license, Equals, "")
501@@ -330,11 +330,11 @@
502 yamlFile, err := makeInstalledMockSnap(s.tempdir, yaml+"version: 1")
503 pkgdir := filepath.Dir(filepath.Dir(yamlFile))
504 c.Assert(os.MkdirAll(filepath.Join(pkgdir, ".click", "info"), 0755), IsNil)
505- c.Assert(ioutil.WriteFile(filepath.Join(pkgdir, ".click", "info", "foox."+testNamespace+".manifest"), []byte(`{"name": "foox"}`), 0644), IsNil)
506+ c.Assert(ioutil.WriteFile(filepath.Join(pkgdir, ".click", "info", "foox."+testOrigin+".manifest"), []byte(`{"name": "foox"}`), 0644), IsNil)
507 c.Assert(setActiveClick(pkgdir, true, ag), IsNil)
508
509 pkg := makeTestSnapPackage(c, yaml+"version: 2\nexplicit-license-agreement: Y")
510- _, err = installClick(pkg, 0, ag, testNamespace)
511+ _, err = installClick(pkg, 0, ag, testOrigin)
512 c.Assert(err, Equals, nil)
513 c.Check(ag.license, Equals, "WTFPL")
514 }
515@@ -347,11 +347,11 @@
516 yamlFile, err := makeInstalledMockSnap(s.tempdir, yaml+"license-version: 2\nversion: 1")
517 pkgdir := filepath.Dir(filepath.Dir(yamlFile))
518 c.Assert(os.MkdirAll(filepath.Join(pkgdir, ".click", "info"), 0755), IsNil)
519- c.Assert(ioutil.WriteFile(filepath.Join(pkgdir, ".click", "info", "foox."+testNamespace+".manifest"), []byte(`{"name": "foox"}`), 0644), IsNil)
520+ c.Assert(ioutil.WriteFile(filepath.Join(pkgdir, ".click", "info", "foox."+testOrigin+".manifest"), []byte(`{"name": "foox"}`), 0644), IsNil)
521 c.Assert(setActiveClick(pkgdir, true, ag), IsNil)
522
523 pkg := makeTestSnapPackage(c, yaml+"license-version: 3\nversion: 2")
524- _, err = installClick(pkg, 0, ag, testNamespace)
525+ _, err = installClick(pkg, 0, ag, testOrigin)
526 c.Assert(err, Equals, nil)
527 c.Check(ag.license, Equals, "WTFPL")
528 }
529@@ -364,7 +364,7 @@
530 }
531
532 targetDir := path.Join(s.tempdir, "apps")
533- _, err := installClick(makeTestSnapPackage(c, ""), 0, nil, testNamespace)
534+ _, err := installClick(makeTestSnapPackage(c, ""), 0, nil, testOrigin)
535 c.Assert(err, IsNil)
536
537 instDir := path.Join(targetDir, fooComposedName, "1.0")
538@@ -415,7 +415,7 @@
539 return writeHashes(tmpdir, dataTar)
540 }), IsNil)
541
542- _, err = installClick(snapName, 0, nil, testNamespace)
543+ _, err = installClick(snapName, 0, nil, testOrigin)
544 c.Assert(err, IsNil)
545
546 return snapName
547@@ -430,7 +430,7 @@
548 // rename the policy
549 //poldir := filepath.Join(tmpdir, "meta", "framework-policy", "apparmor", "policygroups")
550
551- _, err := installClick(snapName, 0, nil, testNamespace)
552+ _, err := installClick(snapName, 0, nil, testOrigin)
553 c.Assert(err, IsNil)
554 // appdir := filepath.Join(s.tempdir, "apps", "hello.testspacethename", "1.0.1")
555 // c.Assert(removeClick(appdir, nil), IsNil)
556@@ -467,7 +467,7 @@
557 type: oem
558 icon: foo.svg
559 vendor: Foo Bar <foo@example.com>`)
560- _, err := installClick(snapFile, AllowOEM, nil, testNamespace)
561+ _, err := installClick(snapFile, AllowOEM, nil, testOrigin)
562 c.Assert(err, IsNil)
563
564 contentFile := path.Join(s.tempdir, "oem", "foo", "1.0", "bin", "foo")
565@@ -483,7 +483,7 @@
566 type: oem
567 icon: foo.svg
568 vendor: Foo Bar <foo@example.com>`)
569- _, err := installClick(snapFile, AllowOEM, nil, testNamespace)
570+ _, err := installClick(snapFile, AllowOEM, nil, testOrigin)
571 c.Assert(err, IsNil)
572
573 contentFile := path.Join(s.tempdir, "oem", "foo", "1.0", "bin", "foo")
574@@ -498,12 +498,12 @@
575 type: oem
576 icon: foo.svg
577 vendor: Foo Bar <foo@example.com>`)
578- _, err = installClick(snapFile, 0, nil, testNamespace)
579+ _, err = installClick(snapFile, 0, nil, testOrigin)
580 c.Check(err, IsNil)
581
582- // different namespace, this shows we have no namespace support at this
583+ // different origin, this shows we have no origin support at this
584 // level, but sideloading also works.
585- _, err = installClick(snapFile, 0, nil, sideloadedNamespace)
586+ _, err = installClick(snapFile, 0, nil, sideloadedOrigin)
587 c.Check(err, IsNil)
588
589 // a package name fork, IOW, a different OEM package.
590@@ -512,11 +512,11 @@
591 type: oem
592 icon: foo.svg
593 vendor: Foo Bar <foo@example.com>`)
594- _, err = installClick(snapFile, 0, nil, testNamespace)
595+ _, err = installClick(snapFile, 0, nil, testOrigin)
596 c.Check(err, Equals, ErrOEMPackageInstall)
597
598 // this will cause chaos, but let's test if it works
599- _, err = installClick(snapFile, AllowOEM, nil, testNamespace)
600+ _, err = installClick(snapFile, AllowOEM, nil, testOrigin)
601 c.Check(err, IsNil)
602 }
603
604@@ -526,11 +526,11 @@
605 vendor: Foo Bar <foo@example.com>
606 `
607 snapFile := makeTestSnapPackage(c, packageYaml+"version: 1.0")
608- _, err := installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
609+ _, err := installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
610 c.Assert(err, IsNil)
611
612 snapFile = makeTestSnapPackage(c, packageYaml+"version: 2.0")
613- _, err = installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
614+ _, err = installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
615 c.Assert(err, IsNil)
616
617 // ensure v2 is active
618@@ -557,7 +557,7 @@
619 func (s *SnapTestSuite) TestClickCopyData(c *C) {
620 snapDataHomeGlob = filepath.Join(s.tempdir, "home", "*", "apps")
621 homeDir := filepath.Join(s.tempdir, "home", "user1", "apps")
622- appDir := "foo." + testNamespace
623+ appDir := "foo." + testOrigin
624 homeData := filepath.Join(homeDir, appDir, "1.0")
625 err := helpers.EnsureDir(homeData, 0755)
626 c.Assert(err, IsNil)
627@@ -569,7 +569,7 @@
628 canaryData := []byte("ni ni ni")
629
630 snapFile := makeTestSnapPackage(c, packageYaml+"version: 1.0")
631- _, err = installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
632+ _, err = installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
633 c.Assert(err, IsNil)
634 canaryDataFile := filepath.Join(snapDataDir, appDir, "1.0", "canary.txt")
635 err = ioutil.WriteFile(canaryDataFile, canaryData, 0644)
636@@ -578,7 +578,7 @@
637 c.Assert(err, IsNil)
638
639 snapFile = makeTestSnapPackage(c, packageYaml+"version: 2.0")
640- _, err = installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
641+ _, err = installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
642 c.Assert(err, IsNil)
643 newCanaryDataFile := filepath.Join(snapDataDir, appDir, "2.0", "canary.txt")
644 content, err := ioutil.ReadFile(newCanaryDataFile)
645@@ -601,16 +601,16 @@
646 icon: foo.svg
647 vendor: Foo Bar <foo@example.com>
648 `
649- appDir := "foo." + testNamespace
650+ appDir := "foo." + testOrigin
651 snapFile := makeTestSnapPackage(c, packageYaml+"version: 1.0")
652- _, err := installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
653+ _, err := installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
654 c.Assert(err, IsNil)
655 canaryDataFile := filepath.Join(snapDataDir, appDir, "1.0", "canary.txt")
656 err = ioutil.WriteFile(canaryDataFile, []byte(""), 0644)
657 c.Assert(err, IsNil)
658
659 snapFile = makeTestSnapPackage(c, packageYaml+"version: 2.0")
660- _, err = installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
661+ _, err = installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
662 c.Assert(err, IsNil)
663 _, err = os.Stat(filepath.Join(snapDataDir, appDir, "2.0", "canary.txt"))
664 c.Assert(err, IsNil)
665@@ -636,17 +636,17 @@
666 app:
667 tracehook: meta/package.yaml
668 `
669- appDir := "bar." + testNamespace
670+ appDir := "bar." + testOrigin
671 // install 1.0 and then upgrade to 2.0
672 snapFile := makeTestSnapPackage(c, packageYaml+"version: 1.0")
673- _, err := installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
674+ _, err := installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
675 c.Assert(err, IsNil)
676 canaryDataFile := filepath.Join(snapDataDir, appDir, "1.0", "canary.txt")
677 err = ioutil.WriteFile(canaryDataFile, []byte(""), 0644)
678 c.Assert(err, IsNil)
679
680 snapFile = makeTestSnapPackage(c, packageYaml+"version: 2.0")
681- _, err = installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
682+ _, err = installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
683 c.Assert(err, IsNil)
684 _, err = os.Stat(filepath.Join(snapDataDir, appDir, "2.0", "canary.txt"))
685 c.Assert(err, IsNil)
686@@ -657,7 +657,7 @@
687 c.Assert(err, IsNil)
688 // Forcefully in one line to avoid issues with hidden spaces,
689 // it is visually obvious in this form.
690- hookRun := fmt.Sprintf("now: ./bar.%s_app_1.0.tracehook\nnow: \nnow: ./bar.%s_app_2.0.tracehook\n", testNamespace, testNamespace)
691+ hookRun := fmt.Sprintf("now: ./bar.%s_app_1.0.tracehook\nnow: \nnow: ./bar.%s_app_2.0.tracehook\n", testOrigin, testOrigin)
692 c.Assert(string(content), Equals, hookRun)
693 }
694
695@@ -670,7 +670,7 @@
696 hookContent := fmt.Sprintf(`Hook-Name: hooky
697 User: root
698 Exec: if test -e %s/bar.%s_app_2.0.hooky; then echo "this log message is harmless and can be ignored"; false; fi
699-Pattern: /${id}.hooky`, s.tempdir, testNamespace)
700+Pattern: /${id}.hooky`, s.tempdir, testOrigin)
701 makeClickHook(c, hookContent)
702
703 packageYaml := `name: bar
704@@ -681,17 +681,17 @@
705 hooky: meta/package.yaml
706 `
707
708- appDir := "bar." + testNamespace
709+ appDir := "bar." + testOrigin
710 // install 1.0 and then upgrade to 2.0
711 snapFile := makeTestSnapPackage(c, packageYaml+"version: 1.0")
712- _, err := installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
713+ _, err := installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
714 c.Assert(err, IsNil)
715 canaryDataFile := filepath.Join(snapDataDir, appDir, "1.0", "canary.txt")
716 err = ioutil.WriteFile(canaryDataFile, []byte(""), 0644)
717 c.Assert(err, IsNil)
718
719 snapFile = makeTestSnapPackage(c, packageYaml+"version: 2.0")
720- _, err = installClick(snapFile, AllowUnauthenticated, nil, testNamespace)
721+ _, err = installClick(snapFile, AllowUnauthenticated, nil, testOrigin)
722 c.Assert(err, NotNil)
723
724 // installing 2.0 will fail in the hooks,
725@@ -905,7 +905,7 @@
726 start: bin/bye
727 version: `
728 snapFile := makeTestSnapPackage(c, packageYaml+"1.0")
729- _, err = installClick(snapFile, AllowUnauthenticated, inter, testNamespace)
730+ _, err = installClick(snapFile, AllowUnauthenticated, inter, testOrigin)
731 c.Assert(err, IsNil)
732
733 c.Assert(helpers.FileExists(filepath.Join(snapServicesDir, "foo_svc1_1.0.service")), Equals, true)
734@@ -1014,7 +1014,7 @@
735 start: bin/hello
736 `
737 snapFile := makeTestSnapPackage(c, packageYaml+"version: 1.0")
738- _, err := installClick(snapFile, InhibitHooks, nil, testNamespace)
739+ _, err := installClick(snapFile, InhibitHooks, nil, testOrigin)
740 c.Assert(err, IsNil)
741
742 c.Assert(allSystemctl, HasLen, 0)
743@@ -1060,11 +1060,11 @@
744 snapFile := makeTestSnapPackage(c, packageYaml+"version: 1.0")
745
746 // install it
747- _, err := installClick(snapFile, 0, nil, testNamespace)
748+ _, err := installClick(snapFile, 0, nil, testOrigin)
749 c.Assert(err, IsNil)
750
751 // verify we have the symlink
752- c.Assert(helpers.FileExists(filepath.Join(hookSymlinkDir, fmt.Sprintf("foo.%s_app_1.0", testNamespace))), Equals, true)
753+ c.Assert(helpers.FileExists(filepath.Join(hookSymlinkDir, fmt.Sprintf("foo.%s_app_1.0", testOrigin))), Equals, true)
754 // and the hook exec was called
755 c.Assert(helpers.FileExists(filepath.Join(s.tempdir, "i-ran")), Equals, true)
756 }
757@@ -1092,11 +1092,11 @@
758 snapFile := makeTestSnapPackage(c, packageYaml+"version: 1.0")
759
760 // install it
761- _, err := installClick(snapFile, InhibitHooks, nil, testNamespace)
762+ _, err := installClick(snapFile, InhibitHooks, nil, testOrigin)
763 c.Assert(err, IsNil)
764
765 // verify we have the symlink
766- c.Assert(helpers.FileExists(filepath.Join(hookSymlinkDir, fmt.Sprintf("foo.%s_app_1.0", testNamespace))), Equals, true)
767+ c.Assert(helpers.FileExists(filepath.Join(hookSymlinkDir, fmt.Sprintf("foo.%s_app_1.0", testOrigin))), Equals, true)
768 // but the hook exec was not called
769 c.Assert(helpers.FileExists(filepath.Join(s.tempdir, "i-ran")), Equals, false)
770 }
771@@ -1120,7 +1120,7 @@
772 verbs := []string{"Start", "Stop", "StopPost"}
773 bins := []string{"hello", "goodbye", "missya"}
774 for i := range verbs {
775- expected := fmt.Sprintf("Exec%s=/usr/bin/ubuntu-core-launcher hello-app.%s %s_svc1_1.10 %s/bin/%s", verbs[i], testNamespace, helloAppComposedName, baseDirWithoutRootPrefix, bins[i])
776+ expected := fmt.Sprintf("Exec%s=/usr/bin/ubuntu-core-launcher hello-app.%s %s_svc1_1.10 %s/bin/%s", verbs[i], testOrigin, helloAppComposedName, baseDirWithoutRootPrefix, bins[i])
777 c.Check(string(content), Matches, "(?ms).*^"+regexp.QuoteMeta(expected)) // gocheck adds ^ and $ around the regexp provided
778 }
779 }
780@@ -1180,7 +1180,7 @@
781 needle := fmt.Sprintf(`
782 cd /apps/hello-app.testspacethename/1.10
783 ubuntu-core-launcher hello-app.%s hello-app.testspacethename_hello_1.10 /apps/hello-app.testspacethename/1.10/bin/hello "$@"
784-`, testNamespace)
785+`, testOrigin)
786 c.Assert(string(content), Matches, "(?ms).*"+regexp.QuoteMeta(needle)+".*")
787 }
788
789@@ -1360,7 +1360,7 @@
790 return writeHashes(tmpdir, dataTar)
791 }), IsNil)
792
793- _, err = installClick(snapName, 0, nil, testNamespace)
794+ _, err = installClick(snapName, 0, nil, testOrigin)
795 c.Assert(err, ErrorMatches, ".*binary and service both called foo.*")
796 }
797
798@@ -1372,7 +1372,7 @@
799 - missing
800 `
801 snapFile := makeTestSnapPackage(c, packageYaml)
802- _, err := installClick(snapFile, 0, nil, testNamespace)
803+ _, err := installClick(snapFile, 0, nil, testOrigin)
804 c.Assert(err, ErrorMatches, `.*missing framework.*`)
805 }
806
807@@ -1399,7 +1399,7 @@
808 return s
809 }
810
811- err := installClickHooks(c.MkDir(), m, testNamespace, false)
812+ err := installClickHooks(c.MkDir(), m, testOrigin, false)
813 c.Assert(err, IsNil)
814 c.Assert(stripGlobalRootDirWasCalled, Equals, true)
815 }
816
817=== modified file 'snappy/common_test.go'
818--- snappy/common_test.go 2015-05-19 17:32:01 +0000
819+++ snappy/common_test.go 2015-05-20 20:14:40 +0000
820@@ -35,7 +35,7 @@
821 )
822
823 const (
824- testNamespace = "testspacethename"
825+ testOrigin = "testspacethename"
826 fooComposedName = "foo.testspacethename"
827 helloAppComposedName = "hello-app.testspacethename"
828 )
829@@ -64,7 +64,7 @@
830 return "", err
831 }
832
833- dirName := fmt.Sprintf("%s.%s", m.Name, testNamespace)
834+ dirName := fmt.Sprintf("%s.%s", m.Name, testOrigin)
835 metaDir := filepath.Join(tempdir, "apps", dirName, m.Version, "meta")
836 if err := os.MkdirAll(metaDir, 0775); err != nil {
837 return "", err
838@@ -169,12 +169,12 @@
839 }
840
841 snapFile := makeTestSnapPackage(c, packageYaml+"version: 1.0")
842- n, err := installClick(snapFile, AllowUnauthenticated|AllowOEM, inter, testNamespace)
843+ n, err := installClick(snapFile, AllowUnauthenticated|AllowOEM, inter, testOrigin)
844 c.Assert(err, IsNil)
845 c.Assert(n, Equals, "foo")
846
847 snapFile = makeTestSnapPackage(c, packageYaml+"version: 2.0")
848- n, err = installClick(snapFile, AllowUnauthenticated|AllowOEM, inter, testNamespace)
849+ n, err = installClick(snapFile, AllowUnauthenticated|AllowOEM, inter, testOrigin)
850 c.Assert(err, IsNil)
851 c.Assert(n, Equals, "foo")
852
853
854=== modified file 'snappy/config.go'
855--- snappy/config.go 2015-05-20 09:49:34 +0000
856+++ snappy/config.go 2015-05-20 20:14:40 +0000
857@@ -36,13 +36,13 @@
858 // This string can be empty.
859 //
860 // It returns the newConfig or an error
861-func snapConfig(snapDir, namespace, rawConfig string) (newConfig string, err error) {
862+func snapConfig(snapDir, origin, rawConfig string) (newConfig string, err error) {
863 configScript := filepath.Join(snapDir, "meta", "hooks", "config")
864 if _, err := os.Stat(configScript); err != nil {
865 return "", ErrConfigNotFound
866 }
867
868- part, err := NewInstalledSnapPart(filepath.Join(snapDir, "meta", "package.yaml"), namespace)
869+ part, err := NewInstalledSnapPart(filepath.Join(snapDir, "meta", "package.yaml"), origin)
870 if err != nil {
871 return "", ErrPackageNotFound
872 }
873
874=== modified file 'snappy/config_test.go'
875--- snappy/config_test.go 2015-05-15 13:33:27 +0000
876+++ snappy/config_test.go 2015-05-20 20:14:40 +0000
877@@ -100,19 +100,19 @@
878 type: framework
879 version: 42`)
880 c.Assert(err, IsNil)
881- _, err = snapConfig(snapDir, testNamespace, configYaml)
882+ _, err = snapConfig(snapDir, testOrigin, configYaml)
883 c.Assert(err, IsNil)
884
885 snapDir, err = s.makeInstalledMockSnapWithConfig(c, mockConfig, `name: potato
886 type: potato
887 version: 42`)
888 c.Assert(err, IsNil)
889- _, err = snapConfig(snapDir, testNamespace, configYaml)
890+ _, err = snapConfig(snapDir, testOrigin, configYaml)
891 c.Assert(err, IsNil)
892
893 c.Check(aas, DeepEquals, []string{
894 "fmk_snappy-config_42",
895- "potato." + testNamespace + "_snappy-config_42",
896+ "potato." + testOrigin + "_snappy-config_42",
897 })
898 }
899
900
901=== modified file 'snappy/datadir.go'
902--- snappy/datadir.go 2015-05-20 09:49:34 +0000
903+++ snappy/datadir.go 2015-05-20 20:14:40 +0000
904@@ -26,16 +26,16 @@
905
906 // A SnapDataDir represents a single data directory for a version of a package
907 type SnapDataDir struct {
908- Base string
909- Name string
910- Namespace string
911- Version string
912+ Base string
913+ Name string
914+ Origin string
915+ Version string
916 }
917
918 // QualifiedName returns the filesystem directory name for this SnapDataDir
919 func (dd SnapDataDir) QualifiedName() string {
920- if dd.Namespace != "" {
921- return dd.Name + "." + dd.Namespace
922+ if dd.Origin != "" {
923+ return dd.Name + "." + dd.Origin
924 }
925 return dd.Name
926 }
927@@ -67,7 +67,7 @@
928
929 // “but, Chipaca”, I hear you say, “why are you doing all this all over
930 // again, when you could just use .Installed() on an appropriate repo,
931- // and getNamespaceFromYaml and all the other lovely tools we already
932+ // and getOriginFromYaml and all the other lovely tools we already
933 // have written?”
934 // To which I can only say: DataDirs finds all the data dirs on the
935 // system, not just those of packages that are installed. If you've
936@@ -76,13 +76,13 @@
937 for _, dir := range dirs {
938 version := filepath.Base(dir)
939 name := filepath.Base(filepath.Dir(dir))
940- namespace := ""
941+ origin := ""
942 idx := strings.LastIndexAny(name, ".")
943 if idx > -1 {
944- namespace = name[idx+1:]
945+ origin = name[idx+1:]
946 name = name[:idx]
947 }
948- if filterns && specns != namespace {
949+ if filterns && specns != origin {
950 continue
951 }
952 if spec != "" && spec != name {
953@@ -90,10 +90,10 @@
954 }
955
956 snaps = append(snaps, SnapDataDir{
957- Base: basedir,
958- Name: name,
959- Namespace: namespace,
960- Version: version,
961+ Base: basedir,
962+ Name: name,
963+ Origin: origin,
964+ Version: version,
965 })
966 }
967
968
969=== modified file 'snappy/datadir_test.go'
970--- snappy/datadir_test.go 2015-05-20 09:49:34 +0000
971+++ snappy/datadir_test.go 2015-05-20 20:14:40 +0000
972@@ -39,10 +39,10 @@
973 c.Assert(os.MkdirAll(filepath.Join(snapDataDir, "foo.bar", "v1"), 0755), IsNil)
974 dds := DataDirs("foo")
975 c.Check(dds, DeepEquals, []SnapDataDir{{
976- Base: snapDataDir,
977- Name: "foo",
978- Namespace: "bar",
979- Version: "v1",
980+ Base: snapDataDir,
981+ Name: "foo",
982+ Origin: "bar",
983+ Version: "v1",
984 }})
985 c.Check(DataDirs("f"), HasLen, 0)
986 c.Check(DataDirs("foobar"), HasLen, 0)
987@@ -55,10 +55,10 @@
988 c.Assert(os.MkdirAll(filepath.Join(snapDataDir, "foo", "v1"), 0755), IsNil)
989 dds := DataDirs("foo")
990 c.Check(dds, DeepEquals, []SnapDataDir{{
991- Base: snapDataDir,
992- Name: "foo",
993- Namespace: "",
994- Version: "v1",
995+ Base: snapDataDir,
996+ Name: "foo",
997+ Origin: "",
998+ Version: "v1",
999 }})
1000 c.Check(DataDirs("foo=v1"), HasLen, 1)
1001 }
1002@@ -68,10 +68,10 @@
1003 c.Assert(os.MkdirAll(filepath.Join(home, "foo.bar", "v1"), 0755), IsNil)
1004 dds := DataDirs("foo")
1005 c.Check(dds, DeepEquals, []SnapDataDir{{
1006- Base: snapDataHomeGlob,
1007- Name: "foo",
1008- Namespace: "bar",
1009- Version: "v1",
1010+ Base: snapDataHomeGlob,
1011+ Name: "foo",
1012+ Origin: "bar",
1013+ Version: "v1",
1014 }})
1015 }
1016
1017@@ -90,32 +90,32 @@
1018 hi = 2
1019 }
1020 c.Check(dds[hi], DeepEquals, SnapDataDir{
1021- Base: snapDataHomeGlob,
1022- Name: "foo",
1023- Namespace: "bar",
1024- Version: "v0",
1025+ Base: snapDataHomeGlob,
1026+ Name: "foo",
1027+ Origin: "bar",
1028+ Version: "v0",
1029 })
1030 c.Check(dds[hi+1], DeepEquals, SnapDataDir{
1031- Base: snapDataHomeGlob,
1032- Name: "foo",
1033- Namespace: "bar",
1034- Version: "v1",
1035+ Base: snapDataHomeGlob,
1036+ Name: "foo",
1037+ Origin: "bar",
1038+ Version: "v1",
1039 })
1040 c.Check(dds[si], DeepEquals, SnapDataDir{
1041- Base: snapDataDir,
1042- Name: "foo",
1043- Namespace: "",
1044- Version: "v3",
1045+ Base: snapDataDir,
1046+ Name: "foo",
1047+ Origin: "",
1048+ Version: "v3",
1049 })
1050 c.Check(dds[si+1], DeepEquals, SnapDataDir{
1051- Base: snapDataDir,
1052- Name: "foo",
1053- Namespace: "xyzzy",
1054- Version: "v1",
1055+ Base: snapDataDir,
1056+ Name: "foo",
1057+ Origin: "xyzzy",
1058+ Version: "v1",
1059 })
1060 }
1061
1062 func (s *DataDirSuite) TestDataDirQualifiedName(c *C) {
1063- c.Check(SnapDataDir{Name: "foo", Namespace: "bar"}.QualifiedName(), Equals, "foo.bar")
1064+ c.Check(SnapDataDir{Name: "foo", Origin: "bar"}.QualifiedName(), Equals, "foo.bar")
1065 c.Check(SnapDataDir{Name: "foo"}.QualifiedName(), Equals, "foo")
1066 }
1067
1068=== modified file 'snappy/errors.go'
1069--- snappy/errors.go 2015-05-19 17:32:01 +0000
1070+++ snappy/errors.go 2015-05-20 20:14:40 +0000
1071@@ -134,8 +134,8 @@
1072 ErrSideLoaded = errors.New("cannot update system that uses custom enablement")
1073
1074 // ErrPackageNameNotSupported is returned when installing legacy package such as those
1075- // that have namespaces in their package names.
1076- ErrPackageNameNotSupported = errors.New("package name with namespace not supported")
1077+ // that have the origin specified in their package names.
1078+ ErrPackageNameNotSupported = errors.New("package name with origin not supported")
1079
1080 // ErrInvalidPart is returned when something on the filesystem does not make sense
1081 ErrInvalidPart = errors.New("invalid package on system")
1082
1083=== modified file 'snappy/install.go'
1084--- snappy/install.go 2015-05-20 09:49:34 +0000
1085+++ snappy/install.go 2015-05-20 20:14:40 +0000
1086@@ -91,7 +91,7 @@
1087 flags |= AllowUnauthenticated
1088 }
1089
1090- return installClick(name, flags, meter, sideloadedNamespace)
1091+ return installClick(name, flags, meter, sideloadedOrigin)
1092 }
1093
1094 // check repos next
1095
1096=== modified file 'snappy/parts.go'
1097--- snappy/parts.go 2015-05-20 09:49:34 +0000
1098+++ snappy/parts.go 2015-05-20 20:14:40 +0000
1099@@ -44,12 +44,12 @@
1100 }
1101
1102 // QualifiedName of a Part is the Name, in most cases qualified with the
1103-// Namespace
1104+// Origin
1105 func QualifiedName(p Part) string {
1106 if t := p.Type(); t == pkg.TypeFramework || t == pkg.TypeOem {
1107 return p.Name()
1108 }
1109- return p.Name() + "." + p.Namespace()
1110+ return p.Name() + "." + p.Origin()
1111 }
1112
1113 // Part representation of a snappy part
1114@@ -59,7 +59,7 @@
1115 Name() string
1116 Version() string
1117 Description() string
1118- Namespace() string
1119+ Origin() string
1120 Vendor() string
1121
1122 Hash() string
1123@@ -260,11 +260,11 @@
1124 // FindSnapsByName returns all snaps with the given name in the "haystack"
1125 // slice of parts (useful for filtering)
1126 func FindSnapsByName(needle string, haystack []Part) (res []Part) {
1127- name, namespace := splitNamespace(needle)
1128- ignorens := namespace == ""
1129+ name, origin := splitOrigin(needle)
1130+ ignorens := origin == ""
1131
1132 for _, part := range haystack {
1133- if part.Name() == name && (ignorens || part.Namespace() == namespace) {
1134+ if part.Name() == name && (ignorens || part.Origin() == origin) {
1135 res = append(res, part)
1136 }
1137 }
1138@@ -272,7 +272,7 @@
1139 return res
1140 }
1141
1142-func splitNamespace(name string) (string, string) {
1143+func splitOrigin(name string) (string, string) {
1144 idx := strings.LastIndexAny(name, ".")
1145 if idx > -1 {
1146 return name[:idx], name[idx+1:]
1147@@ -284,12 +284,12 @@
1148 // FindSnapsByNameAndVersion returns the parts with the name/version in the
1149 // given slice of parts
1150 func FindSnapsByNameAndVersion(needle, version string, haystack []Part) []Part {
1151- name, namespace := splitNamespace(needle)
1152- ignorens := namespace == ""
1153+ name, origin := splitOrigin(needle)
1154+ ignorens := origin == ""
1155 var found []Part
1156
1157 for _, part := range haystack {
1158- if part.Name() == name && part.Version() == version && (ignorens || part.Namespace() == namespace) {
1159+ if part.Name() == name && part.Version() == version && (ignorens || part.Origin() == origin) {
1160 found = append(found, part)
1161 }
1162 }
1163
1164=== modified file 'snappy/parts_test.go'
1165--- snappy/parts_test.go 2015-05-19 17:32:01 +0000
1166+++ snappy/parts_test.go 2015-05-20 20:14:40 +0000
1167@@ -68,7 +68,7 @@
1168 c.Assert(err, IsNil)
1169 c.Assert(parts, HasLen, 1)
1170 c.Assert(parts[0].Name(), Equals, "hello-app")
1171- c.Assert(parts[0].Namespace(), Equals, testNamespace)
1172+ c.Assert(parts[0].Origin(), Equals, testOrigin)
1173 }
1174
1175 func (s *SnapTestSuite) TestFindSnapsByNameNotAvailable(c *C) {
1176@@ -93,19 +93,19 @@
1177 c.Assert(parts[0].Name(), Equals, "hello-app")
1178 }
1179
1180-func (s *SnapTestSuite) TestFindSnapsByNameWithNamespace(c *C) {
1181+func (s *SnapTestSuite) TestFindSnapsByNameWithOrigin(c *C) {
1182 _, err := makeInstalledMockSnap(s.tempdir, "")
1183 repo := NewLocalSnapRepository(snapAppsDir)
1184 installed, err := repo.Installed()
1185 c.Assert(err, IsNil)
1186 c.Assert(installed, HasLen, 1)
1187
1188- parts := FindSnapsByName("hello-app."+testNamespace, installed)
1189+ parts := FindSnapsByName("hello-app."+testOrigin, installed)
1190 c.Assert(parts, HasLen, 1)
1191 c.Assert(parts[0].Name(), Equals, "hello-app")
1192 }
1193
1194-func (s *SnapTestSuite) TestFindSnapsByNameWithNamespaceNotThere(c *C) {
1195+func (s *SnapTestSuite) TestFindSnapsByNameWithOriginNotThere(c *C) {
1196 _, err := makeInstalledMockSnap(s.tempdir, "")
1197 repo := NewLocalSnapRepository(snapAppsDir)
1198 installed, err := repo.Installed()
1199@@ -140,13 +140,13 @@
1200 installed, err := repo.Installed()
1201 c.Assert(err, IsNil)
1202
1203- parts := FindSnapsByNameAndVersion("hello-app."+testNamespace, "1.10", installed)
1204+ parts := FindSnapsByNameAndVersion("hello-app."+testOrigin, "1.10", installed)
1205 c.Check(parts, HasLen, 1)
1206- parts = FindSnapsByNameAndVersion("bad-app."+testNamespace, "1.10", installed)
1207- c.Check(parts, HasLen, 0)
1208- parts = FindSnapsByNameAndVersion("hello-app.badNamespace", "1.10", installed)
1209- c.Check(parts, HasLen, 0)
1210- parts = FindSnapsByNameAndVersion("hello-app."+testNamespace, "2.20", installed)
1211+ parts = FindSnapsByNameAndVersion("bad-app."+testOrigin, "1.10", installed)
1212+ c.Check(parts, HasLen, 0)
1213+ parts = FindSnapsByNameAndVersion("hello-app.badOrigin", "1.10", installed)
1214+ c.Check(parts, HasLen, 0)
1215+ parts = FindSnapsByNameAndVersion("hello-app."+testOrigin, "2.20", installed)
1216 c.Check(parts, HasLen, 0)
1217
1218 parts = FindSnapsByNameAndVersion("hello-app", "1.10", installed)
1219@@ -163,9 +163,9 @@
1220 installed, err := repo.Installed()
1221 c.Assert(err, IsNil)
1222
1223- parts := FindSnapsByNameAndVersion("fmk."+testNamespace, "1", installed)
1224+ parts := FindSnapsByNameAndVersion("fmk."+testOrigin, "1", installed)
1225 c.Check(parts, HasLen, 0)
1226- parts = FindSnapsByNameAndVersion("fmk.badNamespace", "1", installed)
1227+ parts = FindSnapsByNameAndVersion("fmk.badOrigin", "1", installed)
1228 c.Check(parts, HasLen, 0)
1229
1230 parts = FindSnapsByNameAndVersion("fmk", "1", installed)
1231
1232=== modified file 'snappy/purge.go'
1233--- snappy/purge.go 2015-05-20 09:49:34 +0000
1234+++ snappy/purge.go 2015-05-20 20:14:40 +0000
1235@@ -37,7 +37,7 @@
1236
1237 var remove = removeSnapData
1238
1239-// Purge a part by a partSpec string, name[.namespace][=version]
1240+// Purge a part by a partSpec string, name[.origin][=version]
1241 func Purge(partSpec string, flags PurgeFlags, meter progress.Meter) error {
1242 var e error
1243 datadirs := DataDirs(partSpec)
1244@@ -51,7 +51,7 @@
1245
1246 for _, datadir := range datadirs {
1247 yamlPath := filepath.Join(snapAppsDir, datadir.QualifiedName(), datadir.Version, "meta", "package.yaml")
1248- part, err := NewInstalledSnapPart(yamlPath, datadir.Namespace)
1249+ part, err := NewInstalledSnapPart(yamlPath, datadir.Origin)
1250 if err != nil {
1251 // no such part installed
1252 continue
1253
1254=== modified file 'snappy/purge_test.go'
1255--- snappy/purge_test.go 2015-05-15 13:33:27 +0000
1256+++ snappy/purge_test.go 2015-05-20 20:14:40 +0000
1257@@ -70,7 +70,7 @@
1258 default:
1259 panic("dunno what to do with args")
1260 }
1261- app := "hello-app." + testNamespace
1262+ app := "hello-app." + testOrigin
1263 yaml := "name: hello-app\nversion: " + version + "\n" + extra
1264 yamlFile, err := makeInstalledMockSnap(s.tempdir, yaml)
1265 c.Assert(err, IsNil)
1266
1267=== modified file 'snappy/remove.go'
1268--- snappy/remove.go 2015-05-19 14:09:19 +0000
1269+++ snappy/remove.go 2015-05-20 20:14:40 +0000
1270@@ -34,7 +34,7 @@
1271 DoRemoveGC RemoveFlags = 1 << iota
1272 )
1273
1274-// Remove a part by a partSpec string, name[.namespace][=version]
1275+// Remove a part by a partSpec string, name[.origin][=version]
1276 func Remove(partSpec string, flags RemoveFlags, meter progress.Meter) error {
1277 var parts BySnapVersion
1278
1279
1280=== modified file 'snappy/security.go'
1281--- snappy/security.go 2015-05-19 17:32:01 +0000
1282+++ snappy/security.go 2015-05-20 20:14:40 +0000
1283@@ -136,9 +136,9 @@
1284 return fmt.Sprintf("%s_%s_%s", m.Name, cleanedName, m.Version), nil
1285 }
1286
1287- namespace, err := namespaceFromYamlPath(filepath.Join(baseDir, "meta", "package.yaml"))
1288+ origin, err := originFromYamlPath(filepath.Join(baseDir, "meta", "package.yaml"))
1289
1290- return fmt.Sprintf("%s.%s_%s_%s", m.Name, namespace, cleanedName, m.Version), err
1291+ return fmt.Sprintf("%s.%s_%s_%s", m.Name, origin, cleanedName, m.Version), err
1292 }
1293
1294 var runScFilterGen = runScFilterGenImpl
1295
1296=== modified file 'snappy/snapp.go'
1297--- snappy/snapp.go 2015-05-20 09:49:34 +0000
1298+++ snappy/snapp.go 2015-05-20 20:14:40 +0000
1299@@ -49,8 +49,8 @@
1300 )
1301
1302 const (
1303- // the namespace for sideloaded snaps
1304- sideloadedNamespace = "sideload"
1305+ // the origin for sideloaded snaps
1306+ sideloadedOrigin = "sideload"
1307 )
1308
1309 // SharedName is a structure that holds an Alias to the preferred package and
1310@@ -63,11 +63,11 @@
1311 // SharedNames is a list of all packages and it's SharedName structure.
1312 type SharedNames map[string]*SharedName
1313
1314-// IsAlias determines if namespace is the one that is an alias for the
1315+// IsAlias determines if origin is the one that is an alias for the
1316 // shared name.
1317-func (f *SharedName) IsAlias(namespace string) bool {
1318+func (f *SharedName) IsAlias(origin string) bool {
1319 if alias := f.Alias; alias != nil {
1320- return alias.Namespace() == namespace
1321+ return alias.Origin() == origin
1322 }
1323
1324 return false
1325@@ -165,7 +165,7 @@
1326 // SnapPart represents a generic snap type
1327 type SnapPart struct {
1328 m *packageYaml
1329- namespace string
1330+ origin string
1331 hash string
1332 isActive bool
1333 isInstalled bool
1334@@ -237,7 +237,7 @@
1335 IconURL string `json:"icon_url"`
1336 LastUpdated string `json:"last_updated,omitempty"`
1337 Name string `json:"package_name"`
1338- Namespace string `json:"origin"`
1339+ Origin string `json:"origin"`
1340 Prices map[string]float64 `json:"prices,omitempty"`
1341 Publisher string `json:"publisher,omitempty"`
1342 RatingsAverage float64 `json:"ratings_average,omitempty"`
1343@@ -279,7 +279,7 @@
1344 }
1345
1346 // this is to prevent installation of legacy packages such as those that
1347- // contain the namespace/origin in the package name.
1348+ // contain the origin/origin in the package name.
1349 if strings.ContainsRune(m.Name, '.') {
1350 return nil, ErrPackageNameNotSupported
1351 }
1352@@ -326,11 +326,11 @@
1353 return &m, nil
1354 }
1355
1356-func (m *packageYaml) qualifiedName(namespace string) string {
1357+func (m *packageYaml) qualifiedName(origin string) string {
1358 if m.Type == pkg.TypeFramework || m.Type == pkg.TypeOem {
1359 return m.Name
1360 }
1361- return m.Name + "." + namespace
1362+ return m.Name + "." + origin
1363 }
1364
1365 func (m *packageYaml) checkForNameClashes() error {
1366@@ -347,14 +347,14 @@
1367 return nil
1368 }
1369
1370-func (m *packageYaml) checkForPackageInstalled(namespace string) error {
1371+func (m *packageYaml) checkForPackageInstalled(origin string) error {
1372 part := ActiveSnapByName(m.Name)
1373 if part == nil {
1374 return nil
1375 }
1376
1377 if m.Type != pkg.TypeFramework && m.Type != pkg.TypeOem {
1378- if part.Namespace() != namespace {
1379+ if part.Origin() != origin {
1380 return ErrPackageNameAlreadyInstalled
1381 }
1382 }
1383@@ -446,13 +446,13 @@
1384 }
1385
1386 // NewInstalledSnapPart returns a new SnapPart from the given yamlPath
1387-func NewInstalledSnapPart(yamlPath, namespace string) (*SnapPart, error) {
1388+func NewInstalledSnapPart(yamlPath, origin string) (*SnapPart, error) {
1389 m, err := parsePackageYamlFile(yamlPath)
1390 if err != nil {
1391 return nil, err
1392 }
1393
1394- part, err := NewSnapPartFromYaml(yamlPath, namespace, m)
1395+ part, err := NewSnapPartFromYaml(yamlPath, origin, m)
1396 if err != nil {
1397 return nil, err
1398 }
1399@@ -461,7 +461,7 @@
1400 }
1401
1402 // NewSnapPartFromYaml returns a new SnapPart from the given *packageYaml at yamlPath
1403-func NewSnapPartFromYaml(yamlPath, namespace string, m *packageYaml) (*SnapPart, error) {
1404+func NewSnapPartFromYaml(yamlPath, origin string, m *packageYaml) (*SnapPart, error) {
1405 if _, err := os.Stat(yamlPath); err != nil {
1406 return nil, err
1407 }
1408@@ -469,7 +469,7 @@
1409 part := &SnapPart{
1410 basedir: filepath.Dir(filepath.Dir(yamlPath)),
1411 isInstalled: true,
1412- namespace: namespace,
1413+ origin: origin,
1414 m: m,
1415 }
1416
1417@@ -531,9 +531,9 @@
1418 return s.description
1419 }
1420
1421-// Namespace returns the namespace
1422-func (s *SnapPart) Namespace() string {
1423- return s.namespace
1424+// Origin returns the origin
1425+func (s *SnapPart) Origin() string {
1426+ return s.origin
1427 }
1428
1429 // Vendor returns the author. Or viceversa.
1430@@ -649,7 +649,7 @@
1431
1432 // Config is used to to configure the snap
1433 func (s *SnapPart) Config(configuration []byte) (new string, err error) {
1434- return snapConfig(s.basedir, s.namespace, string(configuration))
1435+ return snapConfig(s.basedir, s.origin, string(configuration))
1436 }
1437
1438 // NeedsReboot returns true if the snap becomes active on the next reboot
1439@@ -798,7 +798,7 @@
1440
1441 // Details returns details for the given snap
1442 func (s *SnapLocalRepository) Details(name string) (versions []Part, err error) {
1443- // XXX: this is broken wrt namespaceless packages (e.g. frameworks)
1444+ // XXX: this is broken wrt origin packages (e.g. frameworks)
1445 if !strings.ContainsRune(name, '.') {
1446 name += ".*"
1447 }
1448@@ -845,15 +845,15 @@
1449 return nil, err
1450 }
1451
1452- namespace := ""
1453+ origin := ""
1454 if m.Type != pkg.TypeFramework && m.Type != pkg.TypeOem {
1455- namespace, err = namespaceFromYamlPath(realpath)
1456+ origin, err = originFromYamlPath(realpath)
1457 if err != nil {
1458 return nil, err
1459 }
1460 }
1461
1462- snap, err := NewSnapPartFromYaml(realpath, namespace, m)
1463+ snap, err := NewSnapPartFromYaml(realpath, origin, m)
1464 if err != nil {
1465 return nil, err
1466 }
1467@@ -864,7 +864,7 @@
1468 return parts, nil
1469 }
1470
1471-func namespaceFromBasedir(basedir string) (s string) {
1472+func originFromBasedir(basedir string) (s string) {
1473 ext := filepath.Ext(filepath.Dir(filepath.Clean(basedir)))
1474 if len(ext) < 2 {
1475 return ""
1476@@ -873,14 +873,14 @@
1477 return ext[1:]
1478 }
1479
1480-func namespaceFromYamlPath(path string) (string, error) {
1481- namespace := namespaceFromBasedir(filepath.Join(path, "..", ".."))
1482+func originFromYamlPath(path string) (string, error) {
1483+ origin := originFromBasedir(filepath.Join(path, "..", ".."))
1484
1485- if namespace == "" {
1486+ if origin == "" {
1487 return "", ErrInvalidPart
1488 }
1489
1490- return namespace, nil
1491+ return origin, nil
1492 }
1493
1494 // RemoteSnapPart represents a snap available on the server
1495@@ -908,9 +908,9 @@
1496 return s.pkg.Title
1497 }
1498
1499-// Namespace is the origin
1500-func (s *RemoteSnapPart) Namespace() string {
1501- return s.pkg.Namespace
1502+// Origin is the origin
1503+func (s *RemoteSnapPart) Origin() string {
1504+ return s.pkg.Origin
1505 }
1506
1507 // Vendor is the publisher. Author. Whatever.
1508@@ -1031,7 +1031,7 @@
1509 }
1510 defer os.Remove(downloadedSnap)
1511
1512- return installClick(downloadedSnap, flags, pbar, s.Namespace())
1513+ return installClick(downloadedSnap, flags, pbar, s.Origin())
1514 }
1515
1516 // SetActive sets the snap active
1517@@ -1313,7 +1313,7 @@
1518 snapDataDir := filepath.Join(snapDataDir, part.Name(), part.Version())
1519 snapEnv := map[string]string{
1520 "SNAP_NAME": part.Name(),
1521- "SNAP_ORIGIN": part.Namespace(),
1522+ "SNAP_ORIGIN": part.Origin(),
1523 "SNAP_FULLNAME": QualifiedName(part),
1524 "SNAP_VERSION": part.Version(),
1525 "SNAP_APP_PATH": part.basedir,
1526
1527=== modified file 'snappy/snapp_test.go'
1528--- snappy/snapp_test.go 2015-05-20 09:49:34 +0000
1529+++ snappy/snapp_test.go 2015-05-20 20:14:40 +0000
1530@@ -138,7 +138,7 @@
1531 snapYaml, err := s.makeInstalledMockSnap()
1532 c.Assert(err, IsNil)
1533
1534- snap, err := NewInstalledSnapPart(snapYaml, testNamespace)
1535+ snap, err := NewInstalledSnapPart(snapYaml, testOrigin)
1536 c.Assert(err, IsNil)
1537 c.Assert(snap, NotNil)
1538 c.Check(snap.Name(), Equals, "hello-app")
1539@@ -167,7 +167,7 @@
1540 err = ioutil.WriteFile(hashesFile, []byte("archive-sha512: F00F00"), 0644)
1541 c.Assert(err, IsNil)
1542
1543- snap, err := NewInstalledSnapPart(snapYaml, testNamespace)
1544+ snap, err := NewInstalledSnapPart(snapYaml, testOrigin)
1545 c.Assert(err, IsNil)
1546 c.Assert(snap.Hash(), Equals, "F00F00")
1547 }
1548@@ -177,7 +177,7 @@
1549 c.Assert(err, IsNil)
1550 makeSnapActive(snapYaml)
1551
1552- snap, err := NewInstalledSnapPart(snapYaml, testNamespace)
1553+ snap, err := NewInstalledSnapPart(snapYaml, testOrigin)
1554 c.Assert(err, IsNil)
1555 c.Assert(snap.IsActive(), Equals, true)
1556 }
1557@@ -191,7 +191,7 @@
1558 `)
1559 c.Assert(err, IsNil)
1560
1561- snap, err := NewInstalledSnapPart(snapYaml, testNamespace)
1562+ snap, err := NewInstalledSnapPart(snapYaml, testOrigin)
1563 c.Assert(err, IsNil)
1564 fmk, err := snap.Frameworks()
1565 c.Assert(err, IsNil)
1566@@ -467,7 +467,7 @@
1567 parts := results[funkyAppName].Parts
1568 c.Assert(parts, HasLen, 1)
1569 c.Check(parts[0].Name(), Equals, funkyAppName)
1570- c.Check(parts[0].Namespace(), Equals, funkyAppOrigin)
1571+ c.Check(parts[0].Origin(), Equals, funkyAppOrigin)
1572 c.Check(parts[0].Vendor(), Equals, funkyAppVendor)
1573 c.Check(parts[0].Version(), Equals, "42")
1574 c.Check(parts[0].Description(), Equals, "Returns for store credit only.")
1575@@ -497,8 +497,8 @@
1576 c.Assert(parts, HasLen, 2)
1577 c.Check(parts[0].Name(), Equals, "hello-world")
1578 c.Check(parts[1].Name(), Equals, "hello-world")
1579- c.Check(parts[0].Namespace(), Equals, "canonical")
1580- c.Check(parts[1].Namespace(), Equals, "jdstrand")
1581+ c.Check(parts[0].Origin(), Equals, "canonical")
1582+ c.Check(parts[1].Origin(), Equals, "jdstrand")
1583 c.Check(parts[0].Vendor(), Equals, "Canonical")
1584 c.Check(parts[1].Vendor(), Equals, "Jamie Strandboge")
1585 c.Check(parts[0].Version(), Equals, "1.0.8")
1586@@ -598,7 +598,7 @@
1587 c.Assert(err, IsNil)
1588 c.Assert(results, HasLen, 1)
1589 c.Check(results[0].Name(), Equals, funkyAppName)
1590- c.Check(results[0].Namespace(), Equals, funkyAppOrigin)
1591+ c.Check(results[0].Origin(), Equals, funkyAppOrigin)
1592 c.Check(results[0].Vendor(), Equals, funkyAppVendor)
1593 c.Check(results[0].Version(), Equals, "42")
1594 c.Check(results[0].Hash(), Equals, "5364253e4a988f4f5c04380086d542f410455b97d48cc6c69ca2a5877d8aef2a6b2b2f83ec4f688cae61ebc8a6bf2cdbd4dbd8f743f0522fc76540429b79df42")
1595@@ -692,7 +692,7 @@
1596
1597 snap := RemoteSnapPart{}
1598 snap.pkg.AnonDownloadURL = mockServer.URL + "/snap"
1599- snap.pkg.Namespace = testNamespace
1600+ snap.pkg.Origin = testOrigin
1601
1602 p := &MockProgressMeter{}
1603 name, err := snap.Install(p, 0)
1604@@ -738,12 +738,12 @@
1605 yamlFile, err := makeInstalledMockSnap(s.tempdir, packageHello)
1606 c.Assert(err, IsNil)
1607
1608- snap, err := NewInstalledSnapPart(yamlFile, testNamespace)
1609+ snap, err := NewInstalledSnapPart(yamlFile, testOrigin)
1610 c.Assert(err, IsNil)
1611 c.Assert(snap, NotNil)
1612
1613 c.Assert(snap.Name(), Equals, "hello-app")
1614- c.Assert(snap.Namespace(), Equals, testNamespace)
1615+ c.Assert(snap.Origin(), Equals, testOrigin)
1616 c.Assert(snap.Vendor(), Equals, "Michael Vogt")
1617 c.Assert(snap.Version(), Equals, "1.10")
1618 c.Assert(snap.IsActive(), Equals, false)
1619@@ -1018,7 +1018,7 @@
1620 c.Check(yaml.checkForPackageInstalled("otherns"), Equals, ErrPackageNameAlreadyInstalled)
1621 }
1622
1623-func (s *SnapTestSuite) TestIgnoresAlreadyInstalledSameNamespace(c *C) {
1624+func (s *SnapTestSuite) TestIgnoresAlreadyInstalledSameOrigin(c *C) {
1625 // XXX: should this be allowed? right now it is (=> you can re-sideload the same version of your apps)
1626 // (remote snaps are stopped before clickInstall gets to run)
1627
1628@@ -1029,7 +1029,7 @@
1629
1630 yaml, err := parsePackageYamlData([]byte(data))
1631 c.Assert(err, IsNil)
1632- c.Check(yaml.checkForPackageInstalled(testNamespace), IsNil)
1633+ c.Check(yaml.checkForPackageInstalled(testOrigin), IsNil)
1634 }
1635
1636 func (s *SnapTestSuite) TestIgnoresAlreadyInstalledFrameworks(c *C) {
1637@@ -1101,7 +1101,7 @@
1638 }()
1639 touched := []string{}
1640 snapAppArmorDir = c.MkDir()
1641- fn := filepath.Join(snapAppArmorDir, "foo."+testNamespace+"_hello_1.0.json")
1642+ fn := filepath.Join(snapAppArmorDir, "foo."+testOrigin+"_hello_1.0.json")
1643 c.Assert(os.Symlink(fn, fn), IsNil)
1644 timestampUpdater = func(s string) error {
1645 touched = append(touched, s)
1646@@ -1136,7 +1136,7 @@
1647
1648 pb := &MockProgressMeter{}
1649 m, err := parsePackageYamlData([]byte(yaml))
1650- part := &SnapPart{m: m, namespace: testNamespace, basedir: d1}
1651+ part := &SnapPart{m: m, origin: testOrigin, basedir: d1}
1652 c.Assert(part.RefreshDependentsSecurity(d2, pb), IsNil)
1653 c.Check(touched, DeepEquals, []string{fn})
1654 }
1655@@ -1155,7 +1155,7 @@
1656 `)
1657 c.Assert(err, IsNil)
1658
1659- part := &SnapPart{m: yaml, namespace: testNamespace}
1660+ part := &SnapPart{m: yaml, origin: testOrigin}
1661 err = part.Uninstall(new(MockProgressMeter))
1662 c.Check(err, ErrorMatches, `framework still in use by: foo`)
1663 }
1664@@ -1205,11 +1205,11 @@
1665 defer func() { timestampUpdater = helpers.UpdateTimestamp }()
1666 // if one of the services needs updating, it's updated and returned
1667 svc := Service{Name: "svc", SecurityDefinitions: SecurityDefinitions{SecurityTemplate: "foo"}}
1668- part := &SnapPart{m: &packageYaml{Name: "part", Services: []Service{svc}, Version: "42"}, namespace: testNamespace}
1669+ part := &SnapPart{m: &packageYaml{Name: "part", Services: []Service{svc}, Version: "42"}, origin: testOrigin}
1670 err := part.RequestAppArmorUpdate(nil, map[string]bool{"foo": true})
1671 c.Assert(err, IsNil)
1672 c.Assert(updated, HasLen, 1)
1673- c.Check(filepath.Base(updated[0]), Equals, "part."+testNamespace+"_svc_42.json")
1674+ c.Check(filepath.Base(updated[0]), Equals, "part."+testOrigin+"_svc_42.json")
1675 }
1676
1677 func (s *SnapTestSuite) TestRequestAppArmorUpdateBinary(c *C) {
1678@@ -1221,11 +1221,11 @@
1679 defer func() { timestampUpdater = helpers.UpdateTimestamp }()
1680 // if one of the binaries needs updating, the part needs updating
1681 bin := Binary{Name: "echo", SecurityDefinitions: SecurityDefinitions{SecurityTemplate: "foo"}}
1682- part := &SnapPart{m: &packageYaml{Name: "part", Binaries: []Binary{bin}, Version: "42"}, namespace: testNamespace}
1683+ part := &SnapPart{m: &packageYaml{Name: "part", Binaries: []Binary{bin}, Version: "42"}, origin: testOrigin}
1684 err := part.RequestAppArmorUpdate(nil, map[string]bool{"foo": true})
1685 c.Assert(err, IsNil)
1686 c.Assert(updated, HasLen, 1)
1687- c.Check(filepath.Base(updated[0]), Equals, "part."+testNamespace+"_echo_42.json")
1688+ c.Check(filepath.Base(updated[0]), Equals, "part."+testOrigin+"_echo_42.json")
1689 }
1690
1691 func (s *SnapTestSuite) TestRequestAppArmorUpdateNothing(c *C) {
1692@@ -1237,7 +1237,7 @@
1693 defer func() { timestampUpdater = helpers.UpdateTimestamp }()
1694 svc := Service{Name: "svc", SecurityDefinitions: SecurityDefinitions{SecurityTemplate: "foo"}}
1695 bin := Binary{Name: "echo", SecurityDefinitions: SecurityDefinitions{SecurityTemplate: "foo"}}
1696- part := &SnapPart{m: &packageYaml{Services: []Service{svc}, Binaries: []Binary{bin}, Version: "42"}, namespace: testNamespace}
1697+ part := &SnapPart{m: &packageYaml{Services: []Service{svc}, Binaries: []Binary{bin}, Version: "42"}, origin: testOrigin}
1698 err := part.RequestAppArmorUpdate(nil, nil)
1699 c.Check(err, IsNil)
1700 c.Check(updated, HasLen, 0)
1701@@ -1263,16 +1263,16 @@
1702 c.Assert(err, NotNil)
1703 }
1704
1705-func (s *SnapTestSuite) TestNamespaceFromPath(c *C) {
1706- n, err := namespaceFromYamlPath("/oem/foo.bar/1.0/meta/package.yaml")
1707+func (s *SnapTestSuite) TestOriginFromPath(c *C) {
1708+ n, err := originFromYamlPath("/oem/foo.bar/1.0/meta/package.yaml")
1709 c.Check(err, IsNil)
1710 c.Check(n, Equals, "bar")
1711
1712- n, err = namespaceFromYamlPath("/oem/foo_bar/1.0/meta/package.yaml")
1713+ n, err = originFromYamlPath("/oem/foo_bar/1.0/meta/package.yaml")
1714 c.Check(err, NotNil)
1715 c.Check(n, Equals, "")
1716
1717- n, err = namespaceFromYamlPath("/oo_bar/1.0/mpackage.yaml")
1718+ n, err = originFromYamlPath("/oo_bar/1.0/mpackage.yaml")
1719 c.Check(err, NotNil)
1720 c.Check(n, Equals, "")
1721 }
1722@@ -1293,7 +1293,7 @@
1723 c.Assert(getStructFields(t{}), DeepEquals, []string{"hello"})
1724 }
1725
1726-func (s *SnapTestSuite) TestIllegalPackageNameWithNamespace(c *C) {
1727+func (s *SnapTestSuite) TestIllegalPackageNameWithOrigin(c *C) {
1728 _, err := parsePackageYamlData([]byte(`name: foo.something
1729 `))
1730
1731
1732=== modified file 'snappy/systemimage.go'
1733--- snappy/systemimage.go 2015-05-19 17:32:01 +0000
1734+++ snappy/systemimage.go 2015-05-20 20:14:40 +0000
1735@@ -39,9 +39,9 @@
1736 )
1737
1738 const (
1739- systemImagePartName = "ubuntu-core"
1740- systemImagePartNamespace = "ubuntu"
1741- systemImagePartVendor = "Canonical Ltd."
1742+ systemImagePartName = "ubuntu-core"
1743+ systemImagePartOrigin = "ubuntu"
1744+ systemImagePartVendor = "Canonical Ltd."
1745
1746 // location of the channel config on the filesystem.
1747 //
1748@@ -107,9 +107,9 @@
1749 return systemImagePartName
1750 }
1751
1752-// Namespace returns the namespace ("ubuntu")
1753-func (s *SystemImagePart) Namespace() string {
1754- return systemImagePartNamespace
1755+// Origin returns the origin ("ubuntu")
1756+func (s *SystemImagePart) Origin() string {
1757+ return systemImagePartOrigin
1758 }
1759
1760 // Vendor returns the vendor ("Canonical Ltd.")
1761
1762=== modified file 'snappy/systemimage_test.go'
1763--- snappy/systemimage_test.go 2015-05-15 13:33:27 +0000
1764+++ snappy/systemimage_test.go 2015-05-20 20:14:40 +0000
1765@@ -114,7 +114,7 @@
1766 // we have one active and one inactive
1767 c.Assert(parts, HasLen, 2)
1768 c.Assert(parts[0].Name(), Equals, systemImagePartName)
1769- c.Assert(parts[0].Namespace(), Equals, systemImagePartNamespace)
1770+ c.Assert(parts[0].Origin(), Equals, systemImagePartOrigin)
1771 c.Assert(parts[0].Vendor(), Equals, systemImagePartVendor)
1772 c.Assert(parts[0].Version(), Equals, "1")
1773 c.Assert(parts[0].Hash(), Equals, "e09c13f68fccef3b2fe0f5c8ff5c61acf2173b170b1f2a3646487147690b0970ef6f2c555d7bcb072035f29ee4ea66a6df7f6bb320d358d3a7d78a0c37a8a549")
1774@@ -353,12 +353,12 @@
1775 c.Check(fmks, HasLen, 0)
1776 }
1777
1778-func (s *SITestSuite) TestNamespace(c *C) {
1779+func (s *SITestSuite) TestOrigin(c *C) {
1780 parts, err := s.systemImage.Installed()
1781 c.Assert(err, IsNil)
1782 c.Assert(parts, HasLen, 2)
1783- c.Assert(parts[0].Namespace(), Equals, systemImagePartNamespace)
1784- c.Assert(parts[1].Namespace(), Equals, systemImagePartNamespace)
1785+ c.Assert(parts[0].Origin(), Equals, systemImagePartOrigin)
1786+ c.Assert(parts[1].Origin(), Equals, systemImagePartOrigin)
1787 }
1788
1789 func (s *SITestSuite) TestCannotUpdateIfSideLoaded(c *C) {
1790
1791=== modified file 'systemd/systemd.go'
1792--- systemd/systemd.go 2015-05-19 14:09:19 +0000
1793+++ systemd/systemd.go 2015-05-20 20:14:40 +0000
1794@@ -181,7 +181,7 @@
1795 [Service]
1796 ExecStart=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathStart}}
1797 WorkingDirectory={{.AppPath}}
1798-Environment="SNAPP_APP_PATH={{.AppPath}}" "SNAPP_APP_DATA_PATH=/var/lib{{.AppPath}}" "SNAPP_APP_USER_DATA_PATH=%h{{.AppPath}}" "SNAP_APP_PATH={{.AppPath}}" "SNAP_APP_DATA_PATH=/var/lib{{.AppPath}}" "SNAP_APP_USER_DATA_PATH=%h{{.AppPath}}" "SNAP_APP={{.AppTriple}}" "TMPDIR=/tmp/snaps/{{.UdevAppName}}/{{.Version}}/tmp" "SNAP_APP_TMPDIR=/tmp/snaps/{{.UdevAppName}}/{{.Version}}/tmp" "SNAP_NAME={{.AppName}}" "SNAP_ORIGIN={{.Namespace}}" "SNAP_FULLNAME={{.UdevAppName}}"
1799+Environment="SNAPP_APP_PATH={{.AppPath}}" "SNAPP_APP_DATA_PATH=/var/lib{{.AppPath}}" "SNAPP_APP_USER_DATA_PATH=%h{{.AppPath}}" "SNAP_APP_PATH={{.AppPath}}" "SNAP_APP_DATA_PATH=/var/lib{{.AppPath}}" "SNAP_APP_USER_DATA_PATH=%h{{.AppPath}}" "SNAP_APP={{.AppTriple}}" "TMPDIR=/tmp/snaps/{{.UdevAppName}}/{{.Version}}/tmp" "SNAP_APP_TMPDIR=/tmp/snaps/{{.UdevAppName}}/{{.Version}}/tmp" "SNAP_NAME={{.AppName}}" "SNAP_ORIGIN={{.Origin}}" "SNAP_FULLNAME={{.UdevAppName}}"
1800 {{if .Stop}}ExecStop=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathStop}}{{end}}
1801 {{if .PostStop}}ExecStopPost=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathPostStop}}{{end}}
1802 {{if .StopTimeout}}TimeoutStopSec={{.StopTimeout.Seconds}}{{end}}
1803@@ -193,9 +193,9 @@
1804 `
1805 var templateOut bytes.Buffer
1806 t := template.Must(template.New("wrapper").Parse(serviceTemplate))
1807- namespace := ""
1808+ origin := ""
1809 if len(desc.UdevAppName) > len(desc.AppName) {
1810- namespace = desc.UdevAppName[len(desc.AppName)+1:]
1811+ origin = desc.UdevAppName[len(desc.AppName)+1:]
1812 }
1813 wrapperData := struct {
1814 // the service description
1815@@ -206,7 +206,7 @@
1816 FullPathPostStop string
1817 AppTriple string
1818 ServiceSystemdTarget string
1819- Namespace string
1820+ Origin string
1821 }{
1822 *desc,
1823 filepath.Join(desc.AppPath, desc.Start),
1824@@ -214,7 +214,7 @@
1825 filepath.Join(desc.AppPath, desc.PostStop),
1826 fmt.Sprintf("%s_%s_%s", desc.AppName, desc.ServiceName, desc.Version),
1827 servicesSystemdTarget,
1828- namespace,
1829+ origin,
1830 }
1831 if err := t.Execute(&templateOut, wrapperData); err != nil {
1832 // this can never happen, except we forget a variable

Subscribers

People subscribed via source and target branches