libpkgconf queue module

The queue module provides an interface that allows easily building a dependency graph from an arbitrary set of dependencies. It also provides support for doing “preflight” checks on the entire dependency graph prior to working with it.

Using the queue module functions is the recommended way of working with dependency graphs.

void pkgconf_queue_push(pkgconf_list_t *list, const char *package)

Pushes a requested dependency onto the dependency resolver’s queue.

Parameters:
  • list (pkgconf_list_t*) – the dependency resolution queue to add the package request to.
  • package (char*) – the dependency atom requested
Returns:

nothing

bool pkgconf_queue_compile(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list)

Compile a dependency resolution queue into a dependency resolution problem if possible, otherwise report an error.

Parameters:
  • client (pkgconf_client_t*) – The pkgconf client object to use for dependency resolution.
  • world (pkgconf_pkg_t*) – The designated root of the dependency graph.
  • list (pkgconf_list_t*) – The list of dependency requests to consider.
Returns:

true if the built dependency resolution problem is consistent, else false

Return type:

bool

void pkgconf_queue_free(pkgconf_list_t *list)

Release any memory related to a dependency resolution queue.

Parameters:
  • list (pkgconf_list_t*) – The dependency resolution queue to release.
Returns:

nothing

void pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world, int maxdepth)

Removes references to package nodes contained in a solution.

Parameters:
  • client (pkgconf_client_t*) – The pkgconf client object to use for dependency resolution.
  • world (pkgconf_pkg_t*) – The root for the generated dependency graph. Should have PKGCONF_PKG_PROPF_VIRTUAL flag.
Returns:

nothing

bool pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_t *world, int maxdepth)

Solves and flattens the dependency graph for the supplied dependency list.

Parameters:
  • client (pkgconf_client_t*) – The pkgconf client object to use for dependency resolution.
  • list (pkgconf_list_t*) – The list of dependency requests to consider.
  • world (pkgconf_pkg_t*) – The root for the generated dependency graph, provided by the caller. Should have PKGCONF_PKG_PROPF_VIRTUAL flag.
  • maxdepth (int) – The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
Returns:

true if the dependency resolver found a solution, otherwise false.

Return type:

bool

void pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)

Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and feed the solution to a callback function if a complete dependency graph is found.

This function should not be used in new code. Use pkgconf_queue_solve instead.

Parameters:
  • client (pkgconf_client_t*) – The pkgconf client object to use for dependency resolution.
  • list (pkgconf_list_t*) – The list of dependency requests to consider.
  • func (pkgconf_queue_apply_func_t) – The callback function to call if a solution is found by the dependency resolver.
  • maxdepth (int) – The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
  • data (void*) – An opaque pointer which is passed to the callback function.
Returns:

true if the dependency resolver found a solution, otherwise false.

Return type:

bool

void pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)

Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem.

Parameters:
  • client (pkgconf_client_t*) – The pkgconf client object to use for dependency resolution.
  • list (pkgconf_list_t*) – The list of dependency requests to consider.
  • maxdepth (int) – The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
Returns:

true if the dependency resolver found a solution, otherwise false.

Return type:

bool