コード例 #1
0
ファイル: snapp_test.go プロジェクト: robert-ancell/snapd
func (s *SnapTestSuite) TestChannelFromLocalManifest(c *C) {
	snapYaml, err := s.makeInstalledMockSnap()
	c.Assert(err, IsNil)

	snap, err := NewInstalledSnapPart(snapYaml, testOrigin)
	c.Assert(snap.Channel(), Equals, "remote-channel")
}
コード例 #2
0
ファイル: cmd_info.go プロジェクト: alecu/snappy
func snapInfo(pkgname string, includeStore, verbose bool) error {
	snap := snappy.ActiveSnapByName(pkgname)
	if snap == nil && includeStore {
		m := snappy.NewUbuntuStoreSnapRepository()
		var err error
		snap, err = m.Snap(pkgname)
		if err != nil {
			return fmt.Errorf("cannot get details for snap %q: %s", pkgname, err)
		}
	}

	if snap == nil {
		return fmt.Errorf("no snap '%s' found", pkgname)
	}

	// TRANSLATORS: the %s is a channel name
	fmt.Printf(i18n.G("channel: %s\n"), snap.Channel())
	// TRANSLATORS: the %s is a version string
	fmt.Printf(i18n.G("version: %s\n"), snap.Version())
	// TRANSLATORS: the %s is a date
	fmt.Printf(i18n.G("updated: %s\n"), snap.Date())
	if verbose {
		// TRANSLATORS: the %s is a date
		fmt.Printf(i18n.G("installed: %s\n"), "n/a")
		// TRANSLATORS: the %s is a size
		fmt.Printf(i18n.G("binary-size: %v\n"), snap.InstalledSize())
		// TRANSLATORS: the %s is a size
		fmt.Printf(i18n.G("data-size: %s\n"), "n/a")
		// FIXME: implement backup list per spec
	}

	return nil
}
コード例 #3
0
ファイル: cmd_info.go プロジェクト: robert-ancell/snapd
func snapInfo(pkgname string, includeStore, verbose bool) error {
	snap := snappy.ActiveSnapByName(pkgname)
	if snap == nil && includeStore {
		m := snappy.NewUbuntuStoreSnapRepository()
		snaps, err := m.Details(snappy.SplitOrigin(pkgname))
		if err == nil && len(snaps) == 1 {
			snap = snaps[0]
		}
	}

	if snap == nil {
		return fmt.Errorf("No snap '%s' found", pkgname)
	}

	// TRANSLATORS: the %s is a channel name
	fmt.Printf(i18n.G("channel: %s\n"), snap.Channel())
	// TRANSLATORS: the %s is a version string
	fmt.Printf(i18n.G("version: %s\n"), snap.Version())
	// TRANSLATORS: the %s is a date
	fmt.Printf(i18n.G("updated: %s\n"), snap.Date())
	if verbose {
		// TRANSLATORS: the %s is a date
		fmt.Printf(i18n.G("installed: %s\n"), "n/a")
		// TRANSLATORS: the %s is a size
		fmt.Printf(i18n.G("binary-size: %v\n"), snap.InstalledSize())
		// TRANSLATORS: the %s is a size
		fmt.Printf(i18n.G("data-size: %s\n"), "n/a")
		// FIXME: implement backup list per spec
	}

	return nil
}