From 0d8ed3f2a8f240750c15e9dfec09fb2e20b7160a Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 12 Apr 2013 14:21:54 +0200 Subject: [PATCH] BSolver::Install(): Add optional unmatched specifier return param --- headers/os/package/solver/Solver.h | 5 ++++- src/kits/package/solver/LibsolvSolver.cpp | 11 +++++++++-- src/kits/package/solver/LibsolvSolver.h | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/headers/os/package/solver/Solver.h b/headers/os/package/solver/Solver.h index c283b3e993..90c0045281 100644 --- a/headers/os/package/solver/Solver.h +++ b/headers/os/package/solver/Solver.h @@ -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 diff --git a/src/kits/package/solver/LibsolvSolver.cpp b/src/kits/package/solver/LibsolvSolver.cpp index d6a0935856..460befd544 100644 --- a/src/kits/package/solver/LibsolvSolver.cpp +++ b/src/kits/package/solver/LibsolvSolver.cpp @@ -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 diff --git a/src/kits/package/solver/LibsolvSolver.h b/src/kits/package/solver/LibsolvSolver.h index 48f76f83fb..09c6dbacfc 100644 --- a/src/kits/package/solver/LibsolvSolver.h +++ b/src/kits/package/solver/LibsolvSolver.h @@ -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;