diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-02-15 13:57:36 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-02-15 13:57:36 +0200 |
commit | 41fb3a4f9e5949a66fedc069f94b75c18614728d (patch) | |
tree | ff3ce7bcba056015a01edabc9e55d50894b9eb2a /src/database.c | |
parent | 29064d88f3a972b69a006d7a8092159bd65ef03f (diff) | |
download | apk-tools-41fb3a4f9e5949a66fedc069f94b75c18614728d.tar.gz apk-tools-41fb3a4f9e5949a66fedc069f94b75c18614728d.tar.bz2 apk-tools-41fb3a4f9e5949a66fedc069f94b75c18614728d.tar.xz apk-tools-41fb3a4f9e5949a66fedc069f94b75c18614728d.zip |
solver, db: repository pinning improvements
* solver internally calculates now using tags; not repository masks
* installeddb now contains the tag name where the package came from
-> we can now handle upgrades properly
* the pinning is still a preference, and not strictly enforced;
versioned dependencies may overrule preference
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/database.c b/src/database.c index 35479d4..11f705d 100644 --- a/src/database.c +++ b/src/database.c @@ -754,6 +754,9 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo) case 'q': ipkg->replaces_priority = apk_blob_pull_uint(&l, 10); break; + case 'p': + ipkg->repository_tag = apk_db_get_tag_id(db, l); + break; default: if (r != 0 && !(apk_flags & APK_FORCE)) { /* Installed db should not have unsupported fields */ @@ -800,7 +803,11 @@ static int apk_db_write_fdb(struct apk_database *db, struct apk_ostream *os) apk_blob_push_uint(&bbuf, ipkg->replaces_priority, 10); apk_blob_push_blob(&bbuf, APK_BLOB_STR("\n")); } - + if (ipkg->repository_tag) { + apk_blob_push_blob(&bbuf, APK_BLOB_STR("p:")); + apk_blob_push_blob(&bbuf, *db->repo_tags[ipkg->repository_tag].name); + apk_blob_push_blob(&bbuf, APK_BLOB_STR("\n")); + } hlist_for_each_entry(diri, c1, &ipkg->owned_dirs, pkg_dirs_list) { apk_blob_push_blob(&bbuf, APK_BLOB_STR("F:")); apk_blob_push_blob(&bbuf, APK_BLOB_PTR_LEN(diri->dir->name, diri->dir->namelen)); @@ -1551,17 +1558,6 @@ int apk_db_get_tag_id(struct apk_database *db, apk_blob_t tag) return -1; } -int apk_db_get_tag_id_by_repos(struct apk_database *db, unsigned int repos) -{ - int i; - - for (i = 0; i < db->num_repo_tags; i++) { - if (db->repo_tags[i].allowed_repos & repos) - return i; - } - return -1; -} - static int fire_triggers(apk_hash_item item, void *ctx) { struct apk_database *db = (struct apk_database *) ctx; |