aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2019-05-09 22:17:46 +0200
committerFabian Groffen <grobian@gentoo.org>2019-05-09 22:17:46 +0200
commit7cf702111a7350b17443f4d9d0d76138b503dac3 (patch)
treec7843ec7d180965076e65fc5f8032968f175db24 /qdepends.c
parentlibq/atom: use less emphasis on PVR (diff)
downloadportage-utils-7cf702111a7350b17443f4d9d0d76138b503dac3.tar.gz
portage-utils-7cf702111a7350b17443f4d9d0d76138b503dac3.tar.bz2
portage-utils-7cf702111a7350b17443f4d9d0d76138b503dac3.zip
libq/tree: merge vdb and cache
since cache was basically a shadow of vdb, and vdb grew too many non-vdb-like behaviour, renamed to tree such that further features only have to be implemented once Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'qdepends.c')
-rw-r--r--qdepends.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/qdepends.c b/qdepends.c
index 64bf9918..15d52536 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -17,7 +17,7 @@
#include "atom.h"
#include "dep.h"
#include "set.h"
-#include "vdb.h"
+#include "tree.h"
#include "xarray.h"
#include "xasprintf.h"
#include "xregex.h"
@@ -92,7 +92,7 @@ qdepends_print_depend(FILE *fp, const char *depend)
}
static int
-qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
+qdepends_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
{
struct qdepends_opt_state *state = priv;
depend_atom *atom;
@@ -116,7 +116,7 @@ qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
* *DEPEND alters the search somewhat and affects results printing.
*/
- datom = vdb_get_atom(pkg_ctx, false);
+ datom = tree_get_atom(pkg_ctx, false);
if (datom == NULL)
return ret;
@@ -135,7 +135,7 @@ qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
ret = 1;
- datom = vdb_get_atom(pkg_ctx, true);
+ datom = tree_get_atom(pkg_ctx, true);
printf("%s:", atom_format(state->format, datom, 0));
}
@@ -146,7 +146,7 @@ qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
for (i = QMODE_DEPEND; i <= QMODE_BDEPEND; i <<= 1, dfile++) {
if (!(state->qmode & i))
continue;
- if (!vdb_pkg_eat(pkg_ctx, *dfile,
+ if (!tree_pkg_vdb_eat(pkg_ctx, *dfile,
&state->depend, &state->depend_len))
continue;
@@ -174,7 +174,7 @@ qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
ret = 1;
if (!firstmatch) {
- datom = vdb_get_atom(pkg_ctx, true);
+ datom = tree_get_atom(pkg_ctx, true);
printf("%s:", atom_format(state->format, datom, 0));
}
firstmatch = true;
@@ -203,7 +203,7 @@ qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
ret = 1;
if (!firstmatch) {
- datom = vdb_get_atom(pkg_ctx, true);
+ datom = tree_get_atom(pkg_ctx, true);
printf("%s:", atom_format(state->format, datom, 0));
}
firstmatch = true;
@@ -243,6 +243,7 @@ qdepends_results_cb(vdb_pkg_ctx *pkg_ctx, void *priv)
int qdepends_main(int argc, char **argv)
{
depend_atom *atom;
+ tree_ctx *vdb;
DECLARE_ARRAY(atoms);
DECLARE_ARRAY(deps);
struct qdepends_opt_state state = {
@@ -307,8 +308,11 @@ int qdepends_main(int argc, char **argv)
xarraypush_ptr(atoms, atom);
}
- ret = vdb_foreach_pkg(portroot, portvdb,
- qdepends_results_cb, &state, NULL);
+ vdb = tree_open_vdb(portroot, portvdb);
+ if (vdb != NULL) {
+ ret = tree_foreach_pkg_fast(vdb, qdepends_results_cb, &state, NULL);
+ tree_close(vdb);
+ }
if (state.depend != NULL)
free(state.depend);