Remove pkg self replacement from pkgdb; this must not be propagated.
This commit is contained in:
parent
dea31f0a15
commit
2b7c4d568a
@ -43,20 +43,29 @@
|
|||||||
* and remove them if that was true.
|
* and remove them if that was true.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
check_pkg_unneeded(struct xbps_handle *xhp _unused, const char *pkgname _unused, void *arg)
|
check_pkg_unneeded(struct xbps_handle *xhp _unused, const char *pkgname, void *arg)
|
||||||
{
|
{
|
||||||
|
xbps_array_t replaces;
|
||||||
xbps_dictionary_t pkgd = arg;
|
xbps_dictionary_t pkgd = arg;
|
||||||
const char *repo = NULL;
|
const char *repo = NULL;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
xbps_dictionary_remove(pkgd, "download");
|
xbps_dictionary_remove(pkgd, "download");
|
||||||
xbps_dictionary_remove(pkgd, "remove-and-update");
|
xbps_dictionary_remove(pkgd, "remove-and-update");
|
||||||
xbps_dictionary_remove(pkgd, "transaction");
|
xbps_dictionary_remove(pkgd, "transaction");
|
||||||
xbps_dictionary_remove(pkgd, "skip-obsoletes");
|
xbps_dictionary_remove(pkgd, "skip-obsoletes");
|
||||||
xbps_dictionary_get_cstring_nocopy(pkgd, "repository-origin", &repo);
|
if (xbps_dictionary_get_cstring_nocopy(pkgd, "repository-origin", &repo)) {
|
||||||
if (repo) {
|
|
||||||
xbps_dictionary_set_cstring(pkgd, "repository", repo);
|
xbps_dictionary_set_cstring(pkgd, "repository", repo);
|
||||||
xbps_dictionary_remove(pkgd, "repository-origin");
|
xbps_dictionary_remove(pkgd, "repository-origin");
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Remove self replacement when applicable.
|
||||||
|
*/
|
||||||
|
if ((replaces = xbps_dictionary_get(pkgd, "replaces"))) {
|
||||||
|
buf = xbps_xasprintf("%s>=0", pkgname);
|
||||||
|
xbps_remove_string_from_array(replaces, buf);
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
int HIDDEN
|
int HIDDEN
|
||||||
xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
|
xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
|
||||||
{
|
{
|
||||||
|
xbps_array_t replaces;
|
||||||
xbps_dictionary_t pkgd;
|
xbps_dictionary_t pkgd;
|
||||||
char outstr[64];
|
char outstr[64];
|
||||||
time_t t;
|
time_t t;
|
||||||
@ -102,7 +103,14 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
|
|||||||
xbps_dictionary_remove(pkgd, "skip-obsoletes");
|
xbps_dictionary_remove(pkgd, "skip-obsoletes");
|
||||||
xbps_dictionary_remove(pkgd, "pkgname");
|
xbps_dictionary_remove(pkgd, "pkgname");
|
||||||
xbps_dictionary_remove(pkgd, "version");
|
xbps_dictionary_remove(pkgd, "version");
|
||||||
|
/*
|
||||||
|
* Remove self replacement when applicable.
|
||||||
|
*/
|
||||||
|
if ((replaces = xbps_dictionary_get(pkgd, "replaces"))) {
|
||||||
|
buf = xbps_xasprintf("%s>=0", pkgname);
|
||||||
|
xbps_remove_string_from_array(replaces, buf);
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
if (!xbps_dictionary_set(xhp->pkgdb, pkgname, pkgd)) {
|
if (!xbps_dictionary_set(xhp->pkgdb, pkgname, pkgd)) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(xhp,
|
||||||
"%s: failed to set pkgd for %s\n", __func__, pkgver);
|
"%s: failed to set pkgd for %s\n", __func__, pkgver);
|
||||||
|
Loading…
Reference in New Issue
Block a user