예제 #1
0
pkgCache::VerIterator AptCacheFile::findVer(const pkgCache::PkgIterator &pkg)
{
    // if the package is installed return the current version
    if (!pkg.CurrentVer().end()) {
        return pkg.CurrentVer();
    }

    // Else get the candidate version iterator
    const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
    if (!candidateVer.end()) {
        return candidateVer;
    }

    // return the version list as a last resource
    return pkg.VersionList();
}
예제 #2
0
파일: disposal.cpp 프로젝트: wh0/disposal
bool notable_remove(pkgCacheFile &Cache, const std::vector<scan_info> &info, const pkgCache::PkgIterator pkg) {
	// removing as requested
	if (info[pkg->ID].in_no) return true;
	bool notable = true;
	fancy_reverse_deps(pkg, pkg.CurrentVer(), [&](const pkgCache::DepIterator dep) {
		if (dep.IsNegative()) return;
		if (!Cache->IsImportantDep(dep)) return;
		if (!Cache[dep.ParentPkg()].Delete()) return;
		if (dep.ParentVer() != dep.ParentPkg().CurrentVer()) return;
		// something else being removed depends on it
		notable = false;
	});
	return notable;
}