summaryrefslogtreecommitdiffstats
path: root/src/state.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-06-01 15:06:48 +0300
committerTimo Teräs <timo.teras@iki.fi>2010-06-01 15:06:48 +0300
commit440cffef5891dab07631e17f83845f9f95f89b0d (patch)
tree4fd6cc9016f1fad703f5272a158746f16e347336 /src/state.c
parent038b672061919296b68b83a1ccead9c31b650c6c (diff)
downloadapk-tools-440cffef5891dab07631e17f83845f9f95f89b0d.tar.bz2
apk-tools-440cffef5891dab07631e17f83845f9f95f89b0d.tar.xz
state: print missing package names on error
especially important if the package requested from command line does not exist. otherwise we would not print an error at all.
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/state.c b/src/state.c
index 33cabb8..40ab359 100644
--- a/src/state.c
+++ b/src/state.c
@@ -267,8 +267,13 @@ int apk_state_prune_dependency(struct apk_state *state,
if (ns_error(state->name[name->id])) {
return -1;
} else if (pkg == NULL) {
- if (dep->result_mask != APK_DEPMASK_CONFLICT)
+ if (dep->result_mask != APK_DEPMASK_CONFLICT) {
+ if (ns_pending(state->name[name->id])) {
+ state->name[name->id] = ns_from_pkg_non_pending(NULL);
+ *apk_name_array_add(&state->missing) = name;
+ }
return -1;
+ }
} else {
if (!(apk_version_compare(pkg->version, dep->version)
& dep->result_mask))
@@ -826,16 +831,13 @@ void apk_state_print_errors(struct apk_state *state)
struct error_state es;
int i, j, r;
- if (state->conflicts == NULL)
- return;
+ for (i = 0; state->conflicts != NULL && i < state->conflicts->num; i++) {
+ if (i == 0)
+ apk_error("Unable to satisfy all dependencies:");
- apk_error("Unable to satisfy all dependencies:");
- for (i = 0; i < state->conflicts->num; i++) {
es.prevpkg = pkg = state->conflicts->item[i];
es.indent.x = es.indent.indent =
- printf(" %s-%s:",
- pkg->name->name, pkg->version);
-
+ printf(" %s-%s:", pkg->name->name, pkg->version);
for (j = 0; j < pkg->depends->num; j++) {
r = apk_state_lock_dependency(state,
&pkg->depends->item[j]);
@@ -848,6 +850,18 @@ void apk_state_print_errors(struct apk_state *state)
print_dep, &es);
printf("\n");
}
+
+ for (i = 0; state->missing != NULL && i < state->missing->num; i++) {
+ struct apk_name *name = state->missing->item[i];
+ if (i == 0) {
+ apk_error("Missing packages:");
+ es.indent.x = 0;
+ es.indent.indent = 2;
+ }
+ apk_print_indented(&es.indent, APK_BLOB_STR(name->name));
+ }
+ if (i != 0)
+ printf("\n");
}
int apk_state_commit(struct apk_state *state,