BPackageManager: Add SetDebugLevel()

Sets the debug level of the solver.
This commit is contained in:
Ingo Weinhold
2014-10-26 00:19:35 +02:00
parent 74b582a4e5
commit d228f29f6e
2 changed files with 17 additions and 0 deletions
@@ -75,6 +75,9 @@ public:
void Init(uint32 flags); void Init(uint32 flags);
void SetDebugLevel(int32 level);
// 0 - 10 (passed to libsolv)
BSolver* Solver() const BSolver* Solver() const
{ return fSolver; } { return fSolver; }
@@ -155,6 +158,7 @@ private:
bool _NextSpecificInstallationLocation(); bool _NextSpecificInstallationLocation();
protected: protected:
int32 fDebugLevel;
BPackageInstallationLocation fLocation; BPackageInstallationLocation fLocation;
BSolver* fSolver; BSolver* fSolver;
InstalledRepository* fSystemRepository; InstalledRepository* fSystemRepository;
@@ -51,6 +51,7 @@ BPackageManager::BPackageManager(BPackageInstallationLocation location,
InstallationInterface* installationInterface, InstallationInterface* installationInterface,
UserInteractionHandler* userInteractionHandler) UserInteractionHandler* userInteractionHandler)
: :
fDebugLevel(0),
fLocation(location), fLocation(location),
fSolver(NULL), fSolver(NULL),
fSystemRepository(new (std::nothrow) InstalledRepository("system", fSystemRepository(new (std::nothrow) InstalledRepository("system",
@@ -92,6 +93,8 @@ BPackageManager::Init(uint32 flags)
throw std::bad_alloc(); throw std::bad_alloc();
} }
fSolver->SetDebugLevel(fDebugLevel);
BRepositoryBuilder(*fLocalRepository).AddToSolver(fSolver, false); BRepositoryBuilder(*fLocalRepository).AddToSolver(fSolver, false);
// add installation location repositories // add installation location repositories
@@ -130,6 +133,16 @@ BPackageManager::Init(uint32 flags)
} }
void
BPackageManager::SetDebugLevel(int32 level)
{
fDebugLevel = level;
if (fSolver != NULL)
fSolver->SetDebugLevel(fDebugLevel);
}
void void
BPackageManager::Install(const char* const* packages, int packageCount) BPackageManager::Install(const char* const* packages, int packageCount)
{ {