Beispiel #1
0
func (s *removedSuite) MkStoreYaml(c *check.C, pkgType pkg.Type) {
	// creating the part to get its manifest path is cheating, a little
	part := &Removed{
		name:    "foo",
		origin:  "bar",
		version: "1",
		pkgType: pkgType,
	}

	content := `
name: foo
origin: bar
version: 1
type: app
description: |-
  bla bla bla
publisher: example.com
iconurl: http://i.stack.imgur.com/i8q1U.jpg
downloadsize: 5554242
`
	p := snappy.RemoteManifestPath(part)
	c.Assert(os.MkdirAll(filepath.Dir(p), 0755), check.IsNil)
	c.Assert(ioutil.WriteFile(p, []byte(content), 0644), check.IsNil)

}
Beispiel #2
0
func (s *lightweightSuite) TestMapRemovedFmkNoPartButStoreMeta(c *check.C) {
	snap := remote.Snap{
		Name:         "fmk2",
		Origin:       "fmk2origin",
		Version:      "4.2.0ubuntu1",
		Type:         snap.TypeFramework,
		IconURL:      "http://example.com/icon",
		DownloadSize: 42,
		Publisher:    "Example Inc.",
	}
	part := snappy.NewRemoteSnapPart(snap)

	content, err := yaml.Marshal(snap)
	c.Assert(err, check.IsNil)

	p := snappy.RemoteManifestPath(part)
	c.Assert(os.MkdirAll(filepath.Dir(p), 0755), check.IsNil)
	c.Assert(ioutil.WriteFile(p, content, 0644), check.IsNil)

	bag := PartBagByName("fmk2", "fmk2origin")
	m := bag.Map(nil)
	c.Check(m, check.DeepEquals, map[string]interface{}{
		"name":           "fmk2",
		"origin":         "fmk2origin",
		"status":         "removed",
		"version":        "4.2.0ubuntu1",
		"icon":           "http://example.com/icon",
		"type":           "framework",
		"vendor":         "",
		"installed_size": int64(-1),
		"download_size":  int64(42),
		"description":    "",
	})
}
Beispiel #3
0
// New removed package.
func New(name, origin, version string, pkgType pkg.Type) snappy.Part {
	part := &Removed{
		name:    name,
		origin:  origin,
		version: version,
		pkgType: pkgType,
	}

	// try to load the remote manifest, that would've been kept
	// around when installing from the store.
	content, _ := ioutil.ReadFile(snappy.RemoteManifestPath(part))
	yaml.Unmarshal(content, &(part.remote))

	return part
}