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:
parent
ffa48b2cf3
commit
4164573b35
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2011 Juan Romero Pardines.
|
* Copyright (c) 2011-2012 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -87,7 +87,7 @@ check_pkg_requiredby(const char *pkgname, void *arg)
|
|||||||
/*
|
/*
|
||||||
* Check for pkgpattern match with real packages...
|
* Check for pkgpattern match with real packages...
|
||||||
*/
|
*/
|
||||||
if (!xbps_match_pkgpattern_in_array(curpkg_rdeps, pkgver)) {
|
if (!xbps_match_pkgdep_in_array(curpkg_rdeps, pkgver)) {
|
||||||
/*
|
/*
|
||||||
* ... otherwise check if package provides any virtual
|
* ... otherwise check if package provides any virtual
|
||||||
* package and is matched against any object in
|
* package and is matched against any object in
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
*/
|
*/
|
||||||
#define XBPS_PKGINDEX_VERSION "1.3"
|
#define XBPS_PKGINDEX_VERSION "1.3"
|
||||||
|
|
||||||
#define XBPS_API_VERSION "20120116"
|
#define XBPS_API_VERSION "20120116-1"
|
||||||
#define XBPS_VERSION "0.12"
|
#define XBPS_VERSION "0.12"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1043,6 +1043,17 @@ bool xbps_match_pkgname_in_array(prop_array_t array, const char *pkgname);
|
|||||||
*/
|
*/
|
||||||
bool xbps_match_pkgpattern_in_array(prop_array_t array, const char *pattern);
|
bool xbps_match_pkgpattern_in_array(prop_array_t array, const char *pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Match a package dependency against any package pattern in the specified
|
||||||
|
* array of strings.
|
||||||
|
*
|
||||||
|
* @param[in] array The proplib array where to look for.
|
||||||
|
* @param[in] pkgver The package name-version tuple to match.
|
||||||
|
*
|
||||||
|
* @return true on success, false otherwise and errno is set appropiately.
|
||||||
|
*/
|
||||||
|
bool xbps_match_pkgdep_in_array(prop_array_t array, const char *pkgver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Match a string (exact match) in the specified array of strings.
|
* Match a string (exact match) in the specified array of strings.
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008-2011 Juan Romero Pardines.
|
* Copyright (c) 2008-2012 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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);
|
free(curpkgname);
|
||||||
} else if (mode == 2) {
|
} 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);
|
pkgdep = prop_string_cstring_nocopy(obj);
|
||||||
if (xbps_pkgpattern_match(str, pkgdep)) {
|
if (xbps_pkgpattern_match(str, pkgdep)) {
|
||||||
found = true;
|
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);
|
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);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user