Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/deps.c
diff options
context:
space:
mode:
authorXavier Chantry <chantry.xavier@gmail.com>2010-10-12 20:13:32 +0200
committerDan McGee <dan@archlinux.org>2010-12-12 20:07:58 -0600
commita03daad0734428ded0398c9d71582f90063f3493 (patch)
tree8482a8751c8f2dbc8d509752429a54a9a158e7e6 /lib/libalpm/deps.c
parentc2cce1f46a754c04c3623088a9e43922a6c10e2d (diff)
alpm: add new alpm_find_satisfier function
whatprovides and splitdep were removed, so depcmp alone is quite useless now without splitdep, and deptest is not flexible enough. Introduce a new alpm_find_satisfier which is hopefully more flexible, this should make implementation of deptest very easy, and also help alpm tools such as pactree. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/deps.c')
-rw-r--r--lib/libalpm/deps.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 0d8683c2..b652b19a 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -202,6 +202,20 @@ pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep)
return(NULL);
}
+/** 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 depstring package or provision name, versioned or not
+ * @return a pmpkg_t* satisfying depstring
+ */
+pmpkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
+{
+ pmdepend_t *dep = _alpm_splitdep(depstring);
+ pmpkg_t *pkg = _alpm_find_dep_satisfier(pkgs, dep);
+ _alpm_dep_free(dep);
+ return(pkg);
+}
+
/** Checks dependencies and returns missing ones in a list.
* Dependencies can include versions with depmod operators.
* @param db pointer to the local package database