aboutsummaryrefslogtreecommitdiffstats
path: root/main/apk-tools/0005-cache-display-more-than-one-error.patch
blob: 6e85218b18bc992489ef4469dbd7cee4c5f52585 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From d21303960544b5f11b7d69d0335f0903fb93d180 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 13 May 2010 09:26:19 +0000
Subject: [PATCH 5/5] cache: display more than one error

Display all packages that are bad in world rather than only first
before exiting.
---
 src/cache.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/cache.c b/src/cache.c
index 85d9777..49a71fa 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -30,7 +30,7 @@ static int cache_download(struct apk_database *db)
 	struct apk_package *pkg;
 	struct apk_repository *repo;
 	char item[PATH_MAX], cacheitem[PATH_MAX];
-	int i, r = 0;
+	int i, r = 0, errors = 0;
 
 	if (db->world == NULL)
 		return 0;
@@ -41,12 +41,13 @@ static int cache_download(struct apk_database *db)
 
 	for (i = 0; i < db->world->num; i++) {
 		r = apk_state_lock_dependency(state, &db->world->item[i]);
-		if (r != 0) {
-			apk_error("Unable to select version for '%s': %d",
-				  db->world->item[i].name->name, r);
-			goto err;
-		}
+		errors += r;
+		if (r != 0)
+			apk_error("Unable to select version for '%s'",
+				  db->world->item[i].name->name);
 	}
+	if (errors)
+		goto err;
 
 	list_for_each_entry(change, &state->change_list_head, change_list) {
 		pkg = change->newpkg;
@@ -67,7 +68,7 @@ static int cache_download(struct apk_database *db)
 err:
 	if (state != NULL)
 		apk_state_unref(state);
-	return r;
+	return errors;
 }
 
 static int cache_clean(struct apk_database *db)
-- 
1.7.1