index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Chantry Xavier <shiningxc@gmail.com> | 2007-11-17 13:06:44 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-11-17 09:50:05 -0600 |
commit | c8be7540a50583194e971918099006a1736cfab7 (patch) | |
tree | f60c90adfe74a3a30535f0252880fa36b2d6264b /lib/libalpm/db.c | |
parent | d311ad067f47608252b9276df90087db98b1100f (diff) |
-rw-r--r-- | lib/libalpm/db.c | 25 |
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index f7621338..1e2e6b24 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -43,7 +43,6 @@ #include "util.h" #include "error.h" #include "server.h" -#include "provide.h" #include "handle.h" #include "cache.h" #include "alpm.h" @@ -780,4 +779,28 @@ pmdb_t *_alpm_db_register_sync(const char *treename) return(db); } +/* return a alpm_list_t of packages in "db" that provide "package" + */ +alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package) +{ + alpm_list_t *pkgs = NULL; + alpm_list_t *lp; + + ALPM_LOG_FUNC; + + if(db == NULL || package == NULL || strlen(package) == 0) { + return(NULL); + } + + for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) { + pmpkg_t *info = lp->data; + + if(alpm_list_find_str(alpm_pkg_get_provides(info), package)) { + pkgs = alpm_list_add(pkgs, info); + } + } + + return(pkgs); +} + /* vim: set ts=2 sw=2 noet: */ |