main: implement --validate as in pkg-config 0.29 git

pull/81/head
William Pitcock 2015-05-21 23:20:40 -05:00
parent 57924dcee2
commit b0b73149f8
1 changed files with 6 additions and 0 deletions

6
main.c
View File

@ -46,6 +46,7 @@
#define PKG_SIMULATE (1<<27) #define PKG_SIMULATE (1<<27)
#define PKG_NO_CACHE (1<<28) #define PKG_NO_CACHE (1<<28)
#define PKG_PROVIDES (1<<29) #define PKG_PROVIDES (1<<29)
#define PKG_VALIDATE (1<<30)
static unsigned int global_traverse_flags = PKGF_NONE; static unsigned int global_traverse_flags = PKGF_NONE;
@ -538,6 +539,7 @@ usage(void)
printf(" (for static linking)\n"); printf(" (for static linking)\n");
printf(" --env-only look only for package entries in PKG_CONFIG_PATH\n"); printf(" --env-only look only for package entries in PKG_CONFIG_PATH\n");
printf(" --ignore-conflicts ignore 'conflicts' rules in modules\n"); printf(" --ignore-conflicts ignore 'conflicts' rules in modules\n");
printf(" --validate validate specific .pc files for correctness\n");
printf("\nquerying specific pkg-config database fields:\n\n"); printf("\nquerying specific pkg-config database fields:\n\n");
@ -614,6 +616,7 @@ main(int argc, char *argv[])
{ "no-cache", no_argument, &want_flags, PKG_NO_CACHE, }, { "no-cache", no_argument, &want_flags, PKG_NO_CACHE, },
{ "print-provides", no_argument, &want_flags, PKG_PROVIDES, }, { "print-provides", no_argument, &want_flags, PKG_PROVIDES, },
{ "debug", no_argument, &want_flags, 0, }, { "debug", no_argument, &want_flags, 0, },
{ "validate", no_argument, NULL, 0 },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@ -869,6 +872,9 @@ main(int argc, char *argv[])
goto out; goto out;
} }
if ((want_flags & PKG_VALIDATE) == PKG_VALIDATE)
return 0;
if ((want_flags & PKG_UNINSTALLED) == PKG_UNINSTALLED) if ((want_flags & PKG_UNINSTALLED) == PKG_UNINSTALLED)
{ {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;