main: implement --short-errors (#115)

pull/116/head
William Pitcock 2017-02-27 09:54:02 -06:00
parent ec42e4f8d2
commit 81011ba522
3 changed files with 22 additions and 15 deletions

View File

@ -185,19 +185,20 @@ void pkgconf_client_set_trace_handler(pkgconf_client_t *client, pkgconf_error_ha
#define PKGCONF_IS_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((unsigned int)(c)))
#define PKGCONF_IS_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
#define PKGCONF_PKG_PKGF_NONE 0x000
#define PKGCONF_PKG_PKGF_SEARCH_PRIVATE 0x001
#define PKGCONF_PKG_PKGF_ENV_ONLY 0x002
#define PKGCONF_PKG_PKGF_NO_UNINSTALLED 0x004
#define PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL 0x008
#define PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS 0x010
#define PKGCONF_PKG_PKGF_SKIP_CONFLICTS 0x020
#define PKGCONF_PKG_PKGF_NO_CACHE 0x040
#define PKGCONF_PKG_PKGF_SKIP_ERRORS 0x080
#define PKGCONF_PKG_PKGF_ITER_PKG_IS_PRIVATE 0x100
#define PKGCONF_PKG_PKGF_SKIP_PROVIDES 0x200
#define PKGCONF_PKG_PKGF_REDEFINE_PREFIX 0x400
#define PKGCONF_PKG_PKGF_DONT_RELOCATE_PATHS 0x800
#define PKGCONF_PKG_PKGF_NONE 0x0000
#define PKGCONF_PKG_PKGF_SEARCH_PRIVATE 0x0001
#define PKGCONF_PKG_PKGF_ENV_ONLY 0x0002
#define PKGCONF_PKG_PKGF_NO_UNINSTALLED 0x0004
#define PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL 0x0008
#define PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS 0x0010
#define PKGCONF_PKG_PKGF_SKIP_CONFLICTS 0x0020
#define PKGCONF_PKG_PKGF_NO_CACHE 0x0040
#define PKGCONF_PKG_PKGF_SKIP_ERRORS 0x0080
#define PKGCONF_PKG_PKGF_ITER_PKG_IS_PRIVATE 0x0100
#define PKGCONF_PKG_PKGF_SKIP_PROVIDES 0x0200
#define PKGCONF_PKG_PKGF_REDEFINE_PREFIX 0x0400
#define PKGCONF_PKG_PKGF_DONT_RELOCATE_PATHS 0x0800
#define PKGCONF_PKG_PKGF_SIMPLIFY_ERRORS 0x1000
#define PKGCONF_PKG_ERRF_OK 0x0
#define PKGCONF_PKG_ERRF_PACKAGE_NOT_FOUND 0x1

View File

@ -1241,7 +1241,7 @@ pkgconf_pkg_report_graph_error(pkgconf_client_t *client, pkgconf_pkg_t *parent,
if (eflags & PKGCONF_PKG_ERRF_PACKAGE_NOT_FOUND)
{
if (!already_sent_notice)
if (!(client->flags & PKGCONF_PKG_PKGF_SIMPLIFY_ERRORS) & !already_sent_notice)
{
pkgconf_error(client, "Package %s was not found in the pkg-config search path.\n", node->package);
pkgconf_error(client, "Perhaps you should add the directory containing `%s.pc'\n", node->package);

8
main.c
View File

@ -56,6 +56,7 @@
#define PKG_DONT_DEFINE_PREFIX (((uint64_t) 1) << 36)
#define PKG_DONT_RELOCATE_PATHS (((uint64_t) 1) << 37)
#define PKG_DEBUG (((uint64_t) 1) << 38)
#define PKG_SHORT_ERRORS (((uint64_t) 1) << 39)
static pkgconf_client_t pkg_client;
@ -565,6 +566,8 @@ usage(void)
printf(" --atleast-pkgconfig-version check whether or not pkgconf is compatible\n");
printf(" with a specified pkg-config version\n");
printf(" --errors-to-stdout print all errors on stdout instead of stderr\n");
printf(" --print-errors ensure all errors are printed\n");
printf(" --short-errors be less verbose about some errors\n");
printf(" --silence-errors explicitly be silent about errors\n");
printf(" --list-all list all known packages\n");
printf(" --list-package-names list all known package names\n");
@ -661,7 +664,7 @@ main(int argc, char *argv[])
{ "variable", required_argument, NULL, 7, },
{ "exists", no_argument, NULL, 8, },
{ "print-errors", no_argument, &want_flags, PKG_PRINT_ERRORS, },
{ "short-errors", no_argument, NULL, 10, },
{ "short-errors", no_argument, &want_flags, PKG_SHORT_ERRORS, },
{ "maximum-traverse-depth", required_argument, NULL, 11, },
{ "static", no_argument, &want_flags, PKG_STATIC, },
{ "pure", no_argument, &want_flags, PKG_PURE, },
@ -804,6 +807,9 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
}
if ((want_flags & PKG_SHORT_ERRORS) == PKG_SHORT_ERRORS)
want_client_flags |= PKGCONF_PKG_PKGF_SIMPLIFY_ERRORS;
if ((want_flags & PKG_DONT_RELOCATE_PATHS) == PKG_DONT_RELOCATE_PATHS)
want_client_flags |= PKGCONF_PKG_PKGF_DONT_RELOCATE_PATHS;