summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-04-21 11:39:16 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-04-21 11:39:16 +0000
commitb0921ebac5184be14bac6548b9d91afb721da9a8 (patch)
tree8d9e2b79afce0e2e663723c021c5e5843b8acaad /src/database.c
parent0dfbee9537c0eb93b92aeb0535062f9272afbc73 (diff)
downloadapk-tools-b0921ebac5184be14bac6548b9d91afb721da9a8.tar.gz
apk-tools-b0921ebac5184be14bac6548b9d91afb721da9a8.tar.bz2
apk-tools-b0921ebac5184be14bac6548b9d91afb721da9a8.tar.xz
apk-tools-b0921ebac5184be14bac6548b9d91afb721da9a8.zip
info: do not read the repositories as this tool only query the statedb
This allows you to query the state db even if you do not have write permissions in cache dir (which is needed if you have remote repositories) This should speed up things and save some memory if you have big and slow remote repositories.
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/database.c b/src/database.c
index 94fc3a0..4da547d 100644
--- a/src/database.c
+++ b/src/database.c
@@ -712,23 +712,25 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
}
}
- if (apk_repos == NULL)
- apk_repos = "/etc/apk/repositories";
- blob = apk_blob_from_file(apk_repos);
- if (!APK_BLOB_IS_NULL(blob)) {
- r = apk_blob_for_each_segment(blob, "\n",
- apk_db_add_repository, db);
- free(blob.ptr);
- if (r != 0)
- goto ret_r;
+ if (!(flags & APK_OPENF_EMPTY_REPOS)) {
+ if (apk_repos == NULL)
+ apk_repos = "/etc/apk/repositories";
+ blob = apk_blob_from_file(apk_repos);
+ if (!APK_BLOB_IS_NULL(blob)) {
+ r = apk_blob_for_each_segment(blob, "\n",
+ apk_db_add_repository, db);
+ free(blob.ptr);
+ if (r != 0)
+ goto ret_r;
+ }
}
}
- list_for_each_entry(repo, &apk_repository_list.list, list) {
- r = apk_db_add_repository(db, APK_BLOB_STR(repo->url));
- if (r != 0) {
- msg = repo->url;
- goto ret_r;
+ if (!(flags & APK_OPENF_EMPTY_REPOS)) {
+ list_for_each_entry(repo, &apk_repository_list.list, list) {
+ r = apk_db_add_repository(db, APK_BLOB_STR(repo->url));
+ if (r != 0)
+ goto ret_r;
}
}