Beispiel #1
0
func (c *concreteSnap) Load(version string) (snappy.Part, error) {
	yamlPath := filepath.Join(c.instdir, c.self.QualifiedName(), version, "meta", "package.yaml")
	if !helpers.FileExists(yamlPath) {
		return removed.New(c.self.Name, c.self.Origin, version, c.self.Type), nil
	}

	part, err := snappy.NewInstalledSnapPart(yamlPath, c.self.Origin)
	if err != nil {
		return nil, err
	}

	return part, nil
}
func (s *lightweightSuite) SetUpTest(c *check.C) {
	s.d = c.MkDir()
	dirs.SetRootDir(s.d)

	s.MkInstalled(c, pkg.TypeApp, dirs.SnapAppsDir, "foo", "bar", "1.0", true)
	s.MkRemoved(c, "foo.bar", "0.9")
	s.MkRemoved(c, "foo.baz", "0.8")

	s.MkInstalled(c, pkg.TypeFramework, dirs.SnapAppsDir, "fmk", "", "123", false)
	s.MkInstalled(c, pkg.TypeFramework, dirs.SnapAppsDir, "fmk", "", "120", true)
	s.MkInstalled(c, pkg.TypeFramework, dirs.SnapAppsDir, "fmk", "", "119", false)
	s.MkRemoved(c, "fmk", "12a1")

	s.MkRemoved(c, "fmk2", "4.2.0ubuntu1")

	s.MkInstalled(c, pkg.TypeOem, dirs.SnapOemDir, "an-oem", "", "3", false)

	newCoreRepo = func() repo {
		// you can't ever have a removed systemimagepart, but for testing it'll do
		return mockrepo{removed.New(snappy.SystemImagePartName, snappy.SystemImagePartOrigin, "1", pkg.TypeCore)}
	}
}