lib/transaction_files.c: rework to remove obsoletes before unpacking

This commit is contained in:
Duncaen
2019-06-17 11:32:46 +02:00
committed by Duncan Overbruck
parent 66e5b721ae
commit 658f87b9c5
4 changed files with 369 additions and 64 deletions

View File

@ -189,6 +189,7 @@ int HIDDEN
xbps_transaction_init(struct xbps_handle *xhp)
{
xbps_array_t array;
xbps_dictionary_t dict;
if (xhp->transd != NULL)
return 0;
@ -244,6 +245,30 @@ xbps_transaction_init(struct xbps_handle *xhp)
}
xbps_object_release(array);
if ((dict = xbps_dictionary_create()) == NULL) {
xbps_object_release(xhp->transd);
xhp->transd = NULL;
return ENOMEM;
}
if (!xbps_dictionary_set(xhp->transd, "obsolete_files", dict)) {
xbps_object_release(xhp->transd);
xhp->transd = NULL;
return EINVAL;
}
xbps_object_release(dict);
if ((dict = xbps_dictionary_create()) == NULL) {
xbps_object_release(xhp->transd);
xhp->transd = NULL;
return ENOMEM;
}
if (!xbps_dictionary_set(xhp->transd, "remove_files", dict)) {
xbps_object_release(xhp->transd);
xhp->transd = NULL;
return EINVAL;
}
xbps_object_release(dict);
return 0;
}