summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2010-03-01 11:20:17 +0200
committerTimo Teras <timo.teras@iki.fi>2010-03-01 11:20:17 +0200
commitfcdb316ab7320babb83dd901f511d65770166d32 (patch)
tree5de69c5bcbaf1f0294ddd5f7f390d9521605d13f
parent2d7171b2e7079c099bc4d53fc0ec2f00437976ce (diff)
downloadapk-tools-fcdb316ab7320babb83dd901f511d65770166d32.tar.gz
apk-tools-fcdb316ab7320babb83dd901f511d65770166d32.tar.bz2
apk-tools-fcdb316ab7320babb83dd901f511d65770166d32.tar.xz
apk-tools-fcdb316ab7320babb83dd901f511d65770166d32.zip
db: read also non-repository package index if reading repository indexes
otherwise regeneration of non-repository index might go wrong or we might delete too many files from cache when doing 'cache clean'.
-rw-r--r--src/database.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/database.c b/src/database.c
index 2fcb275..9c2e009 100644
--- a/src/database.c
+++ b/src/database.c
@@ -897,14 +897,6 @@ static int apk_db_read_state(struct apk_database *db, int flags)
bs->close(bs, NULL);
}
- if (apk_db_cache_active(db)) {
- bs = apk_bstream_from_file(db->cache_fd, "installed");
- if (bs != NULL) {
- apk_db_index_read(db, bs, -2);
- bs->close(bs, NULL);
- }
- }
-
bs = apk_bstream_from_file(db->root_fd, "var/lib/apk/triggers");
if (bs != NULL) {
apk_db_triggers_read(db, bs);
@@ -1139,6 +1131,14 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
}
if (!(dbopts->open_flags & APK_OPENF_NO_REPOS)) {
+ if (apk_db_cache_active(db)) {
+ bs = apk_bstream_from_file(db->cache_fd, "installed");
+ if (bs != NULL) {
+ apk_db_index_read(db, bs, -2);
+ bs->close(bs, NULL);
+ }
+ }
+
list_for_each_entry(repo, &dbopts->repository_list, list) {
r = apk_db_add_repository(db, APK_BLOB_STR(repo->url));
rr = r ?: rr;