BSolver::Install(): Add optional unmatched specifier return param

This commit is contained in:
Ingo Weinhold 2013-04-12 14:21:54 +02:00
parent 71293f8b03
commit 0d8ed3f2a8
3 changed files with 16 additions and 4 deletions

View File

@ -14,6 +14,7 @@ namespace BPackageKit {
class BSolverPackage;
class BSolverPackageSpecifier;
class BSolverPackageSpecifierList;
class BSolverProblem;
class BSolverRepository;
@ -47,7 +48,9 @@ public:
virtual status_t Install(
const BSolverPackageSpecifierList&
packages) = 0;
packages,
const BSolverPackageSpecifier** _unmatched
= NULL) = 0;
virtual status_t VerifyInstallation() = 0;
bool HasProblems() const

View File

@ -284,8 +284,12 @@ LibsolvSolver::FindPackages(const char* searchString, uint32 flags,
status_t
LibsolvSolver::Install(const BSolverPackageSpecifierList& packages)
LibsolvSolver::Install(const BSolverPackageSpecifierList& packages,
const BSolverPackageSpecifier** _unmatched)
{
if (_unmatched != NULL)
*_unmatched = NULL;
if (packages.IsEmpty())
return B_BAD_VALUE;
@ -327,8 +331,11 @@ LibsolvSolver::Install(const BSolverPackageSpecifierList& packages)
| SELECTION_CANON | SELECTION_DOTARCH | SELECTION_REL;
/*int matchFlags =*/ selection_make(fPool, &matchingPackages,
specifier.SelectString().String(), flags);
if (matchingPackages.count == 0)
if (matchingPackages.count == 0) {
if (_unmatched != NULL)
*_unmatched = &specifier;
return B_NAME_NOT_FOUND;
}
// TODO: We might want to add support for restricting to certain repositories.
#if 0
// restrict to the matching repository

View File

@ -40,7 +40,9 @@ public:
virtual status_t Install(
const BSolverPackageSpecifierList&
packages);
packages,
const BSolverPackageSpecifier** _unmatched
= NULL);
virtual status_t VerifyInstallation();
virtual int32 CountProblems() const;