summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-12-27 14:06:03 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-12-27 14:06:03 +0200
commit34756e6b87e7c8c055a6e050cad90e0b0a549357 (patch)
tree55fbdd7fbc5c44b0394573415341b966a7914b1c /src/database.c
parent83b098d357fa8508834d65bf2fbfee6c288cbd20 (diff)
downloadapk-tools-34756e6b87e7c8c055a6e050cad90e0b0a549357.tar.gz
apk-tools-34756e6b87e7c8c055a6e050cad90e0b0a549357.tar.bz2
apk-tools-34756e6b87e7c8c055a6e050cad90e0b0a549357.tar.xz
apk-tools-34756e6b87e7c8c055a6e050cad90e0b0a549357.zip
solver: report number of (mega)bytes used
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/database.c b/src/database.c
index 8eaba6c..3435eaf 100644
--- a/src/database.c
+++ b/src/database.c
@@ -592,8 +592,12 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo)
if (pkg == NULL)
continue;
- if (repo >= 0)
+ if (repo >= 0) {
pkg->repos |= BIT(repo);
+ } else if (repo == -1 && ipkg == NULL) {
+ /* Installed package without files */
+ ipkg = apk_pkg_install(db, pkg);
+ }
if (apk_db_pkg_add(db, pkg) == NULL) {
apk_error("Installed database load failed");
@@ -620,15 +624,15 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo)
/* Standard index line? */
r = apk_pkg_add_info(db, pkg, field, l);
if (r == 0) {
- if (repo == -1 && field == 'S') {
- /* Instert to installed database; this needs to
- * happen after package name has been read, but
- * before first FDB entry. */
- ipkg = apk_pkg_install(db, pkg);
- diri_node = hlist_tail_ptr(&ipkg->owned_dirs);
- }
continue;
}
+ if (r == 1 && repo == -1) {
+ /* Instert to installed database; this needs to
+ * happen after package name has been read, but
+ * before first FDB entry. */
+ ipkg = apk_pkg_install(db, pkg);
+ diri_node = hlist_tail_ptr(&ipkg->owned_dirs);
+ }
if (repo != -1 || ipkg == NULL)
continue;
@@ -668,12 +672,10 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo)
apk_blob_pull_csum(&l, &file->csum);
break;
case 'r':
- if (ipkg != NULL)
- apk_blob_pull_deps(&l, db, &ipkg->replaces);
+ apk_blob_pull_deps(&l, db, &ipkg->replaces);
break;
case 'q':
- if (ipkg != NULL)
- ipkg->replaces_priority = apk_blob_pull_uint(&l, 10);
+ ipkg->replaces_priority = apk_blob_pull_uint(&l, 10);
break;
default:
if (r != 0 && !(apk_flags & APK_FORCE)) {