From 35e41822502e167fd7819b69c7068af421de4821 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 25 Dec 2013 11:12:52 +0100 Subject: [PATCH] Fully remove the obsolete softreplace code. --- include/xbps_api_impl.h | 2 +- lib/package_remove.c | 13 +------------ lib/transaction_commit.c | 30 +++++++++++------------------- 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/include/xbps_api_impl.h b/include/xbps_api_impl.h index ed48e595..1e943466 100644 --- a/include/xbps_api_impl.h +++ b/include/xbps_api_impl.h @@ -240,7 +240,7 @@ int HIDDEN xbps_transaction_package_replace(struct xbps_handle *); * @private * From lib/package_remove.c */ -int HIDDEN xbps_remove_pkg(struct xbps_handle *, const char *, bool, bool); +int HIDDEN xbps_remove_pkg(struct xbps_handle *, const char *, bool); int HIDDEN xbps_remove_pkg_files(struct xbps_handle *, xbps_dictionary_t, const char *, const char *); diff --git a/lib/package_remove.c b/lib/package_remove.c index e8e29b01..2bfa2fc3 100644 --- a/lib/package_remove.c +++ b/lib/package_remove.c @@ -192,10 +192,7 @@ xbps_remove_pkg_files(struct xbps_handle *xhp, } int HIDDEN -xbps_remove_pkg(struct xbps_handle *xhp, - const char *pkgver, - bool update, - bool soft_replace) +xbps_remove_pkg(struct xbps_handle *xhp, const char *pkgver, bool update) { xbps_dictionary_t pkgd = NULL; char *pkgname, *buf = NULL; @@ -264,13 +261,6 @@ xbps_remove_pkg(struct xbps_handle *xhp, xbps_object_release(pkgd); free(pkgname); return 0; - } else if (soft_replace) { - /* - * Soft replace a package. Do not remove its files, but - * execute PURGE action, remove metadata files and unregister - * from pkgdb. - */ - goto softreplace; } if (pkgd) { @@ -300,7 +290,6 @@ xbps_remove_pkg(struct xbps_handle *xhp, } } -softreplace: /* * Set package state to "half-removed". */ diff --git a/lib/transaction_commit.c b/lib/transaction_commit.c index 9c023c08..182a77a4 100644 --- a/lib/transaction_commit.c +++ b/lib/transaction_commit.c @@ -197,7 +197,6 @@ xbps_transaction_commit(struct xbps_handle *xhp) xbps_object_t obj; xbps_object_iterator_t iter; const char *pkgver, *tract; - char *pkgname; int rv = 0; bool update; @@ -251,7 +250,7 @@ xbps_transaction_commit(struct xbps_handle *xhp) * Remove package. */ xbps_dictionary_get_bool(obj, "remove-and-update", &update); - rv = xbps_remove_pkg(xhp, pkgver, update, false); + rv = xbps_remove_pkg(xhp, pkgver, update); if (rv != 0) { xbps_dbg_printf(xhp, "[trans] failed to " "remove %s\n", pkgver); @@ -274,24 +273,17 @@ xbps_transaction_commit(struct xbps_handle *xhp) * Update a package: execute pre-remove action of * existing package before unpacking new version. */ - pkgname = xbps_pkg_name(pkgver); - assert(pkgname); - if (xbps_pkgdb_get_pkg(xhp, pkgname)) { - xbps_set_cb_state(xhp, XBPS_STATE_UPDATE, 0, - pkgver, NULL); - rv = xbps_remove_pkg(xhp, pkgver, true, false); - if (rv != 0) { - xbps_set_cb_state(xhp, - XBPS_STATE_UPDATE_FAIL, - rv, pkgver, - "%s: [trans] failed to update " - "package `%s'", pkgver, - strerror(rv)); - free(pkgname); - goto out; - } + xbps_set_cb_state(xhp, XBPS_STATE_UPDATE, 0, pkgver, NULL); + rv = xbps_remove_pkg(xhp, pkgver, true); + if (rv != 0) { + xbps_set_cb_state(xhp, + XBPS_STATE_UPDATE_FAIL, + rv, pkgver, + "%s: [trans] failed to update " + "package `%s'", pkgver, + strerror(rv)); + goto out; } - free(pkgname); } else { /* Install a package */ xbps_set_cb_state(xhp, XBPS_STATE_INSTALL, 0,