forked from ariadne/pkgconf
return 1 and do not output anything a requirement is missing
parent
c04062a4ef
commit
9a26337507
81
main.c
81
main.c
|
@ -213,28 +213,48 @@ print_digraph_node(pkg_t *pkg, void *unused, unsigned int flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
apply_digraph(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
apply_digraph(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
int eflag;
|
||||||
|
|
||||||
printf("graph deptree {\n");
|
printf("graph deptree {\n");
|
||||||
printf("edge [color=blue len=7.5 fontname=Sans fontsize=8]\n");
|
printf("edge [color=blue len=7.5 fontname=Sans fontsize=8]\n");
|
||||||
printf("node [fontname=Sans fontsize=8]\n");
|
printf("node [fontname=Sans fontsize=8]\n");
|
||||||
|
|
||||||
pkg_traverse(world, print_digraph_node, unused, maxdepth, flags);
|
eflag = pkg_traverse(world, print_digraph_node, unused, maxdepth, flags);
|
||||||
|
|
||||||
|
if (eflag != PKG_ERRF_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
printf("}\n");
|
printf("}\n");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
apply_modversion(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
apply_modversion(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkg_traverse(world, print_modversion, unused, maxdepth, flags);
|
int eflag;
|
||||||
|
|
||||||
|
eflag = pkg_traverse(world, print_modversion, unused, maxdepth, flags);
|
||||||
|
|
||||||
|
if (eflag != PKG_ERRF_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
apply_variables(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
apply_variables(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkg_traverse(world, print_variables, unused, maxdepth, flags);
|
int eflag;
|
||||||
|
|
||||||
|
eflag = pkg_traverse(world, print_variables, unused, maxdepth, flags);
|
||||||
|
|
||||||
|
if (eflag != PKG_ERRF_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -263,44 +283,57 @@ print_variable(pkg_t *pkg, void *data, unsigned int flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
apply_variable(pkg_t *world, void *variable, int maxdepth, unsigned int flags)
|
apply_variable(pkg_t *world, void *variable, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
int eflag;
|
||||||
|
|
||||||
var_request_t req = {
|
var_request_t req = {
|
||||||
.variable = variable,
|
.variable = variable,
|
||||||
};
|
};
|
||||||
|
|
||||||
*req.buf = '\0';
|
*req.buf = '\0';
|
||||||
|
|
||||||
pkg_traverse(world, print_variable, &req, maxdepth, flags);
|
eflag = pkg_traverse(world, print_variable, &req, maxdepth, flags);
|
||||||
|
if (eflag != PKG_ERRF_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
printf("%s\n", req.buf);
|
printf("%s\n", req.buf);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
apply_cflags(pkg_t *world, void *list_head, int maxdepth, unsigned int flags)
|
apply_cflags(pkg_t *world, void *list_head, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkg_fragment_t **head = list_head;
|
pkg_fragment_t **head = list_head;
|
||||||
pkg_fragment_t *list;
|
pkg_fragment_t *list;
|
||||||
|
|
||||||
list = pkg_cflags(world, head, maxdepth, flags | PKGF_SEARCH_PRIVATE);
|
list = pkg_cflags(world, head, maxdepth, flags | PKGF_SEARCH_PRIVATE);
|
||||||
|
if (list == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
print_cflags(list);
|
print_cflags(list);
|
||||||
|
|
||||||
pkg_fragment_free(list);
|
pkg_fragment_free(list);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
apply_libs(pkg_t *world, void *list_head, int maxdepth, unsigned int flags)
|
apply_libs(pkg_t *world, void *list_head, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkg_fragment_t **head = list_head;
|
pkg_fragment_t **head = list_head;
|
||||||
pkg_fragment_t *list;
|
pkg_fragment_t *list;
|
||||||
|
|
||||||
list = pkg_libs(world, head, maxdepth, flags);
|
list = pkg_libs(world, head, maxdepth, flags);
|
||||||
|
if (list == NULL)
|
||||||
|
return false;
|
||||||
print_libs(list);
|
print_libs(list);
|
||||||
|
|
||||||
pkg_fragment_free(list);
|
pkg_fragment_free(list);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
apply_requires(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
apply_requires(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkg_dependency_t *iter;
|
pkg_dependency_t *iter;
|
||||||
|
@ -316,9 +349,10 @@ apply_requires(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
||||||
|
|
||||||
pkg_free(pkg);
|
pkg_free(pkg);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
apply_requires_private(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
apply_requires_private(pkg_t *world, void *unused, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkg_dependency_t *iter;
|
pkg_dependency_t *iter;
|
||||||
|
@ -334,6 +368,7 @@ apply_requires_private(pkg_t *world, void *unused, int maxdepth, unsigned int fl
|
||||||
|
|
||||||
pkg_free(pkg);
|
pkg_free(pkg);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -346,10 +381,17 @@ check_uninstalled(pkg_t *pkg, void *data, unsigned int flags)
|
||||||
*retval = EXIT_SUCCESS;
|
*retval = EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
apply_uninstalled(pkg_t *world, void *data, int maxdepth, unsigned int flags)
|
apply_uninstalled(pkg_t *world, void *data, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkg_traverse(world, check_uninstalled, data, maxdepth, flags);
|
int eflag;
|
||||||
|
|
||||||
|
eflag = pkg_traverse(world, check_uninstalled, data, maxdepth, flags);
|
||||||
|
|
||||||
|
if (eflag != PKG_ERRF_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -361,10 +403,17 @@ print_graph_node(pkg_t *pkg, void *data, unsigned int flags)
|
||||||
printf("Considering graph node '%s' (%p)\n", pkg->id, pkg);
|
printf("Considering graph node '%s' (%p)\n", pkg->id, pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
apply_simulate(pkg_t *world, void *data, int maxdepth, unsigned int flags)
|
apply_simulate(pkg_t *world, void *data, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkg_traverse(world, print_graph_node, data, maxdepth, flags);
|
int eflag;
|
||||||
|
|
||||||
|
eflag = pkg_traverse(world, print_graph_node, data, maxdepth, flags);
|
||||||
|
|
||||||
|
if (eflag != PKG_ERRF_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
29
pkg.c
29
pkg.c
|
@ -850,7 +850,15 @@ pkg_cflags_collect(pkg_t *pkg, void *data, unsigned int flags)
|
||||||
pkg_fragment_t *
|
pkg_fragment_t *
|
||||||
pkg_cflags(pkg_t *root, pkg_fragment_t **list, int maxdepth, unsigned int flags)
|
pkg_cflags(pkg_t *root, pkg_fragment_t **list, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkg_traverse(root, pkg_cflags_collect, list, maxdepth, flags);
|
int eflag;
|
||||||
|
|
||||||
|
eflag = pkg_traverse(root, pkg_cflags_collect, list, maxdepth, flags);
|
||||||
|
|
||||||
|
if (eflag != PKG_ERRF_OK)
|
||||||
|
{
|
||||||
|
pkg_fragment_free(*list);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return *list;
|
return *list;
|
||||||
}
|
}
|
||||||
|
@ -880,10 +888,25 @@ pkg_libs_private_collect(pkg_t *pkg, void *data, unsigned int flags)
|
||||||
pkg_fragment_t *
|
pkg_fragment_t *
|
||||||
pkg_libs(pkg_t *root, pkg_fragment_t **list, int maxdepth, unsigned int flags)
|
pkg_libs(pkg_t *root, pkg_fragment_t **list, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkg_traverse(root, pkg_libs_collect, list, maxdepth, flags);
|
int eflag;
|
||||||
|
|
||||||
|
eflag = pkg_traverse(root, pkg_libs_collect, list, maxdepth, flags);
|
||||||
|
|
||||||
|
if (eflag != PKG_ERRF_OK)
|
||||||
|
{
|
||||||
|
pkg_fragment_free(*list);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & PKGF_MERGE_PRIVATE_FRAGMENTS)
|
if (flags & PKGF_MERGE_PRIVATE_FRAGMENTS)
|
||||||
pkg_traverse(root, pkg_libs_private_collect, list, maxdepth, flags);
|
{
|
||||||
|
eflag = pkg_traverse(root, pkg_libs_private_collect, list, maxdepth, flags);
|
||||||
|
if (eflag != PKG_ERRF_OK)
|
||||||
|
{
|
||||||
|
pkg_fragment_free(*list);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return *list;
|
return *list;
|
||||||
}
|
}
|
||||||
|
|
2
pkg.h
2
pkg.h
|
@ -122,7 +122,7 @@ struct pkg_ {
|
||||||
|
|
||||||
typedef void (*pkg_iteration_func_t)(const pkg_t *pkg);
|
typedef void (*pkg_iteration_func_t)(const pkg_t *pkg);
|
||||||
typedef void (*pkg_traverse_func_t)(pkg_t *pkg, void *data, unsigned int flags);
|
typedef void (*pkg_traverse_func_t)(pkg_t *pkg, void *data, unsigned int flags);
|
||||||
typedef void (*pkg_queue_apply_func_t)(pkg_t *world, void *data, int maxdepth, unsigned int flags);
|
typedef bool (*pkg_queue_apply_func_t)(pkg_t *world, void *data, int maxdepth, unsigned int flags);
|
||||||
|
|
||||||
/* pkg.c */
|
/* pkg.c */
|
||||||
void pkg_free(pkg_t *pkg);
|
void pkg_free(pkg_t *pkg);
|
||||||
|
|
6
queue.c
6
queue.c
|
@ -85,7 +85,11 @@ pkg_queue_apply(pkg_queue_t *head, pkg_queue_apply_func_t func, int maxdepth, un
|
||||||
if (pkg_queue_verify(&world, head, maxdepth, flags) != PKG_ERRF_OK)
|
if (pkg_queue_verify(&world, head, maxdepth, flags) != PKG_ERRF_OK)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
func(&world, data, maxdepth, flags);
|
if (!func(&world, data, maxdepth, flags))
|
||||||
|
{
|
||||||
|
pkg_free(&world);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pkg_free(&world);
|
pkg_free(&world);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
prefix=/usr
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${prefix}/lib
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: missing-require
|
||||||
|
Description: A testing pkg-config file
|
||||||
|
Version: 1.2.3
|
||||||
|
Requires.private: missing
|
||||||
|
Libs: -L${libdir} -lfoo
|
||||||
|
Cflags: -fPIC -I${includedir}/foo
|
|
@ -163,6 +163,10 @@ run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --max-version 1.0 'foo '; echo \$
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --max-version 2.0 'foo '; echo \$?" \
|
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --max-version 2.0 'foo '; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
|
|
||||||
|
# test missing requires
|
||||||
|
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags missing-require; echo \$?" \
|
||||||
|
'1'
|
||||||
|
|
||||||
# 10) tests for internal getopt implementation with options at the end
|
# 10) tests for internal getopt implementation with options at the end
|
||||||
if [ "x@STRICT_MODE@" = "xno" ]; then
|
if [ "x@STRICT_MODE@" = "xno" ]; then
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} foo --libs" \
|
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} foo --libs" \
|
||||||
|
|
Loading…
Reference in New Issue