summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-01-04 10:05:20 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-01-04 10:05:20 +0200
commit28dcd5d3b341eb16fceb6cd362e5dd6875b4467b (patch)
tree3c502f74bbf401ce72ccc845e33953f8d71eaf3d /src/database.c
parentd8ba07e484b0c838ce475202f03e041953b183e1 (diff)
downloadapk-tools-28dcd5d3b341eb16fceb6cd362e5dd6875b4467b.tar.gz
apk-tools-28dcd5d3b341eb16fceb6cd362e5dd6875b4467b.tar.bz2
apk-tools-28dcd5d3b341eb16fceb6cd362e5dd6875b4467b.tar.xz
apk-tools-28dcd5d3b341eb16fceb6cd362e5dd6875b4467b.zip
pkg: recognize install_if
Parse install_if from package metadata and include it in the indexes. Also setup the reverse install_if dependencies when loading a database. ref #443. Actual install_if functionality is not yet implemented.
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/database.c b/src/database.c
index d7692cd..c1e8a6a 100644
--- a/src/database.c
+++ b/src/database.c
@@ -84,6 +84,7 @@ static void pkg_name_free(struct apk_name *name)
free(name->name);
apk_package_array_free(&name->pkgs);
apk_name_array_free(&name->rdepends);
+ apk_name_array_free(&name->rinstall_if);
free(name);
}
@@ -196,6 +197,7 @@ struct apk_name *apk_db_get_name(struct apk_database *db, apk_blob_t name)
pn->id = db->name_id++;
apk_package_array_init(&pn->pkgs);
apk_name_array_init(&pn->rdepends);
+ apk_name_array_init(&pn->rinstall_if);
apk_hash_insert_hashed(&db->available.names, pn, hash);
return pn;
@@ -399,16 +401,25 @@ static struct apk_db_file *apk_db_file_get(struct apk_database *db,
static void apk_db_pkg_rdepends(struct apk_database *db, struct apk_package *pkg)
{
int i, j;
+ struct apk_name *rname;
for (i = 0; i < pkg->depends->num; i++) {
- struct apk_name *rname = pkg->depends->item[i].name;
-
+ rname = pkg->depends->item[i].name;
for (j = 0; j < rname->rdepends->num; j++)
if (rname->rdepends->item[j] == pkg->name)
- return;
-
+ goto rdeps_done;
*apk_name_array_add(&rname->rdepends) = pkg->name;
}
+rdeps_done:
+ for (i = 0; i < pkg->install_if->num; i++) {
+ rname = pkg->install_if->item[i].name;
+ for (j = 0; j < rname->rinstall_if->num; j++)
+ if (rname->rinstall_if->item[j] == pkg->name)
+ goto riif_done;
+ *apk_name_array_add(&rname->rinstall_if) = pkg->name;
+ }
+riif_done:
+ return;
}
struct apk_package *apk_db_pkg_add(struct apk_database *db, struct apk_package *pkg)