Example #1
0
func (inst *packageInstruction) update() interface{} {
	// zomg :-(
	// TODO: query the store for just this package, instead of this

	flags := snappy.DoInstallGC
	if inst.LeaveOld {
		flags = 0
	}

	parts, err := snappy.ListUpdates()
	if err != nil {
		return err
	}

	for _, part := range parts {
		if snappy.QualifiedName(part) == inst.pkg {
			if _, err := part.Install(inst.prog, flags); err != nil {
				return err
			}
			return snappy.GarbageCollect(inst.pkg, flags, inst.prog)
		}
	}

	return "package is up to date"
}
Example #2
0
func (x cmdList) list() error {
	installed, err := snappy.ListInstalled()
	if err != nil {
		return err
	}

	if x.Updates {
		updates, err := snappy.ListUpdates()
		if err != nil {
			return err
		}
		showUpdatesList(installed, updates, os.Stdout)
	} else if x.Verbose {
		showVerboseList(installed, os.Stdout)
	} else {
		showInstalledList(installed, os.Stdout)
	}

	return err
}