Ejemplo n.º 1
0
func InstallStatus(p *alpm.Package) string {
	alpmHandleLock.RLock()
	defer alpmHandleLock.RUnlock()
	localdb, err := getAlpm().LocalDb()
	if err != nil {
		return "could not found local DB"
	}
	localp, err := localdb.PkgByName(p.Name())
	if err == nil && localp != nil {
		switch cmp := alpm.VerCmp(p.Version(), localp.Version()); {
		case cmp > 0:
			return "Upgradable"
		case cmp == 0:
			return "Installed"
		case cmp < 0:
			return "Local version is newer"
		}
	}
	return "Not installed"
}
Ejemplo n.º 2
0
func IsLocal(p *alpm.Package) bool {
	return p.DB().Name() == "local"
}