Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Delete conflicting packages correctly.
Vsevolod Stakhov committed 12 years ago
commit 99b4d0d21576ddc592a259fe7b76c1e639e5e984
parent ac95cad
3 files changed +10 -2
modified libpkg/pkg_delete.c
@@ -79,7 +79,7 @@ pkg_delete(struct pkg *pkg, struct pkgdb *db, unsigned flags)
	}

	/* If there are dependencies */
-
	if ((flags & PKG_DELETE_UPGRADE) == 0) {
+
	if ((flags & (PKG_DELETE_UPGRADE|PKG_DELETE_CONFLICT)) == 0) {
		if (pkg_rdeps(pkg, &rdep) == EPKG_OK) {
			pkg_emit_required(pkg, flags & PKG_DELETE_FORCE);
			if ((flags & PKG_DELETE_FORCE) == 0)
modified libpkg/pkg_jobs.c
@@ -1427,7 +1427,14 @@ pkg_jobs_execute(struct pkg_jobs *j)
				pkg_emit_error("Cannot delete pkg itself without force flag");
				continue;
			}
-
			retcode = pkg_delete(p, j->db, flags);
+
			/*
+
			 * Assume that in upgrade we can remove packages with rdeps as
+
			 * in further they will be upgraded correctly.
+
			 */
+
			if (j->type == PKG_JOBS_UPGRADE)
+
				retcode = pkg_delete(p, j->db, flags | PKG_DELETE_CONFLICT);
+
			else
+
				retcode = pkg_delete(p, j->db, flags);
			if (retcode != EPKG_OK)
				goto cleanup;
			break;
modified libpkg/private/pkg.h
@@ -359,6 +359,7 @@ int pkg_delete(struct pkg *pkg, struct pkgdb *db, unsigned flags);
#define PKG_DELETE_FORCE (1<<0)
#define PKG_DELETE_UPGRADE (1<<1)
#define PKG_DELETE_NOSCRIPT (1<<2)
+
#define PKG_DELETE_CONFLICT (1<<3)

int pkg_fetch_file_to_fd(struct pkg_repo *repo, const char *url, int dest, time_t *t);
int pkg_repo_fetch(struct pkg *pkg);