This function replaces a dictionary in an array matched by pkgname, with the dictionary passed in as 2nd argument.