summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-01-17 14:46:39 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-01-17 14:48:22 +0200
commitb3df78ed03b3739d01220f9bf2f00ab8df61425f (patch)
tree3e06ec9de1b517fba8bdee5c3a234193e0a775b9 /src/database.c
parenteaaba3ee893c7fb3c5a258f0609d8ab6e4637804 (diff)
downloadapk-tools-b3df78ed03b3739d01220f9bf2f00ab8df61425f.tar.gz
apk-tools-b3df78ed03b3739d01220f9bf2f00ab8df61425f.tar.bz2
apk-tools-b3df78ed03b3739d01220f9bf2f00ab8df61425f.tar.xz
apk-tools-b3df78ed03b3739d01220f9bf2f00ab8df61425f.zip
solver, upgrade: properly detect missing repository tags
* upgrade needs explicit check so we don't try self-upgrade (which would print additional messages on screen) * add can fix problems, so check against the new world * merge the code in few places
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/database.c b/src/database.c
index 34edf68..be88156 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1138,7 +1138,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
struct apk_bstream *bs;
struct statfs stfs;
apk_blob_t blob;
- int i, r, fd, rr = 0;
+ int r, fd, rr = 0;
memset(db, 0, sizeof(*db));
if (apk_flags & APK_SIMULATE) {
@@ -1315,20 +1315,6 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
goto ret_r;
}
- /* repository id 0 is the no-tag repo */
- for (i = 0; i < db->world->num; i++) {
- struct apk_dependency *dep = &db->world->item[i];
- int tag = dep->repository_tag;
-
- if (tag == 0 || db->repo_tags[tag].allowed_repos != 0)
- continue;
-
- apk_warning("The repository tag for world dependency '%s@" BLOB_FMT "' does not exist",
- dep->name->name,
- BLOB_PRINTF(*db->repo_tags[tag].name));
- db->missing_tags = 1;
- }
-
if (db->compat_newfeatures) {
apk_warning("This apk-tools is OLD! Some packages %s.",
db->compat_notinstallable ?
@@ -1554,6 +1540,29 @@ int apk_db_permanent(struct apk_database *db)
return db->permanent;
}
+int apk_db_check_world(struct apk_database *db, struct apk_dependency_array *world)
+{
+ int i, bad = 0;
+
+ if (apk_flags & APK_FORCE)
+ return 0;
+
+ for (i = 0; i < world->num; i++) {
+ struct apk_dependency *dep = &world->item[i];
+ int tag = dep->repository_tag;
+
+ if (tag == 0 || db->repo_tags[tag].allowed_repos != 0)
+ continue;
+
+ apk_warning("The repository tag for world dependency '%s@" BLOB_FMT "' does not exist",
+ dep->name->name,
+ BLOB_PRINTF(*db->repo_tags[tag].name));
+ bad++;
+ }
+
+ return bad;
+}
+
struct apk_package *apk_db_get_pkg(struct apk_database *db,
struct apk_checksum *csum)
{