db: warn rather than fail with error if a repo index fails to load

cute-signatures
Natanael Copa 2009-05-19 09:39:57 +00:00
parent 250dee4101
commit 9e58b2dd55
1 changed files with 5 additions and 10 deletions

View File

@ -717,21 +717,16 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
apk_repos = "/etc/apk/repositories"; apk_repos = "/etc/apk/repositories";
blob = apk_blob_from_file(apk_repos); blob = apk_blob_from_file(apk_repos);
if (!APK_BLOB_IS_NULL(blob)) { if (!APK_BLOB_IS_NULL(blob)) {
r = apk_blob_for_each_segment(blob, "\n", apk_blob_for_each_segment(blob, "\n",
apk_db_add_repository, db); apk_db_add_repository, db);
free(blob.ptr); free(blob.ptr);
if (r != 0)
goto ret_r;
} }
} }
} }
if (!(flags & APK_OPENF_EMPTY_REPOS)) { if (!(flags & APK_OPENF_EMPTY_REPOS)) {
list_for_each_entry(repo, &apk_repository_list.list, list) { list_for_each_entry(repo, &apk_repository_list.list, list)
r = apk_db_add_repository(db, APK_BLOB_STR(repo->url)); apk_db_add_repository(db, APK_BLOB_STR(repo->url));
if (r != 0)
goto ret_r;
}
} }
fchdir(apk_cwd_fd); fchdir(apk_cwd_fd);
@ -1009,7 +1004,7 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t repository)
is = apk_bstream_gunzip(apk_repository_file_open(&db->repos[r], name), 1); is = apk_bstream_gunzip(apk_repository_file_open(&db->repos[r], name), 1);
} }
if (is == NULL) { if (is == NULL) {
apk_error("Failed to open index for %s", db->repos[r].url); apk_warning("Failed to open index for %s", db->repos[r].url);
return -1; return -1;
} }
apk_db_index_read(db, is, r); apk_db_index_read(db, is, r);