summaryrefslogtreecommitdiff
path: root/src/dot.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-24 15:50:39 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-24 16:31:40 +0200
commit99145e2c0dc0b5b3b5a2a72fb1bff140d1f583f3 (patch)
tree37eb5b28d99600d3b310e502218dbc8167adf986 /src/dot.c
parent97d44b5a002b61c7b95303bb8616f1caa6556bca (diff)
downloadapk-tools-99145e2c0dc0b5b3b5a2a72fb1bff140d1f583f3.tar.gz
apk-tools-99145e2c0dc0b5b3b5a2a72fb1bff140d1f583f3.tar.bz2
apk-tools-99145e2c0dc0b5b3b5a2a72fb1bff140d1f583f3.tar.xz
apk-tools-99145e2c0dc0b5b3b5a2a72fb1bff140d1f583f3.zip
all: introduce apk_provides and use it in apk_name
in preparation for provides support. implements also some dependency satisfaction helper routines. ref #574.
Diffstat (limited to 'src/dot.c')
-rw-r--r--src/dot.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/dot.c b/src/dot.c
index 45b40a3..35426a2 100644
--- a/src/dot.c
+++ b/src/dot.c
@@ -66,7 +66,7 @@ static int dump_pkg(struct dot_ctx *ctx, struct apk_package *pkg)
struct apk_dependency *dep = &pkg->depends->item[i];
struct apk_name *name = dep->name;
- if (name->pkgs->num == 0) {
+ if (name->providers->num == 0) {
start_graph(ctx);
printf(" \"" PKG_VER_FMT "\" -> \"%s\" [color=red];\n",
PKG_VER_PRINTF(pkg),
@@ -77,19 +77,27 @@ static int dump_pkg(struct dot_ctx *ctx, struct apk_package *pkg)
name->state_int = 1;
}
} else {
- for (j = 0; j < name->pkgs->num; j++) {
- struct apk_package *pkg0 = name->pkgs->item[j];
+ for (j = 0; j < name->providers->num; j++) {
+ struct apk_provider *p0 = &name->providers->item[j];
- if (!apk_dep_is_satisfied(dep, pkg0))
+ if (!apk_dep_is_provided(dep, p0))
continue;
- r = dump_pkg(ctx, pkg0);
+ r = dump_pkg(ctx, p0->pkg);
ret += r;
if (r || (!ctx->errors_only)) {
start_graph(ctx);
- printf(" \"" PKG_VER_FMT "\" -> \"" PKG_VER_FMT "\"%s;\n",
+
+ if (p0->pkg->name != dep->name) {
+ /* provided package */
+ printf(" \"" PROVIDER_FMT "\" -> \"" PKG_VER_FMT "\"[arrowhead=inv,color=green];\n",
+ PROVIDER_PRINTF(p0),
+ PKG_VER_PRINTF(p0->pkg));
+ }
+
+ printf(" \"" PKG_VER_FMT "\" -> \"" PROVIDER_FMT "\"%s;\n",
PKG_VER_PRINTF(pkg),
- PKG_VER_PRINTF(pkg0),
+ PROVIDER_PRINTF(p0),
r ? "[color=red]" : "");
}
}
@@ -117,8 +125,8 @@ static int dot_main(void *pctx, struct apk_database *db, int argc, char **argv)
struct apk_name *name = apk_db_get_name(db, APK_BLOB_STR(argv[i]));
if (!name)
continue;
- for (j = 0; j < name->pkgs->num; j++)
- dump_pkg(ctx, name->pkgs->item[j]);
+ for (j = 0; j < name->providers->num; j++)
+ dump_pkg(ctx, name->providers->item[j].pkg);
}
} else {
apk_hash_foreach(&db->available.packages, foreach_pkg, pctx);