xbps_alternatives_register: update pkgdb alternatives dictionary.

... otherwise the entry might not be added to our array and won't
hit pkgdb.

Signed-off-by: Juan RP <xtraeme@gmail.com>
This commit is contained in:
Juan RP 2019-06-11 18:13:19 +02:00 committed by Duncan Overbruck
parent 1c85083a94
commit bcd80f2936

View File

@ -470,14 +470,18 @@ xbps_alternatives_register(struct xbps_handle *xhp, xbps_dictionary_t pkg_repod)
if (array == NULL) { if (array == NULL) {
array = xbps_array_create(); array = xbps_array_create();
} else { } else {
/* already registered */
if (xbps_match_string_in_array(array, pkgname)) { if (xbps_match_string_in_array(array, pkgname)) {
/* apply alternatives for this group */ /* already registered, update symlinks */
rv = create_symlinks(xhp, rv = create_symlinks(xhp,
xbps_dictionary_get(pkg_alternatives, keyname), xbps_dictionary_get(pkg_alternatives, keyname),
keyname); keyname);
if (rv != 0) if (rv != 0)
break; break;
} else {
/* not registered, add provider */
xbps_array_add_cstring(array, pkgname);
xbps_set_cb_state(xhp, XBPS_STATE_ALTGROUP_ADDED, 0, NULL,
"%s: registered '%s' alternatives group", pkgver, keyname);
} }
continue; continue;
} }