summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-09-14 11:30:02 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-09-14 11:30:35 +0300
commite34d2ed5fdec628936711517612a0fe643ed6d33 (patch)
tree2f4dc066ecfd77de2bd641793c6bb6d55c5c8511 /src/database.c
parentf95e7e585087aa6677978205f4ae8ebb9dfd1851 (diff)
downloadapk-tools-e34d2ed5fdec628936711517612a0fe643ed6d33.tar.gz
apk-tools-e34d2ed5fdec628936711517612a0fe643ed6d33.tar.bz2
apk-tools-e34d2ed5fdec628936711517612a0fe643ed6d33.tar.xz
apk-tools-e34d2ed5fdec628936711517612a0fe643ed6d33.zip
solver, db: run triggers in dependency order
fixes #738
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/database.c b/src/database.c
index 2b5b687..135f6b4 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1458,23 +1458,20 @@ static int fire_triggers(apk_hash_item item, void *ctx)
return 0;
}
-int apk_db_run_triggers(struct apk_database *db)
+struct apk_package_array *apk_db_get_pending_triggers(struct apk_database *db)
{
struct apk_installed_package *ipkg;
+ struct apk_package_array *pkgs = NULL;
+ apk_package_array_init(&pkgs);
apk_hash_foreach(&db->installed.dirs, fire_triggers, db);
-
list_for_each_entry(ipkg, &db->installed.triggers, trigger_pkgs_list) {
if (ipkg->pending_triggers->num == 0)
continue;
-
- *apk_string_array_add(&ipkg->pending_triggers) = NULL;
- apk_ipkg_run_script(ipkg, db, APK_SCRIPT_TRIGGER,
- ipkg->pending_triggers->item);
- apk_string_array_free(&ipkg->pending_triggers);
+ *apk_package_array_add(&pkgs) = ipkg->pkg;
}
- return 0;
+ return pkgs;
}
int apk_db_cache_active(struct apk_database *db)