mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
alpm/dep: add alpm_find_dbs_satisfier
This is a public interface for resolvedep. It looks nicer to expose it this way rather than through sync_target. This function can also be helpful for external tools as it should give good results close to how pacman select a package for satisfying a given dep. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
This commit is contained in:
parent
4097c98c1e
commit
b8590ed634
@ -439,6 +439,7 @@ typedef enum _pmdepmod_t {
|
||||
alpm_list_t *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
|
||||
alpm_list_t *remove, alpm_list_t *upgrade);
|
||||
pmpkg_t *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring);
|
||||
pmpkg_t *alpm_find_dbs_satisfier(alpm_list_t *dbs, const char *depstring);
|
||||
|
||||
const char *alpm_miss_get_target(const pmdepmissing_t *miss);
|
||||
pmdepend_t *alpm_miss_get_dep(pmdepmissing_t *miss);
|
||||
|
@ -494,6 +494,28 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
|
||||
}
|
||||
}
|
||||
|
||||
/** Find a package satisfying a specified dependency.
|
||||
* First look for a literal, going through each db one by one. Then look for
|
||||
* providers. The first satisfier found is returned.
|
||||
* The dependency can include versions with depmod operators.
|
||||
* @param dbs an alpm_list_t* of pmdb_t where the satisfier will be searched
|
||||
* @param depstring package or provision name, versioned or not
|
||||
* @return a pmpkg_t* satisfying depstring
|
||||
*/
|
||||
pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_list_t *dbs, const char *depstring)
|
||||
{
|
||||
pmdepend_t *dep;
|
||||
pmpkg_t *pkg;
|
||||
|
||||
ASSERT(dbs, return(NULL));
|
||||
|
||||
dep = _alpm_splitdep(depstring);
|
||||
ASSERT(dep, return(NULL));
|
||||
pkg = _alpm_resolvedep(dep, dbs, NULL, 1);
|
||||
_alpm_dep_free(dep);
|
||||
return(pkg);
|
||||
}
|
||||
|
||||
/**
|
||||
* helper function for resolvedeps: search for dep satisfier in dbs
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user