Fix libxbps/update_shlibs:shlib_bump_revdep_diff test.

How to reproduce it:

	- A-1.0_1 provides liba.so.1
	- B-1.0_1 provides libb.so.1
	- C-1.0_1 requires liba.so.1 and libb.so.1
	- A-2.0_1 provides liba.so.2
	- C-2.0_1 required liba.so.2

This test case failed because it was checking the required shared libraries
from current installed package, rather than the updated pkg in transaction.
This commit is contained in:
Juan RP 2014-09-29 15:25:09 +02:00
parent 43b450d6fb
commit 742af69185

View File

@ -72,7 +72,7 @@ shlib_trans_matched(struct xbps_handle *xhp, const char *pkgver, const char *shl
}
static bool
shlib_matched(struct xbps_handle *xhp, xbps_array_t mshlibs,
shlib_matched(struct xbps_handle *xhp, xbps_array_t unsorted, xbps_array_t mshlibs,
const char *pkgver, const char *shlib)
{
xbps_array_t revdeps;
@ -96,10 +96,29 @@ shlib_matched(struct xbps_handle *xhp, xbps_array_t mshlibs,
for (unsigned int i = 0; i < xbps_array_count(revdeps); i++) {
xbps_array_t shrequires;
xbps_dictionary_t pkgd;
const char *rpkgver;
const char *trans, *rpkgver;
char *rpkgname;
xbps_array_get_cstring_nocopy(revdeps, i, &rpkgver);
rpkgname = xbps_pkg_name(rpkgver);
assert(rpkgname);
/*
* First check if this revdep has been queued in transaction;
* otherwise process the current installed pkg.
*/
pkgd = xbps_find_pkg_in_array(unsorted, rpkgname, NULL);
free(rpkgname);
if (pkgd) {
/*
* Make sure pkg in transaction is an update.
*/
xbps_dictionary_get_cstring_nocopy(pkgd, "transaction", &trans);
if (strcmp(trans, "update"))
pkgd = NULL;
}
if (!pkgd)
pkgd = xbps_pkgdb_get_pkg(xhp, rpkgver);
shrequires = xbps_dictionary_get(pkgd, "shlib-requires");
for (unsigned int x = 0; x < xbps_array_count(shrequires); x++) {
@ -187,7 +206,7 @@ xbps_transaction_shlibs(struct xbps_handle *xhp)
* Check that all shlibs provided by this pkg are used by
* its revdeps.
*/
if (!shlib_matched(xhp, mshlibs, pkgver, shlib))
if (!shlib_matched(xhp, unsorted, mshlibs, pkgver, shlib))
unmatched = true;
}
}