1*a3cefe7fSPierre Pronchery 2*a3cefe7fSPierre Proncherylibpkgconf `pkg` module 3*a3cefe7fSPierre Pronchery======================= 4*a3cefe7fSPierre Pronchery 5*a3cefe7fSPierre ProncheryThe `pkg` module provides dependency resolution services and the overall `.pc` file parsing 6*a3cefe7fSPierre Proncheryroutines. 7*a3cefe7fSPierre Pronchery 8*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename, FILE *f, unsigned int flags) 9*a3cefe7fSPierre Pronchery 10*a3cefe7fSPierre Pronchery Parse a .pc file into a pkgconf_pkg_t object structure. 11*a3cefe7fSPierre Pronchery 12*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. 13*a3cefe7fSPierre Pronchery :param char* filename: The filename of the package file (including full path). 14*a3cefe7fSPierre Pronchery :param FILE* f: The file object to read from. 15*a3cefe7fSPierre Pronchery :param uint flags: The flags to use when parsing. 16*a3cefe7fSPierre Pronchery :returns: A ``pkgconf_pkg_t`` object which contains the package data. 17*a3cefe7fSPierre Pronchery :rtype: pkgconf_pkg_t * 18*a3cefe7fSPierre Pronchery 19*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_pkg_free(pkgconf_client_t *client, pkgconf_pkg_t *pkg) 20*a3cefe7fSPierre Pronchery 21*a3cefe7fSPierre Pronchery Releases all releases for a given ``pkgconf_pkg_t`` object. 22*a3cefe7fSPierre Pronchery 23*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client which owns the ``pkgconf_pkg_t`` object, `pkg`. 24*a3cefe7fSPierre Pronchery :param pkgconf_pkg_t* pkg: The package to free. 25*a3cefe7fSPierre Pronchery :return: nothing 26*a3cefe7fSPierre Pronchery 27*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_pkg_t *pkgconf_pkg_ref(const pkgconf_client_t *client, pkgconf_pkg_t *pkg) 28*a3cefe7fSPierre Pronchery 29*a3cefe7fSPierre Pronchery Adds an additional reference to the package object. 30*a3cefe7fSPierre Pronchery 31*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object which owns the package being referenced. 32*a3cefe7fSPierre Pronchery :param pkgconf_pkg_t* pkg: The package object being referenced. 33*a3cefe7fSPierre Pronchery :return: The package itself with an incremented reference count. 34*a3cefe7fSPierre Pronchery :rtype: pkgconf_pkg_t * 35*a3cefe7fSPierre Pronchery 36*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_pkg_unref(pkgconf_client_t *client, pkgconf_pkg_t *pkg) 37*a3cefe7fSPierre Pronchery 38*a3cefe7fSPierre Pronchery Releases a reference on the package object. If the reference count is 0, then also free the package. 39*a3cefe7fSPierre Pronchery 40*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object which owns the package being dereferenced. 41*a3cefe7fSPierre Pronchery :param pkgconf_pkg_t* pkg: The package object being dereferenced. 42*a3cefe7fSPierre Pronchery :return: nothing 43*a3cefe7fSPierre Pronchery 44*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_pkg_t *pkgconf_scan_all(pkgconf_client_t *client, void *data, pkgconf_pkg_iteration_func_t func) 45*a3cefe7fSPierre Pronchery 46*a3cefe7fSPierre Pronchery Iterates over all packages found in the `package directory list`, running ``func`` on them. If ``func`` returns true, 47*a3cefe7fSPierre Pronchery then stop iteration and return the last iterated package. 48*a3cefe7fSPierre Pronchery 49*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. 50*a3cefe7fSPierre Pronchery :param void* data: An opaque pointer to data to provide the iteration function with. 51*a3cefe7fSPierre Pronchery :param pkgconf_pkg_iteration_func_t func: A function which is called for each package to determine if the package matches, 52*a3cefe7fSPierre Pronchery always return ``false`` to iterate over all packages. 53*a3cefe7fSPierre Pronchery :return: A package object reference if one is found by the scan function, else ``NULL``. 54*a3cefe7fSPierre Pronchery :rtype: pkgconf_pkg_t * 55*a3cefe7fSPierre Pronchery 56*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_pkg_t *pkgconf_pkg_find(pkgconf_client_t *client, const char *name) 57*a3cefe7fSPierre Pronchery 58*a3cefe7fSPierre Pronchery Search for a package. 59*a3cefe7fSPierre Pronchery 60*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. 61*a3cefe7fSPierre Pronchery :param char* name: The name of the package `atom` to use for searching. 62*a3cefe7fSPierre Pronchery :return: A package object reference if the package was found, else ``NULL``. 63*a3cefe7fSPierre Pronchery :rtype: pkgconf_pkg_t * 64*a3cefe7fSPierre Pronchery 65*a3cefe7fSPierre Pronchery.. c:function:: int pkgconf_compare_version(const char *a, const char *b) 66*a3cefe7fSPierre Pronchery 67*a3cefe7fSPierre Pronchery Compare versions using RPM version comparison rules as described in the LSB. 68*a3cefe7fSPierre Pronchery 69*a3cefe7fSPierre Pronchery :param char* a: The first version to compare in the pair. 70*a3cefe7fSPierre Pronchery :param char* b: The second version to compare in the pair. 71*a3cefe7fSPierre Pronchery :return: -1 if the first version is less than, 0 if both versions are equal, 1 if the second version is less than. 72*a3cefe7fSPierre Pronchery :rtype: int 73*a3cefe7fSPierre Pronchery 74*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_pkg_t *pkgconf_builtin_pkg_get(const char *name) 75*a3cefe7fSPierre Pronchery 76*a3cefe7fSPierre Pronchery Looks up a built-in package. The package should not be freed or dereferenced. 77*a3cefe7fSPierre Pronchery 78*a3cefe7fSPierre Pronchery :param char* name: An atom corresponding to a built-in package to search for. 79*a3cefe7fSPierre Pronchery :return: the built-in package if present, else ``NULL``. 80*a3cefe7fSPierre Pronchery :rtype: pkgconf_pkg_t * 81*a3cefe7fSPierre Pronchery 82*a3cefe7fSPierre Pronchery.. c:function:: const char *pkgconf_pkg_get_comparator(const pkgconf_dependency_t *pkgdep) 83*a3cefe7fSPierre Pronchery 84*a3cefe7fSPierre Pronchery Returns the comparator used in a depgraph dependency node as a string. 85*a3cefe7fSPierre Pronchery 86*a3cefe7fSPierre Pronchery :param pkgconf_dependency_t* pkgdep: The depgraph dependency node to return the comparator for. 87*a3cefe7fSPierre Pronchery :return: A string matching the comparator or ``"???"``. 88*a3cefe7fSPierre Pronchery :rtype: char * 89*a3cefe7fSPierre Pronchery 90*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_pkg_comparator_t pkgconf_pkg_comparator_lookup_by_name(const char *name) 91*a3cefe7fSPierre Pronchery 92*a3cefe7fSPierre Pronchery Look up the appropriate comparator bytecode in the comparator set (defined 93*a3cefe7fSPierre Pronchery in ``pkg.c``, see ``pkgconf_pkg_comparator_names`` and ``pkgconf_pkg_comparator_impls``). 94*a3cefe7fSPierre Pronchery 95*a3cefe7fSPierre Pronchery :param char* name: The comparator to look up by `name`. 96*a3cefe7fSPierre Pronchery :return: The comparator bytecode if found, else ``PKGCONF_CMP_ANY``. 97*a3cefe7fSPierre Pronchery :rtype: pkgconf_pkg_comparator_t 98*a3cefe7fSPierre Pronchery 99*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_pkg_t *pkgconf_pkg_verify_dependency(pkgconf_client_t *client, pkgconf_dependency_t *pkgdep, unsigned int *eflags) 100*a3cefe7fSPierre Pronchery 101*a3cefe7fSPierre Pronchery Verify a pkgconf_dependency_t node in the depgraph. If the dependency is solvable, 102*a3cefe7fSPierre Pronchery return the appropriate ``pkgconf_pkg_t`` object, else ``NULL``. 103*a3cefe7fSPierre Pronchery 104*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. 105*a3cefe7fSPierre Pronchery :param pkgconf_dependency_t* pkgdep: The dependency graph node to solve. 106*a3cefe7fSPierre Pronchery :param uint* eflags: An optional pointer that, if set, will be populated with an error code from the resolver. 107*a3cefe7fSPierre Pronchery :return: On success, the appropriate ``pkgconf_pkg_t`` object to solve the dependency, else ``NULL``. 108*a3cefe7fSPierre Pronchery :rtype: pkgconf_pkg_t * 109*a3cefe7fSPierre Pronchery 110*a3cefe7fSPierre Pronchery.. c:function:: unsigned int pkgconf_pkg_verify_graph(pkgconf_client_t *client, pkgconf_pkg_t *root, int depth) 111*a3cefe7fSPierre Pronchery 112*a3cefe7fSPierre Pronchery Verify the graph dependency nodes are satisfiable by walking the tree using 113*a3cefe7fSPierre Pronchery ``pkgconf_pkg_traverse()``. 114*a3cefe7fSPierre Pronchery 115*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. 116*a3cefe7fSPierre Pronchery :param pkgconf_pkg_t* root: The root entry in the package dependency graph which should contain the top-level dependencies to resolve. 117*a3cefe7fSPierre Pronchery :param int depth: The maximum allowed depth for dependency resolution. 118*a3cefe7fSPierre Pronchery :return: On success, ``PKGCONF_PKG_ERRF_OK`` (0), else an error code. 119*a3cefe7fSPierre Pronchery :rtype: unsigned int 120*a3cefe7fSPierre Pronchery 121*a3cefe7fSPierre Pronchery.. c:function:: unsigned int pkgconf_pkg_traverse(pkgconf_client_t *client, pkgconf_pkg_t *root, pkgconf_pkg_traverse_func_t func, void *data, int maxdepth, unsigned int skip_flags) 122*a3cefe7fSPierre Pronchery 123*a3cefe7fSPierre Pronchery Walk and resolve the dependency graph up to `maxdepth` levels. 124*a3cefe7fSPierre Pronchery 125*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. 126*a3cefe7fSPierre Pronchery :param pkgconf_pkg_t* root: The root of the dependency graph. 127*a3cefe7fSPierre Pronchery :param pkgconf_pkg_traverse_func_t func: A traversal function to call for each resolved node in the dependency graph. 128*a3cefe7fSPierre Pronchery :param void* data: An opaque pointer to data to be passed to the traversal function. 129*a3cefe7fSPierre Pronchery :param int maxdepth: The maximum depth to walk the dependency graph for. -1 means infinite recursion. 130*a3cefe7fSPierre Pronchery :param uint skip_flags: Skip over dependency nodes containing the specified flags. A setting of 0 skips no dependency nodes. 131*a3cefe7fSPierre Pronchery :return: ``PKGCONF_PKG_ERRF_OK`` on success, else an error code. 132*a3cefe7fSPierre Pronchery :rtype: unsigned int 133*a3cefe7fSPierre Pronchery 134*a3cefe7fSPierre Pronchery.. c:function:: int pkgconf_pkg_cflags(pkgconf_client_t *client, pkgconf_pkg_t *root, pkgconf_list_t *list, int maxdepth) 135*a3cefe7fSPierre Pronchery 136*a3cefe7fSPierre Pronchery Walks a dependency graph and extracts relevant ``CFLAGS`` fragments. 137*a3cefe7fSPierre Pronchery 138*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. 139*a3cefe7fSPierre Pronchery :param pkgconf_pkg_t* root: The root of the dependency graph. 140*a3cefe7fSPierre Pronchery :param pkgconf_list_t* list: The fragment list to add the extracted ``CFLAGS`` fragments to. 141*a3cefe7fSPierre Pronchery :param int maxdepth: The maximum allowed depth for dependency resolution. -1 means infinite recursion. 142*a3cefe7fSPierre Pronchery :return: ``PKGCONF_PKG_ERRF_OK`` if successful, otherwise an error code. 143*a3cefe7fSPierre Pronchery :rtype: unsigned int 144*a3cefe7fSPierre Pronchery 145*a3cefe7fSPierre Pronchery.. c:function:: int pkgconf_pkg_libs(pkgconf_client_t *client, pkgconf_pkg_t *root, pkgconf_list_t *list, int maxdepth) 146*a3cefe7fSPierre Pronchery 147*a3cefe7fSPierre Pronchery Walks a dependency graph and extracts relevant ``LIBS`` fragments. 148*a3cefe7fSPierre Pronchery 149*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. 150*a3cefe7fSPierre Pronchery :param pkgconf_pkg_t* root: The root of the dependency graph. 151*a3cefe7fSPierre Pronchery :param pkgconf_list_t* list: The fragment list to add the extracted ``LIBS`` fragments to. 152*a3cefe7fSPierre Pronchery :param int maxdepth: The maximum allowed depth for dependency resolution. -1 means infinite recursion. 153*a3cefe7fSPierre Pronchery :return: ``PKGCONF_PKG_ERRF_OK`` if successful, otherwise an error code. 154*a3cefe7fSPierre Pronchery :rtype: unsigned int 155