summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-11 14:06:06 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-13 18:22:00 +0300
commitb8c44536ca911418fee1c9ab4eecbb913a1ca852 (patch)
treea89e68b12f4d3daf089c475beeb71c53ffb8cc3a /src/database.c
parentf292a858677ae0e1af8910ffbd4b338f4b36c18b (diff)
downloadapk-tools-b8c44536ca911418fee1c9ab4eecbb913a1ca852.tar.gz
apk-tools-b8c44536ca911418fee1c9ab4eecbb913a1ca852.tar.bz2
apk-tools-b8c44536ca911418fee1c9ab4eecbb913a1ca852.tar.xz
apk-tools-b8c44536ca911418fee1c9ab4eecbb913a1ca852.zip
solver: rewrite as deductive solver -- core features
Implementing basic dependency handling, install_if and awareness of pinning.
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/database.c b/src/database.c
index 0b40273..a77e409 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1751,9 +1751,11 @@ static int fire_triggers(apk_hash_item item, void *ctx)
continue;
/* And place holder for script name */
- if (ipkg->pending_triggers->num == 0)
+ if (ipkg->pending_triggers->num == 0) {
*apk_string_array_add(&ipkg->pending_triggers) =
NULL;
+ db->pending_triggers++;
+ }
*apk_string_array_add(&ipkg->pending_triggers) =
dbd->rooted_name;
break;
@@ -1763,20 +1765,10 @@ static int fire_triggers(apk_hash_item item, void *ctx)
return 0;
}
-struct apk_package_array *apk_db_get_pending_triggers(struct apk_database *db)
+int apk_db_fire_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_package_array_add(&pkgs) = ipkg->pkg;
- }
-
- return pkgs;
+ return db->pending_triggers;
}
int apk_db_cache_active(struct apk_database *db)
@@ -1904,6 +1896,20 @@ int apk_repo_format_filename(char *buf, size_t len,
return n;
}
+unsigned int apk_db_get_pinning_mask_repos(struct apk_database *db, unsigned short pinning_mask)
+{
+ unsigned int repository_mask = 0;
+ int i;
+
+ for (i = 0; i < db->num_repo_tags && pinning_mask; i++) {
+ if (!(BIT(i) & pinning_mask))
+ continue;
+ pinning_mask &= ~BIT(i);
+ repository_mask |= db->repo_tags[i].allowed_repos;
+ }
+ return repository_mask;
+}
+
static struct apk_bstream *apk_repo_file_open(struct apk_repository *repo,
apk_blob_t *arch,
const char *file,