Fully remove the obsolete softreplace code.
This commit is contained in:
parent
3730f9f5a4
commit
35e4182250
@ -240,7 +240,7 @@ int HIDDEN xbps_transaction_package_replace(struct xbps_handle *);
|
|||||||
* @private
|
* @private
|
||||||
* From lib/package_remove.c
|
* 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,
|
int HIDDEN xbps_remove_pkg_files(struct xbps_handle *, xbps_dictionary_t,
|
||||||
const char *, const char *);
|
const char *, const char *);
|
||||||
|
|
||||||
|
@ -192,10 +192,7 @@ xbps_remove_pkg_files(struct xbps_handle *xhp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int HIDDEN
|
int HIDDEN
|
||||||
xbps_remove_pkg(struct xbps_handle *xhp,
|
xbps_remove_pkg(struct xbps_handle *xhp, const char *pkgver, bool update)
|
||||||
const char *pkgver,
|
|
||||||
bool update,
|
|
||||||
bool soft_replace)
|
|
||||||
{
|
{
|
||||||
xbps_dictionary_t pkgd = NULL;
|
xbps_dictionary_t pkgd = NULL;
|
||||||
char *pkgname, *buf = NULL;
|
char *pkgname, *buf = NULL;
|
||||||
@ -264,13 +261,6 @@ xbps_remove_pkg(struct xbps_handle *xhp,
|
|||||||
xbps_object_release(pkgd);
|
xbps_object_release(pkgd);
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
return 0;
|
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) {
|
if (pkgd) {
|
||||||
@ -300,7 +290,6 @@ xbps_remove_pkg(struct xbps_handle *xhp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
softreplace:
|
|
||||||
/*
|
/*
|
||||||
* Set package state to "half-removed".
|
* Set package state to "half-removed".
|
||||||
*/
|
*/
|
||||||
|
@ -197,7 +197,6 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
xbps_object_t obj;
|
xbps_object_t obj;
|
||||||
xbps_object_iterator_t iter;
|
xbps_object_iterator_t iter;
|
||||||
const char *pkgver, *tract;
|
const char *pkgver, *tract;
|
||||||
char *pkgname;
|
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
bool update;
|
bool update;
|
||||||
|
|
||||||
@ -251,7 +250,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
* Remove package.
|
* Remove package.
|
||||||
*/
|
*/
|
||||||
xbps_dictionary_get_bool(obj, "remove-and-update", &update);
|
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) {
|
if (rv != 0) {
|
||||||
xbps_dbg_printf(xhp, "[trans] failed to "
|
xbps_dbg_printf(xhp, "[trans] failed to "
|
||||||
"remove %s\n", pkgver);
|
"remove %s\n", pkgver);
|
||||||
@ -274,12 +273,8 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
* Update a package: execute pre-remove action of
|
* Update a package: execute pre-remove action of
|
||||||
* existing package before unpacking new version.
|
* existing package before unpacking new version.
|
||||||
*/
|
*/
|
||||||
pkgname = xbps_pkg_name(pkgver);
|
xbps_set_cb_state(xhp, XBPS_STATE_UPDATE, 0, pkgver, NULL);
|
||||||
assert(pkgname);
|
rv = xbps_remove_pkg(xhp, pkgver, true);
|
||||||
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) {
|
if (rv != 0) {
|
||||||
xbps_set_cb_state(xhp,
|
xbps_set_cb_state(xhp,
|
||||||
XBPS_STATE_UPDATE_FAIL,
|
XBPS_STATE_UPDATE_FAIL,
|
||||||
@ -287,11 +282,8 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
"%s: [trans] failed to update "
|
"%s: [trans] failed to update "
|
||||||
"package `%s'", pkgver,
|
"package `%s'", pkgver,
|
||||||
strerror(rv));
|
strerror(rv));
|
||||||
free(pkgname);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
free(pkgname);
|
|
||||||
} else {
|
} else {
|
||||||
/* Install a package */
|
/* Install a package */
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_INSTALL, 0,
|
xbps_set_cb_state(xhp, XBPS_STATE_INSTALL, 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user