From f9d93a1f81232ef5752c68d1e39f15cbc0762ff2 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 15 Mar 2013 19:59:20 -0500 Subject: [PATCH] main: --simulate: enhancements --- main.c | 33 +++++++++++++++------------------ pkg.c | 2 +- pkg.h | 19 ++++++++++--------- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/main.c b/main.c index ae5a27d..618d49a 100644 --- a/main.c +++ b/main.c @@ -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); diff --git a/pkg.c b/pkg.c index d338fca..0d9ed5d 100644 --- a/pkg.c +++ b/pkg.c @@ -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) { diff --git a/pkg.h b/pkg.h index ca071b6..4e2c31c 100644 --- a/pkg.h +++ b/pkg.h @@ -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