forked from ariadne/pkgconf
pkg: add pkg_verify_graph() to verify the depgraph is satisfiable
parent
95298b4c72
commit
8100eb84f0
3
main.c
3
main.c
|
@ -101,6 +101,9 @@ pkg_queue_walk(pkg_queue_t *head)
|
||||||
world.requires = pkg_dependency_append(world.requires, pkgdep);
|
world.requires = pkg_dependency_append(world.requires, pkgdep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we should verify that the graph is complete before attempting to compute cflags etc. */
|
||||||
|
pkg_verify_graph(&world, maximum_traverse_depth);
|
||||||
|
|
||||||
if (want_modversion)
|
if (want_modversion)
|
||||||
{
|
{
|
||||||
wanted_something = 0;
|
wanted_something = 0;
|
||||||
|
|
13
pkg.c
13
pkg.c
|
@ -33,6 +33,18 @@ pkg_find(const char *name)
|
||||||
return parse_file(locbuf);
|
return parse_file(locbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* pkg_verify_graph(root, depth)
|
||||||
|
*
|
||||||
|
* verify the graph dependency nodes are satisfiable by walking the tree using
|
||||||
|
* pkg_traverse().
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
pkg_verify_graph(pkg_t *root, int depth)
|
||||||
|
{
|
||||||
|
pkg_traverse(root, NULL, NULL, depth);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pkg_traverse(pkg_t *root,
|
pkg_traverse(pkg_t *root,
|
||||||
void (*pkg_traverse_func)(pkg_t *package, void *data),
|
void (*pkg_traverse_func)(pkg_t *package, void *data),
|
||||||
|
@ -64,5 +76,6 @@ pkg_traverse(pkg_t *root,
|
||||||
pkg_traverse(pkgdep, pkg_traverse_func, data, maxdepth - 1);
|
pkg_traverse(pkgdep, pkg_traverse_func, data, maxdepth - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pkg_traverse_func != NULL)
|
||||||
pkg_traverse_func(root, data);
|
pkg_traverse_func(root, data);
|
||||||
}
|
}
|
||||||
|
|
1
pkg.h
1
pkg.h
|
@ -87,6 +87,7 @@ struct pkg_ {
|
||||||
|
|
||||||
pkg_t *pkg_find(const char *name);
|
pkg_t *pkg_find(const char *name);
|
||||||
void pkg_traverse(pkg_t *root, void (*pkg_traverse_func)(pkg_t *package, void *data), void *data, int maxdepth);
|
void pkg_traverse(pkg_t *root, void (*pkg_traverse_func)(pkg_t *package, void *data), void *data, int maxdepth);
|
||||||
|
void pkg_verify_graph(pkg_t *root, int depth);
|
||||||
|
|
||||||
/* parse.c */
|
/* parse.c */
|
||||||
pkg_t *parse_file(const char *path);
|
pkg_t *parse_file(const char *path);
|
||||||
|
|
Loading…
Reference in New Issue