diff options
-rw-r--r-- | src/add.c | 5 | ||||
-rw-r--r-- | src/database.c | 20 | ||||
-rw-r--r-- | src/del.c | 1 | ||||
-rw-r--r-- | src/state.c | 17 |
4 files changed, 21 insertions, 22 deletions
@@ -116,9 +116,10 @@ static int add_main(void *ctx, struct apk_database *db, int argc, char **argv) if (virtpkg) apk_deps_add(&virtpkg->depends, &dep); - else + else { deps[i] = dep; - deps[i].name->flags |= APK_NAME_TOPLEVEL_OVERRIDE; + deps[i].name->flags |= APK_NAME_TOPLEVEL_OVERRIDE; + } } if (virtpkg) deps[0] = virtdep; diff --git a/src/database.c b/src/database.c index 23bed5a..d685415 100644 --- a/src/database.c +++ b/src/database.c @@ -518,8 +518,12 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo) if (pkg == NULL) { pkg = apk_pkg_new(); diri = NULL; - diri_node = NULL; file_diri_node = NULL; + + if (repo == -1) { + ipkg = apk_pkg_install(db, pkg); + diri_node = hlist_tail_ptr(&ipkg->owned_dirs); + } } /* Standard index line? */ @@ -531,12 +535,6 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo) return -1; } - /* Create the installation entry */ - if (ipkg == NULL) { - ipkg = apk_pkg_install(db, pkg); - diri_node = hlist_tail_ptr(&ipkg->owned_dirs); - } - /* Check FDB special entries */ switch (field) { case 'F': @@ -763,7 +761,8 @@ static void apk_db_triggers_write(struct apk_database *db, struct apk_ostream *o list_for_each_entry(ipkg, &db->installed.triggers, trigger_pkgs_list) { bfn = APK_BLOB_BUF(buf); apk_blob_push_csum(&bfn, &ipkg->pkg->csum); - os->write(os, buf, buf - bfn.ptr); + os->write(os, buf, bfn.ptr - buf); + for (i = 0; i < ipkg->triggers->num; i++) { os->write(os, " ", 1); apk_ostream_write_string(os, ipkg->triggers->item[i]); @@ -1250,8 +1249,6 @@ int apk_db_run_triggers(struct apk_database *db) if (ipkg->pending_triggers == NULL) continue; - fprintf(stderr, "run triggers: %s\n", ipkg->pkg->name->name); - *apk_string_array_add(&ipkg->pending_triggers) = NULL; apk_ipkg_run_script(ipkg, db->root_fd, APK_SCRIPT_TRIGGER, ipkg->pending_triggers->item); @@ -1597,6 +1594,7 @@ static int read_info_line(void *_ctx, apk_blob_t line) ipkg->triggers = NULL; } apk_blob_for_each_segment(r, " ", parse_triggers, ctx->ipkg); + if (ctx->ipkg->triggers && !list_hashed(&ipkg->trigger_pkgs_list)) list_add_tail(&ipkg->trigger_pkgs_list, &db->installed.triggers); @@ -1786,7 +1784,7 @@ static void apk_db_purge_pkg(struct apk_database *db, struct apk_file_info fi; struct hlist_node *dc, *dn, *fc, *fn; unsigned long hash; - char name[1024]; + char name[PATH_MAX]; hlist_for_each_entry_safe(diri, dc, dn, &ipkg->owned_dirs, pkg_dirs_list) { if (exten == NULL) @@ -39,6 +39,7 @@ static int del_main(void *ctx, struct apk_database *db, int argc, char **argv) for (i = 0; i < argc; i++) { name = apk_db_get_name(db, APK_BLOB_STR(argv[i])); name->flags &= ~APK_NAME_TOPLEVEL; + name->flags |= APK_NAME_TOPLEVEL_OVERRIDE; apk_deps_del(&db->world, name); } diff --git a/src/state.c b/src/state.c index 3f00322..e308f48 100644 --- a/src/state.c +++ b/src/state.c @@ -299,7 +299,7 @@ int apk_state_lock_dependency(struct apk_state *state, for (i = 0; i < c->num; i++) { struct apk_package *pkg = c->pkgs[i]; - if (c->pkgs[i]->ipkg != NULL) + if (pkg->ipkg != NULL) installed = pkg; else if (pkg->filename == NULL && apk_db_select_repo(state->db, pkg) == NULL) @@ -489,7 +489,7 @@ int apk_state_lock_name(struct apk_state *state, struct apk_package *pkg = name->pkgs->item[i]; if (name->pkgs->item[i]->name == name && - name->pkgs->item[i]->ipkg != NULL) + pkg->ipkg != NULL) oldpkg = pkg; } } @@ -544,8 +544,7 @@ static void apk_print_change(struct apk_database *db, name->name, newpkg->version); } else if (newpkg == NULL) { apk_message("Purging %s (%s)", - name->name, - oldpkg->version); + name->name, oldpkg->version); } else { r = apk_pkg_version_compare(newpkg, oldpkg); switch (r) { @@ -757,15 +756,15 @@ int apk_state_commit(struct apk_state *state, "The following packages will be REMOVED"); r += dump_packages(state, cmp_downgrade, "The following packages will be DOWNGRADED"); - if (r || apk_verbosity > 2) { + if (r || (apk_flags & APK_INTERACTIVE) || apk_verbosity > 2) { dump_packages(state, cmp_new, "The following NEW packages will be installed"); dump_packages(state, cmp_upgrade, "The following packages will be upgraded"); - fprintf(stderr, "%d kB of %s\n", abs(size_diff), - (size_diff < 0) ? - "disk space will be freed" : - "additional disk space will be used"); + printf("%d kB of %s\n", abs(size_diff), + (size_diff < 0) ? + "disk space will be freed" : + "additional disk space will be used"); } if (apk_flags & APK_INTERACTIVE) { printf("Do you want to continue [Y/n]? "); |