summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-01-12 10:42:27 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-01-12 10:42:27 +0200
commitf1de353b8162b6f41c36c01fd54599d446203a68 (patch)
treecd1d39497fc8c7f73f308c27be009b59068cd671 /src
parent2372692660c80e79f1161f6ea99dd5eeea60a6d4 (diff)
downloadapk-tools-f1de353b8162b6f41c36c01fd54599d446203a68.tar.gz
apk-tools-f1de353b8162b6f41c36c01fd54599d446203a68.tar.bz2
apk-tools-f1de353b8162b6f41c36c01fd54599d446203a68.tar.xz
apk-tools-f1de353b8162b6f41c36c01fd54599d446203a68.zip
db, solver: refuse committing changes if there is missing tags
Diffstat (limited to 'src')
-rw-r--r--src/apk_database.h1
-rw-r--r--src/database.c10
-rw-r--r--src/solver.c10
3 files changed, 20 insertions, 1 deletions
diff --git a/src/apk_database.h b/src/apk_database.h
index 2d3b51f..929f262 100644
--- a/src/apk_database.h
+++ b/src/apk_database.h
@@ -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;
diff --git a/src/database.c b/src/database.c
index 0c62b4d..dd3f4b5 100644
--- a/src/database.c
+++ b/src/database.c
@@ -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 ?
diff --git a/src/solver.c b/src/solver.c
index 965694b..1ebadcc 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -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)