diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-06-19 08:48:24 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-06-19 08:48:24 +0300 |
commit | 8c425a1e33713a2fcb17adada189db17d0e89392 (patch) | |
tree | 5c7d02ee5861a02440075c49029f50810e3caec2 | |
parent | d315c9019cf6e43dd7ecfe17e8d3896469396997 (diff) | |
download | apk-tools-8c425a1e33713a2fcb17adada189db17d0e89392.tar.gz apk-tools-8c425a1e33713a2fcb17adada189db17d0e89392.tar.bz2 apk-tools-8c425a1e33713a2fcb17adada189db17d0e89392.tar.xz apk-tools-8c425a1e33713a2fcb17adada189db17d0e89392.zip |
dot: new option: --installed
to consider only installed packages
-rw-r--r-- | src/dot.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -19,8 +19,9 @@ #define S_EVALUATING -2 struct dot_ctx { - int errors_only; - int not_empty; + int not_empty : 1; + int errors_only : 1; + int installed_only : 1; }; static int dot_parse(void *pctx, struct apk_db_options *dbopts, @@ -32,6 +33,10 @@ static int dot_parse(void *pctx, struct apk_db_options *dbopts, case 0x10000: ctx->errors_only = 1; break; + case 0x10001: + ctx->installed_only = 1; + dbopts->open_flags &= ~APK_OPENF_NO_INSTALLED; + break; default: return -1; } @@ -68,6 +73,9 @@ static int dump_pkg(struct dot_ctx *ctx, struct apk_package *pkg) struct apk_provider *p0; int r, ret = 0; + if (ctx->installed_only && pkg->ipkg == NULL) + return 0; + if (pkg->state_int == S_EVALUATED) return 0; @@ -89,6 +97,8 @@ static int dump_pkg(struct dot_ctx *ctx, struct apk_package *pkg) } foreach_array_item(p0, name->providers) { + if (ctx->installed_only && p0->pkg->ipkg == NULL) + continue; if (!apk_dep_is_provided(dep, p0)) continue; @@ -148,6 +158,7 @@ static int dot_main(void *pctx, struct apk_database *db, struct apk_string_array static struct apk_option dot_options[] = { { 0x10000, "errors", "Output only parts of the graph which are considered " "errorneus: e.g. cycles and missing packages" }, + { 0x10001, "installed", "Consider only installed packages" }, }; static struct apk_applet apk_dot = { |