main: --simulate: enhancements

feature/tap-sh
William Pitcock 2013-03-15 19:59:20 -05:00
parent 74c33b9f61
commit f9d93a1f81
3 changed files with 26 additions and 28 deletions

33
main.c
View File

@ -412,12 +412,10 @@ print_graph_node(pkg_t *pkg, void *data, unsigned int flags)
(void) data;
(void) flags;
printf("node '%s'", pkg->id);
printf("node '%s' {\n", pkg->id);
if (pkg->requires.head != NULL)
printf(" {\n");
else
printf(";\n");
if (pkg->version != NULL)
printf(" version = '%s';\n", pkg->version);
PKG_FOREACH_LIST_ENTRY(pkg->requires.head, n)
{
@ -434,8 +432,7 @@ print_graph_node(pkg_t *pkg, void *data, unsigned int flags)
printf(";\n");
}
if (pkg->requires.head != NULL)
printf("};\n");
printf("};\n");
}
static bool
@ -823,6 +820,17 @@ main(int argc, char *argv[])
ret = EXIT_SUCCESS;
if ((want_flags & PKG_SIMULATE) == PKG_SIMULATE)
{
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkg_queue_apply(&pkgq, apply_simulate, -1, global_traverse_flags | PKGF_SKIP_ERRORS, NULL))
{
ret = EXIT_FAILURE;
goto out;
}
}
if (!pkg_queue_validate(&pkgq, maximum_traverse_depth, global_traverse_flags))
{
ret = EXIT_FAILURE;
@ -847,17 +855,6 @@ main(int argc, char *argv[])
}
}
if ((want_flags & PKG_SIMULATE) == PKG_SIMULATE)
{
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
if (!pkg_queue_apply(&pkgq, apply_simulate, -1, global_traverse_flags, NULL))
{
ret = EXIT_FAILURE;
goto out;
}
}
if ((want_flags & PKG_MODVERSION) == PKG_MODVERSION)
{
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);

2
pkg.c
View File

@ -865,7 +865,7 @@ pkg_walk_list(pkg_t *parent,
continue;
pkgdep = pkg_verify_dependency(depnode, flags, &eflags);
if (eflags != PKG_ERRF_OK)
if (eflags != PKG_ERRF_OK && !(flags & PKGF_SKIP_ERRORS))
return pkg_report_graph_error(parent, pkgdep, depnode, eflags);
if (pkgdep->flags & PKG_PROPF_SEEN)
{

19
pkg.h
View File

@ -108,15 +108,16 @@ struct pkg_ {
#define PKG_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((c)))
#define PKG_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
#define PKGF_NONE 0x00
#define PKGF_SEARCH_PRIVATE 0x01
#define PKGF_ENV_ONLY 0x02
#define PKGF_NO_UNINSTALLED 0x04
#define PKGF_SKIP_ROOT_VIRTUAL 0x08
#define PKGF_MERGE_PRIVATE_FRAGMENTS 0x10
#define PKGF_SKIP_CONFLICTS 0x20
#define PKGF_NO_CACHE 0x40
#define PKGF_MUNGE_SYSROOT_PREFIX 0x80
#define PKGF_NONE 0x000
#define PKGF_SEARCH_PRIVATE 0x001
#define PKGF_ENV_ONLY 0x002
#define PKGF_NO_UNINSTALLED 0x004
#define PKGF_SKIP_ROOT_VIRTUAL 0x008
#define PKGF_MERGE_PRIVATE_FRAGMENTS 0x010
#define PKGF_SKIP_CONFLICTS 0x020
#define PKGF_NO_CACHE 0x040
#define PKGF_MUNGE_SYSROOT_PREFIX 0x080
#define PKGF_SKIP_ERRORS 0x100
#define PKG_ERRF_OK 0x0
#define PKG_ERRF_PACKAGE_NOT_FOUND 0x1