Esempio n. 1
0
func (db DB) GetPkgcache() []*Pkg {
	// This isn't pretty. get_pkgcache returns a pointer to a alpm_list.
	//we've defined that struct, but we need to convert that pointer to it.
	cache := (*PointerList)(unsafe.Pointer(C.alpm_db_get_pkgcache(db.ptr)))
	pkgs := []*Pkg{}

	cache.ForEach(func(pkgptr unsafe.Pointer) {
		pkg := pointerToPkg((*C.alpm_pkg_t)(pkgptr))
		pkgs = append(pkgs, pkg)
	})

	return pkgs
}
Esempio n. 2
0
// Returns the list of packages of the database
func (db Db) PkgCache() PackageList {
	pkgcache := (*list)(unsafe.Pointer(C.alpm_db_get_pkgcache(db.ptr)))
	return PackageList{pkgcache, db.handle}
}