Added xbps_match_pkgdep_in_array() to match a pkgdep against pkgpatterns.

This fixes xbps_match_pkgpattern_in_array() which had the args swapped
in xbps_pkgpattern_match() resulting in inverted results while resolving
virtual packages in a transaction.
This commit is contained in:
Juan RP
2012-01-16 15:50:06 +01:00
parent ffa48b2cf3
commit 4164573b35
3 changed files with 29 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*-
* Copyright (c) 2008-2011 Juan Romero Pardines.
* Copyright (c) 2008-2012 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -118,7 +118,14 @@ match_string_in_array(prop_array_t array, const char *str, int mode)
}
free(curpkgname);
} else if (mode == 2) {
/* match by pkgpattern */
/* match pkgpattern against pkgdep */
pkgdep = prop_string_cstring_nocopy(obj);
if (xbps_pkgpattern_match(pkgdep, str)) {
found = true;
break;
}
} else if (mode == 3) {
/* match pkgdep against pkgpattern */
pkgdep = prop_string_cstring_nocopy(obj);
if (xbps_pkgpattern_match(str, pkgdep)) {
found = true;
@@ -148,3 +155,9 @@ xbps_match_pkgpattern_in_array(prop_array_t array, const char *pattern)
{
return match_string_in_array(array, pattern, 2);
}
bool
xbps_match_pkgdep_in_array(prop_array_t array, const char *pkgver)
{
return match_string_in_array(array, pkgver, 3);
}