Fully remove the obsolete softreplace code.
This commit is contained in:
		@@ -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 *);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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".
 | 
			
		||||
	 */
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user