Added the "bestmatching" configuration keyword to enable pkg best matching.

See the NEWS file for more information.
This commit is contained in:
Juan RP
2014-11-07 10:07:51 +01:00
parent 6c76f6786d
commit 53f13d579e
6 changed files with 124 additions and 2 deletions

View File

@@ -156,7 +156,8 @@ parse_option(char *buf, char **k, char **v)
"repository",
"virtualpkg",
"include",
"preserve"
"preserve",
"bestmatching"
};
bool found = false;
@@ -263,6 +264,15 @@ parse_file(struct xbps_handle *xhp, const char *cwd, const char *path, bool nest
store_vpkg(xhp, path, nlines, v);
} else if (strcmp(k, "preserve") == 0) {
store_preserved_file(xhp, v);
} else if (strcmp(k, "bestmatching") == 0) {
if (strcasecmp(v, "true") == 0) {
xhp->flags |= XBPS_FLAG_BESTMATCH;
xbps_dbg_printf(xhp, "%s: pkg best matching enabled\n", path);
} else {
xhp->flags &= ~XBPS_FLAG_BESTMATCH;
xbps_dbg_printf(xhp, "%s: pkg best matching disabled\n", path);
}
xbps_dbg_printf(xhp, "%s: enabling pkg best matching\n", path);
}
/* Avoid double-nested parsing, only allow it once */
if (nested)

View File

@@ -275,6 +275,9 @@ xbps_rpool_get_virtualpkg(struct xbps_handle *xhp, const char *pkg)
xbps_dictionary_t
xbps_rpool_get_pkg(struct xbps_handle *xhp, const char *pkg)
{
if (xhp->flags & XBPS_FLAG_BESTMATCH)
return repo_find_pkg(xhp, pkg, BEST_PKG);
return repo_find_pkg(xhp, pkg, REAL_PKG);
}