db, solver: refuse committing changes if there is missing tags

cute-signatures
Timo Teräs 2012-01-12 10:42:27 +02:00
parent 2372692660
commit f1de353b81
3 changed files with 20 additions and 1 deletions

View File

@ -130,6 +130,7 @@ struct apk_database {
unsigned int local_repos;
int performing_self_update : 1;
int permanent : 1;
int missing_tags : 1;
int compat_newfeatures : 1;
int compat_notinstallable : 1;

View File

@ -1135,7 +1135,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 r, fd, rr = 0;
int i, r, fd, rr = 0;
memset(db, 0, sizeof(*db));
if (apk_flags & APK_SIMULATE) {
@ -1312,6 +1312,14 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
goto ret_r;
}
for (i = 0; i < db->num_repo_tags; i++) {
if (!db->repo_tags[i].allowed_repos) {
apk_warning("Repository tag '" BLOB_FMT "' used in world is no longer available",
BLOB_PRINTF(*db->repo_tags[i].name));
db->missing_tags = 1;
}
}
if (db->compat_newfeatures) {
apk_warning("This apk-tools is OLD! Some packages %s.",
db->compat_notinstallable ?

View File

@ -1261,6 +1261,11 @@ int apk_solver_commit_changeset(struct apk_database *db,
struct apk_change *change;
int i, r = 0, size_diff = 0;
if (db->missing_tags && !(apk_flags & APK_FORCE)) {
apk_error("Not committing changes due to missing repository tags. Use --force to override.");
return -1;
}
if (changeset->changes == NULL)
goto all_done;
@ -1406,6 +1411,11 @@ int apk_solver_commit(struct apk_database *db,
struct apk_package_array *solution = NULL;
int r;
if (db->missing_tags && !(apk_flags & APK_FORCE)) {
apk_error("Not committing changes due to missing repository tags. Use --force to override.");
return -1;
}
r = apk_solver_solve(db, solver_flags,
world, &solution, &changeset);
if (r < 0)