index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/deps.c | 64 |
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index b9d7a8ff..914d1a3a 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -67,7 +67,7 @@ void _alpm_depmiss_free(pmdepmissing_t *miss) } /* Does pkg1 depend on pkg2, ie. does pkg2 satisfy a dependency of pkg1? */ -static int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2) +static int _alpm_dep_edge(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2) { alpm_list_t *i; for(i = alpm_pkg_get_depends(pkg1); i; i = i->next) { @@ -78,7 +78,7 @@ static int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2) return 0; } -/* Convert a list of pmpkg_t * to a graph structure, +/* Convert a list of alpm_pkg_t * to a graph structure, * with a edge for each dependency. * Returns a list of vertices (one vertex = one package) * (used by alpm_sortbydeps) @@ -97,11 +97,11 @@ static alpm_list_t *dep_graph_init(alpm_list_t *targets) /* We compute the edges */ for(i = vertices; i; i = i->next) { pmgraph_t *vertex_i = i->data; - pmpkg_t *p_i = vertex_i->data; + alpm_pkg_t *p_i = vertex_i->data; /* TODO this should be somehow combined with alpm_checkdeps */ for(j = vertices; j; j = j->next) { pmgraph_t *vertex_j = j->data; - pmpkg_t *p_j = vertex_j->data; + alpm_pkg_t *p_j = vertex_j->data; if(_alpm_dep_edge(p_i, p_j)) { vertex_i->children = alpm_list_add(vertex_i->children, vertex_j); @@ -157,8 +157,8 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, vertex = nextchild; } else if(nextchild->state == -1) { - pmpkg_t *vertexpkg = vertex->data; - pmpkg_t *childpkg = nextchild->data; + alpm_pkg_t *vertexpkg = vertex->data; + alpm_pkg_t *childpkg = nextchild->data; const char *message; _alpm_log(handle, PM_LOG_WARNING, _("dependency cycle detected:\n")); @@ -226,12 +226,12 @@ static void release_filtered_depend(pmdepend_t *dep, int nodepversion) } } -static pmpkg_t *find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep) +static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep) { alpm_list_t *i; for(i = pkgs; i; i = alpm_list_next(i)) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; if(_alpm_depcmp(pkg, dep)) { return pkg; } @@ -241,17 +241,17 @@ static pmpkg_t *find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep) /** Find a package satisfying a specified dependency. * The dependency can include versions with depmod operators. - * @param pkgs an alpm_list_t* of pmpkg_t where the satisfier will be searched + * @param pkgs an alpm_list_t* of alpm_pkg_t where the satisfier will be searched * @param depstring package or provision name, versioned or not - * @return a pmpkg_t* satisfying depstring + * @return a alpm_pkg_t* satisfying depstring */ -pmpkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring) +alpm_pkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring) { pmdepend_t *dep = _alpm_splitdep(depstring); if(!dep) { return NULL; } - pmpkg_t *pkg = find_dep_satisfier(pkgs, dep); + alpm_pkg_t *pkg = find_dep_satisfier(pkgs, dep); _alpm_dep_free(dep); return pkg; } @@ -277,7 +277,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle, alpm_list_t *pkglis targets = alpm_list_join(alpm_list_copy(remove), alpm_list_copy(upgrade)); for(i = pkglist; i; i = i->next) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; if(_alpm_pkg_find(targets, pkg->name)) { modified = alpm_list_add(modified, pkg); } else { @@ -290,7 +290,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle, alpm_list_t *pkglis /* look for unsatisfied dependencies of the upgrade list */ for(i = upgrade; i; i = i->next) { - pmpkg_t *tp = i->data; + alpm_pkg_t *tp = i->data; _alpm_log(handle, PM_LOG_DEBUG, "checkdeps: package %s-%s\n", alpm_pkg_get_name(tp), alpm_pkg_get_version(tp)); @@ -318,11 +318,11 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle, alpm_list_t *pkglis /* reversedeps handles the backwards dependencies, ie, * the packages listed in the requiredby field. */ for(i = dblist; i; i = i->next) { - pmpkg_t *lp = i->data; + alpm_pkg_t *lp = i->data; for(j = alpm_pkg_get_depends(lp); j; j = j->next) { pmdepend_t *depend = j->data; depend = filtered_depend(depend, nodepversion); - pmpkg_t *causingpkg = find_dep_satisfier(modified, depend); + alpm_pkg_t *causingpkg = find_dep_satisfier(modified, depend); /* we won't break this depend, if it is already broken, we ignore it */ /* 1. check upgrade list for satisfiers */ /* 2. check dblist for satisfiers */ @@ -369,7 +369,7 @@ static int dep_vercmp(const char *version1, alpm_depmod_t mod, return equal; } -int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep) +int _alpm_depcmp(alpm_pkg_t *pkg, pmdepend_t *dep) { alpm_list_t *i; int satisfy = 0; @@ -472,7 +472,7 @@ pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep) * targets and a db is safe to remove. We do NOT remove it if it is in the * target list, or if if the package was explictly installed and * include_explicit == 0 */ -static int can_remove_package(alpm_db_t *db, pmpkg_t *pkg, alpm_list_t *targets, +static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg, alpm_list_t *targets, int include_explicit) { alpm_list_t *i; @@ -498,7 +498,7 @@ static int can_remove_package(alpm_db_t *db, pmpkg_t *pkg, alpm_list_t *targets, /* see if other packages need it */ for(i = _alpm_db_get_pkgcache(db); i; i = i->next) { - pmpkg_t *lpkg = i->data; + alpm_pkg_t *lpkg = i->data; if(_alpm_dep_edge(lpkg, pkg) && !_alpm_pkg_find(targets, lpkg->name)) { return 0; } @@ -527,9 +527,9 @@ void _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit) } for(i = targs; i; i = i->next) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; for(j = _alpm_db_get_pkgcache(db); j; j = j->next) { - pmpkg_t *deppkg = j->data; + alpm_pkg_t *deppkg = j->data; if(_alpm_dep_edge(pkg, deppkg) && can_remove_package(db, deppkg, targs, include_explicit)) { _alpm_log(db->handle, PM_LOG_DEBUG, "adding '%s' to the targets\n", @@ -554,7 +554,7 @@ void _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit) * an error code without prompting * @return the resolved package **/ -static pmpkg_t *resolvedep(alpm_handle_t *handle, pmdepend_t *dep, +static alpm_pkg_t *resolvedep(alpm_handle_t *handle, pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, int prompt) { alpm_list_t *i, *j; @@ -565,7 +565,7 @@ static pmpkg_t *resolvedep(alpm_handle_t *handle, pmdepend_t *dep, /* 1. literals */ for(i = dbs; i; i = i->next) { - pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name); + alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name); if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) { if(_alpm_pkg_should_ignore(handle, pkg)) { int install = 0; @@ -586,7 +586,7 @@ static pmpkg_t *resolvedep(alpm_handle_t *handle, pmdepend_t *dep, /* 2. satisfiers (skip literals here) */ for(i = dbs; i; i = i->next) { for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) { - pmpkg_t *pkg = j->data; + alpm_pkg_t *pkg = j->data; if(_alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) != 0 && !_alpm_pkg_find(excluding, pkg->name)) { if(_alpm_pkg_should_ignore(handle, pkg)) { @@ -612,7 +612,7 @@ static pmpkg_t *resolvedep(alpm_handle_t *handle, pmdepend_t *dep, /* first check if one provider is already installed locally */ for(i = providers; i; i = i->next) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; if(_alpm_pkghash_find(_alpm_db_get_pkgcache_hash(handle->db_local), pkg->name)) { alpm_list_free(providers); return pkg; @@ -628,7 +628,7 @@ static pmpkg_t *resolvedep(alpm_handle_t *handle, pmdepend_t *dep, providers, dep, NULL, &index); } if(index >= 0 && index < count) { - pmpkg_t *pkg = alpm_list_getdata(alpm_list_nth(providers, index)); + alpm_pkg_t *pkg = alpm_list_getdata(alpm_list_nth(providers, index)); alpm_list_free(providers); return pkg; } @@ -651,13 +651,13 @@ static pmpkg_t *resolvedep(alpm_handle_t *handle, pmdepend_t *dep, * @param handle the context handle * @param dbs an alpm_list_t* of alpm_db_t where the satisfier will be searched * @param depstring package or provision name, versioned or not - * @return a pmpkg_t* satisfying depstring + * @return a alpm_pkg_t* satisfying depstring */ -pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle, +alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle, alpm_list_t *dbs, const char *depstring) { pmdepend_t *dep; - pmpkg_t *pkg; + alpm_pkg_t *pkg; CHECK_HANDLE(handle, return NULL); ASSERT(dbs, RET_ERR(handle, PM_ERR_WRONG_ARGS, NULL)); @@ -689,7 +689,7 @@ pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle, * unresolvable dependency, in which case the [*packages] list will be * unmodified by this function */ -int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg, +int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg, alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove, alpm_list_t **data) { @@ -712,7 +712,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pk _alpm_log(handle, PM_LOG_DEBUG, "started resolving dependencies\n"); for(i = alpm_list_last(*packages); i; i = i->next) { - pmpkg_t *tpkg = i->data; + alpm_pkg_t *tpkg = i->data; targ = alpm_list_add(NULL, tpkg); deps = alpm_checkdeps(handle, localpkgs, remove, targ, 0); alpm_list_free(targ); @@ -728,7 +728,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pk } /* check if one of the packages in the [preferred] list already satisfies * this dependency */ - pmpkg_t *spkg = find_dep_satisfier(preferred, missdep); + alpm_pkg_t *spkg = find_dep_satisfier(preferred, missdep); if(!spkg) { /* find a satisfier package in the given repositories */ spkg = resolvedep(handle, missdep, handle->dbs_sync, *packages, 0); |