db, solver: refuse committing changes if there is missing tags
parent
2372692660
commit
f1de353b81
|
@ -130,6 +130,7 @@ struct apk_database {
|
||||||
unsigned int local_repos;
|
unsigned int local_repos;
|
||||||
int performing_self_update : 1;
|
int performing_self_update : 1;
|
||||||
int permanent : 1;
|
int permanent : 1;
|
||||||
|
int missing_tags : 1;
|
||||||
int compat_newfeatures : 1;
|
int compat_newfeatures : 1;
|
||||||
int compat_notinstallable : 1;
|
int compat_notinstallable : 1;
|
||||||
|
|
||||||
|
|
|
@ -1135,7 +1135,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
|
||||||
struct apk_bstream *bs;
|
struct apk_bstream *bs;
|
||||||
struct statfs stfs;
|
struct statfs stfs;
|
||||||
apk_blob_t blob;
|
apk_blob_t blob;
|
||||||
int r, fd, rr = 0;
|
int i, r, fd, rr = 0;
|
||||||
|
|
||||||
memset(db, 0, sizeof(*db));
|
memset(db, 0, sizeof(*db));
|
||||||
if (apk_flags & APK_SIMULATE) {
|
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;
|
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) {
|
if (db->compat_newfeatures) {
|
||||||
apk_warning("This apk-tools is OLD! Some packages %s.",
|
apk_warning("This apk-tools is OLD! Some packages %s.",
|
||||||
db->compat_notinstallable ?
|
db->compat_notinstallable ?
|
||||||
|
|
10
src/solver.c
10
src/solver.c
|
@ -1261,6 +1261,11 @@ int apk_solver_commit_changeset(struct apk_database *db,
|
||||||
struct apk_change *change;
|
struct apk_change *change;
|
||||||
int i, r = 0, size_diff = 0;
|
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)
|
if (changeset->changes == NULL)
|
||||||
goto all_done;
|
goto all_done;
|
||||||
|
|
||||||
|
@ -1406,6 +1411,11 @@ int apk_solver_commit(struct apk_database *db,
|
||||||
struct apk_package_array *solution = NULL;
|
struct apk_package_array *solution = NULL;
|
||||||
int r;
|
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,
|
r = apk_solver_solve(db, solver_flags,
|
||||||
world, &solution, &changeset);
|
world, &solution, &changeset);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
|
Loading…
Reference in New Issue