138c62dfbSIngo Weinhold /*
20de3219eSIngo Weinhold * Copyright 2013-2014, Ingo Weinhold, ingo_weinhold@gmx.de.
338c62dfbSIngo Weinhold * Distributed under the terms of the MIT License.
438c62dfbSIngo Weinhold */
538c62dfbSIngo Weinhold
638c62dfbSIngo Weinhold
738c62dfbSIngo Weinhold #include "PackageManager.h"
838c62dfbSIngo Weinhold
999e5e3fdSHumdinger #include <Catalog.h>
1038c62dfbSIngo Weinhold #include <Notification.h>
1138c62dfbSIngo Weinhold #include <package/DownloadFileRequest.h>
1238c62dfbSIngo Weinhold #include <package/RefreshRepositoryRequest.h>
1338c62dfbSIngo Weinhold #include <package/solver/SolverPackage.h>
1438c62dfbSIngo Weinhold #include <package/solver/SolverPackageSpecifierList.h>
1538c62dfbSIngo Weinhold #include <package/solver/SolverProblem.h>
1638c62dfbSIngo Weinhold #include <package/solver/SolverProblemSolution.h>
1738c62dfbSIngo Weinhold
186c883121SIngo Weinhold #include <AutoDeleter.h>
1938c62dfbSIngo Weinhold #include <package/manager/Exceptions.h>
2038c62dfbSIngo Weinhold #include <package/manager/RepositoryBuilder.h>
2138c62dfbSIngo Weinhold #include <Server.h>
2238c62dfbSIngo Weinhold
2338c62dfbSIngo Weinhold #include "ProblemWindow.h"
246c883121SIngo Weinhold #include "ResultWindow.h"
2538c62dfbSIngo Weinhold #include "Root.h"
2638c62dfbSIngo Weinhold #include "Volume.h"
2738c62dfbSIngo Weinhold
2899e5e3fdSHumdinger #undef B_TRANSLATION_CONTEXT
2999e5e3fdSHumdinger #define B_TRANSLATION_CONTEXT "PackageManager"
3038c62dfbSIngo Weinhold
3138c62dfbSIngo Weinhold using BPackageKit::BManager::BPrivate::BAbortedByUserException;
3238c62dfbSIngo Weinhold using BPackageKit::BManager::BPrivate::BFatalErrorException;
3338c62dfbSIngo Weinhold using BPackageKit::BManager::BPrivate::BRepositoryBuilder;
3438c62dfbSIngo Weinhold
35*06b34533SHumdinger
PackageManager(Root * root,Volume * volume)3638c62dfbSIngo Weinhold PackageManager::PackageManager(Root* root, Volume* volume)
3738c62dfbSIngo Weinhold :
386722e1aeSIngo Weinhold BPackageManager(volume->Location(), this, this),
3938c62dfbSIngo Weinhold BPackageManager::UserInteractionHandler(),
4038c62dfbSIngo Weinhold fRoot(root),
4138c62dfbSIngo Weinhold fVolume(volume),
4238c62dfbSIngo Weinhold fSolverPackages(),
4338c62dfbSIngo Weinhold fPackagesAddedByUser(),
4438c62dfbSIngo Weinhold fPackagesRemovedByUser(),
4538c62dfbSIngo Weinhold fProblemWindow(NULL)
4638c62dfbSIngo Weinhold {
4738c62dfbSIngo Weinhold }
4838c62dfbSIngo Weinhold
4938c62dfbSIngo Weinhold
~PackageManager()5038c62dfbSIngo Weinhold PackageManager::~PackageManager()
5138c62dfbSIngo Weinhold {
5238c62dfbSIngo Weinhold if (fProblemWindow != NULL)
5338c62dfbSIngo Weinhold fProblemWindow->PostMessage(B_QUIT_REQUESTED);
5438c62dfbSIngo Weinhold }
5538c62dfbSIngo Weinhold
5638c62dfbSIngo Weinhold
5738c62dfbSIngo Weinhold void
HandleUserChanges()5838c62dfbSIngo Weinhold PackageManager::HandleUserChanges()
5938c62dfbSIngo Weinhold {
6038c62dfbSIngo Weinhold const PackageSet& packagesToActivate = fVolume->PackagesToBeActivated();
6138c62dfbSIngo Weinhold const PackageSet& packagesToDeactivate = fVolume->PackagesToBeDeactivated();
6238c62dfbSIngo Weinhold
6338c62dfbSIngo Weinhold if (packagesToActivate.empty() && packagesToDeactivate.empty())
6438c62dfbSIngo Weinhold return;
6538c62dfbSIngo Weinhold
6638c62dfbSIngo Weinhold if (packagesToActivate.empty()) {
6738c62dfbSIngo Weinhold // only packages removed -- use uninstall mode
6838c62dfbSIngo Weinhold Init(B_ADD_INSTALLED_REPOSITORIES);
6938c62dfbSIngo Weinhold
7038c62dfbSIngo Weinhold BSolverPackageSpecifierList packagesToUninstall;
7138c62dfbSIngo Weinhold for (PackageSet::const_iterator it = packagesToDeactivate.begin();
7238c62dfbSIngo Weinhold it != packagesToDeactivate.end(); ++it) {
7338c62dfbSIngo Weinhold BSolverPackage* solverPackage = _SolverPackageFor(*it);
7438c62dfbSIngo Weinhold if (solverPackage == NULL)
7538c62dfbSIngo Weinhold continue;
7638c62dfbSIngo Weinhold
7738c62dfbSIngo Weinhold if (!packagesToUninstall.AppendSpecifier(solverPackage))
7838c62dfbSIngo Weinhold throw std::bad_alloc();
7938c62dfbSIngo Weinhold fPackagesRemovedByUser.insert(solverPackage);
8038c62dfbSIngo Weinhold }
8138c62dfbSIngo Weinhold
8238c62dfbSIngo Weinhold if (fPackagesRemovedByUser.empty())
8338c62dfbSIngo Weinhold return;
8438c62dfbSIngo Weinhold
8538c62dfbSIngo Weinhold Uninstall(packagesToUninstall);
8638c62dfbSIngo Weinhold } else {
8738c62dfbSIngo Weinhold // packages added and (possibly) remove -- manually add/remove those
8838c62dfbSIngo Weinhold // from the repository and use verify mode
8938c62dfbSIngo Weinhold Init(B_ADD_INSTALLED_REPOSITORIES | B_ADD_REMOTE_REPOSITORIES
9038c62dfbSIngo Weinhold | B_REFRESH_REPOSITORIES);
9138c62dfbSIngo Weinhold
9238c62dfbSIngo Weinhold // disable and remove uninstalled packages
9338c62dfbSIngo Weinhold InstalledRepository& repository = InstallationRepository();
9438c62dfbSIngo Weinhold for (PackageSet::const_iterator it = packagesToDeactivate.begin();
9538c62dfbSIngo Weinhold it != packagesToDeactivate.end(); ++it) {
9638c62dfbSIngo Weinhold BSolverPackage* solverPackage = _SolverPackageFor(*it);
9738c62dfbSIngo Weinhold if (solverPackage == NULL)
9838c62dfbSIngo Weinhold continue;
9938c62dfbSIngo Weinhold
10038c62dfbSIngo Weinhold repository.DisablePackage(solverPackage);
10138c62dfbSIngo Weinhold if (!repository.PackagesToDeactivate().AddItem(solverPackage))
10238c62dfbSIngo Weinhold throw std::bad_alloc();
10338c62dfbSIngo Weinhold fPackagesRemovedByUser.insert(solverPackage);
10438c62dfbSIngo Weinhold }
10538c62dfbSIngo Weinhold
10638c62dfbSIngo Weinhold // add new packages
10738c62dfbSIngo Weinhold BRepositoryBuilder repositoryBuilder(repository);
10838c62dfbSIngo Weinhold for (PackageSet::const_iterator it = packagesToActivate.begin();
10938c62dfbSIngo Weinhold it != packagesToActivate.end(); ++it) {
11038c62dfbSIngo Weinhold Package* package = *it;
11138c62dfbSIngo Weinhold BSolverPackage* solverPackage;
11238c62dfbSIngo Weinhold repositoryBuilder.AddPackage(package->Info(), NULL, &solverPackage);
11338c62dfbSIngo Weinhold fSolverPackages[package] = solverPackage;
11438c62dfbSIngo Weinhold if (!repository.PackagesToActivate().AddItem(solverPackage))
11538c62dfbSIngo Weinhold throw std::bad_alloc();
11638c62dfbSIngo Weinhold fPackagesAddedByUser.insert(solverPackage);
11738c62dfbSIngo Weinhold }
11838c62dfbSIngo Weinhold
11938c62dfbSIngo Weinhold if (fPackagesRemovedByUser.empty() && fPackagesAddedByUser.empty())
12038c62dfbSIngo Weinhold return;
12138c62dfbSIngo Weinhold
12238c62dfbSIngo Weinhold // TODO: When packages are moved out of the packages directory, we can't create
12338c62dfbSIngo Weinhold // a complete "old-state" directory.
12438c62dfbSIngo Weinhold
12538c62dfbSIngo Weinhold VerifyInstallation();
12638c62dfbSIngo Weinhold }
12738c62dfbSIngo Weinhold }
12838c62dfbSIngo Weinhold
12938c62dfbSIngo Weinhold
13038c62dfbSIngo Weinhold void
InitInstalledRepository(InstalledRepository & repository)13138c62dfbSIngo Weinhold PackageManager::InitInstalledRepository(InstalledRepository& repository)
13238c62dfbSIngo Weinhold {
13338c62dfbSIngo Weinhold const char* name = repository.InitialName();
13438c62dfbSIngo Weinhold BRepositoryBuilder repositoryBuilder(repository, name);
13538c62dfbSIngo Weinhold
13638c62dfbSIngo Weinhold if (Volume* volume = fRoot->GetVolume(repository.Location())) {
13738c62dfbSIngo Weinhold for (PackageFileNameHashTable::Iterator it
13832cae724SIngo Weinhold = volume->PackagesByFileNameIterator(); it.HasNext();) {
13938c62dfbSIngo Weinhold Package* package = it.Next();
14038c62dfbSIngo Weinhold if (package->IsActive()) {
14138c62dfbSIngo Weinhold BSolverPackage* solverPackage;
14238c62dfbSIngo Weinhold repositoryBuilder.AddPackage(package->Info(), NULL,
14338c62dfbSIngo Weinhold &solverPackage);
14438c62dfbSIngo Weinhold fSolverPackages[package] = solverPackage;
14538c62dfbSIngo Weinhold }
14638c62dfbSIngo Weinhold }
14738c62dfbSIngo Weinhold }
14838c62dfbSIngo Weinhold }
14938c62dfbSIngo Weinhold
15038c62dfbSIngo Weinhold
15138c62dfbSIngo Weinhold void
ResultComputed(InstalledRepository & repository)15238c62dfbSIngo Weinhold PackageManager::ResultComputed(InstalledRepository& repository)
15338c62dfbSIngo Weinhold {
15438c62dfbSIngo Weinhold // Normalize the result, i.e. remove the packages added by the user which
15538c62dfbSIngo Weinhold // have been removed again in the problem resolution process, and vice
15638c62dfbSIngo Weinhold // versa.
15738c62dfbSIngo Weinhold if (repository.Location() != fVolume->Location())
15838c62dfbSIngo Weinhold return;
15938c62dfbSIngo Weinhold
16038c62dfbSIngo Weinhold PackageList& packagesToActivate = repository.PackagesToActivate();
16138c62dfbSIngo Weinhold PackageList& packagesToDeactivate = repository.PackagesToDeactivate();
16238c62dfbSIngo Weinhold
16338c62dfbSIngo Weinhold for (int32 i = 0; BSolverPackage* package = packagesToDeactivate.ItemAt(i);
16438c62dfbSIngo Weinhold i++) {
16538c62dfbSIngo Weinhold if (fPackagesAddedByUser.erase(package) == 0)
16638c62dfbSIngo Weinhold continue;
16738c62dfbSIngo Weinhold
16838c62dfbSIngo Weinhold for (SolverPackageMap::iterator it = fSolverPackages.begin();
16938c62dfbSIngo Weinhold it != fSolverPackages.end(); ++it) {
17038c62dfbSIngo Weinhold if (it->second == package) {
17138c62dfbSIngo Weinhold fSolverPackages.erase(it);
17238c62dfbSIngo Weinhold break;
17338c62dfbSIngo Weinhold }
17438c62dfbSIngo Weinhold }
17538c62dfbSIngo Weinhold
17638c62dfbSIngo Weinhold repository.EnablePackage(package);
17738c62dfbSIngo Weinhold packagesToDeactivate.RemoveItemAt(i--);
17838c62dfbSIngo Weinhold packagesToActivate.RemoveItem(package);
17938c62dfbSIngo Weinhold repository.DeletePackage(package);
18038c62dfbSIngo Weinhold }
18138c62dfbSIngo Weinhold
18238c62dfbSIngo Weinhold for (int32 i = 0; BSolverPackage* package = packagesToActivate.ItemAt(i);
18338c62dfbSIngo Weinhold i++) {
18438c62dfbSIngo Weinhold if (fPackagesRemovedByUser.erase(package) == 0)
18538c62dfbSIngo Weinhold continue;
18638c62dfbSIngo Weinhold
18738c62dfbSIngo Weinhold repository.EnablePackage(package);
18838c62dfbSIngo Weinhold packagesToActivate.RemoveItemAt(i--);
18938c62dfbSIngo Weinhold packagesToDeactivate.RemoveItem(package);
19038c62dfbSIngo Weinhold
19138c62dfbSIngo Weinhold // Note: We keep the package activated, but nonetheless it is gone,
19238c62dfbSIngo Weinhold // since the user has removed it from the packages directory. So unless
19338c62dfbSIngo Weinhold // the user moves it back, we won't find it upon next reboot.
19438c62dfbSIngo Weinhold // TODO: We probable even run into trouble when the user moves in a
19538c62dfbSIngo Weinhold // replacement afterward.
19638c62dfbSIngo Weinhold }
19738c62dfbSIngo Weinhold }
19838c62dfbSIngo Weinhold
19938c62dfbSIngo Weinhold
20038c62dfbSIngo Weinhold status_t
PrepareTransaction(Transaction & transaction)20138c62dfbSIngo Weinhold PackageManager::PrepareTransaction(Transaction& transaction)
20238c62dfbSIngo Weinhold {
20338c62dfbSIngo Weinhold Volume* volume = fRoot->GetVolume(transaction.Repository().Location());
20438c62dfbSIngo Weinhold if (volume == NULL)
20538c62dfbSIngo Weinhold return B_BAD_VALUE;
20638c62dfbSIngo Weinhold
20738c62dfbSIngo Weinhold return volume->CreateTransaction(transaction.Repository().Location(),
20838c62dfbSIngo Weinhold transaction.ActivationTransaction(),
20938c62dfbSIngo Weinhold transaction.TransactionDirectory());
21038c62dfbSIngo Weinhold }
21138c62dfbSIngo Weinhold
21238c62dfbSIngo Weinhold
21338c62dfbSIngo Weinhold status_t
CommitTransaction(Transaction & transaction,BCommitTransactionResult & _result)21438c62dfbSIngo Weinhold PackageManager::CommitTransaction(Transaction& transaction,
2150de3219eSIngo Weinhold BCommitTransactionResult& _result)
21638c62dfbSIngo Weinhold {
21738c62dfbSIngo Weinhold Volume* volume = fRoot->GetVolume(transaction.Repository().Location());
21838c62dfbSIngo Weinhold if (volume == NULL)
21938c62dfbSIngo Weinhold return B_BAD_VALUE;
22038c62dfbSIngo Weinhold
22138c62dfbSIngo Weinhold // Get the packages that have already been added to/removed from the
22238c62dfbSIngo Weinhold // packages directory and thus need to be handled specially by
22338c62dfbSIngo Weinhold // Volume::CommitTransaction().
22438c62dfbSIngo Weinhold PackageSet packagesAlreadyAdded;
22538c62dfbSIngo Weinhold PackageSet packagesAlreadyRemoved;
22638c62dfbSIngo Weinhold if (volume == fVolume) {
22738c62dfbSIngo Weinhold const PackageSet& packagesToActivate = volume->PackagesToBeActivated();
22838c62dfbSIngo Weinhold for (PackageSet::const_iterator it = packagesToActivate.begin();
22938c62dfbSIngo Weinhold it != packagesToActivate.end(); ++it) {
23038c62dfbSIngo Weinhold Package* package = *it;
23138c62dfbSIngo Weinhold if (fPackagesAddedByUser.find(_SolverPackageFor(package))
23238c62dfbSIngo Weinhold != fPackagesAddedByUser.end()) {
23338c62dfbSIngo Weinhold packagesAlreadyAdded.insert(package);
23438c62dfbSIngo Weinhold }
23538c62dfbSIngo Weinhold }
23638c62dfbSIngo Weinhold
23738c62dfbSIngo Weinhold const PackageSet& packagesToDeactivate
23838c62dfbSIngo Weinhold = volume->PackagesToBeDeactivated();
23938c62dfbSIngo Weinhold for (PackageSet::const_iterator it = packagesToDeactivate.begin();
24038c62dfbSIngo Weinhold it != packagesToDeactivate.end(); ++it) {
24138c62dfbSIngo Weinhold Package* package = *it;
24238c62dfbSIngo Weinhold if (fPackagesRemovedByUser.find(_SolverPackageFor(package))
24338c62dfbSIngo Weinhold != fPackagesRemovedByUser.end()) {
24438c62dfbSIngo Weinhold packagesAlreadyRemoved.insert(package);
24538c62dfbSIngo Weinhold }
24638c62dfbSIngo Weinhold }
24738c62dfbSIngo Weinhold }
24838c62dfbSIngo Weinhold
24938c62dfbSIngo Weinhold volume->CommitTransaction(transaction.ActivationTransaction(),
25038c62dfbSIngo Weinhold packagesAlreadyAdded, packagesAlreadyRemoved, _result);
25138c62dfbSIngo Weinhold return B_OK;
25238c62dfbSIngo Weinhold }
25338c62dfbSIngo Weinhold
25438c62dfbSIngo Weinhold
25538c62dfbSIngo Weinhold void
HandleProblems()25638c62dfbSIngo Weinhold PackageManager::HandleProblems()
25738c62dfbSIngo Weinhold {
25838c62dfbSIngo Weinhold _InitGui();
25938c62dfbSIngo Weinhold
26038c62dfbSIngo Weinhold if (fProblemWindow == NULL)
26138c62dfbSIngo Weinhold fProblemWindow = new ProblemWindow;
26238c62dfbSIngo Weinhold
26338c62dfbSIngo Weinhold if (!fProblemWindow->Go(fSolver, fPackagesAddedByUser,
26438c62dfbSIngo Weinhold fPackagesRemovedByUser)) {
26538c62dfbSIngo Weinhold throw BAbortedByUserException();
26638c62dfbSIngo Weinhold }
26738c62dfbSIngo Weinhold }
26838c62dfbSIngo Weinhold
26938c62dfbSIngo Weinhold
27038c62dfbSIngo Weinhold void
ConfirmChanges(bool fromMostSpecific)27138c62dfbSIngo Weinhold PackageManager::ConfirmChanges(bool fromMostSpecific)
27238c62dfbSIngo Weinhold {
27338c62dfbSIngo Weinhold // Check whether there are any changes other than those made by the user.
2746c883121SIngo Weinhold _InitGui();
2756c883121SIngo Weinhold ResultWindow* window = new ResultWindow;
2766c883121SIngo Weinhold ObjectDeleter<ResultWindow> windowDeleter(window);
2776c883121SIngo Weinhold
27838c62dfbSIngo Weinhold bool hasOtherChanges = false;
27938c62dfbSIngo Weinhold int32 count = fInstalledRepositories.CountItems();
28038c62dfbSIngo Weinhold if (fromMostSpecific) {
28138c62dfbSIngo Weinhold for (int32 i = count - 1; i >= 0; i--)
28238c62dfbSIngo Weinhold hasOtherChanges
2836c883121SIngo Weinhold |= _AddResults(*fInstalledRepositories.ItemAt(i), window);
28438c62dfbSIngo Weinhold } else {
28538c62dfbSIngo Weinhold for (int32 i = 0; i < count; i++)
28638c62dfbSIngo Weinhold hasOtherChanges
2876c883121SIngo Weinhold |= _AddResults(*fInstalledRepositories.ItemAt(i), window);
28838c62dfbSIngo Weinhold }
28938c62dfbSIngo Weinhold
29038c62dfbSIngo Weinhold if (!hasOtherChanges)
29138c62dfbSIngo Weinhold return;
29238c62dfbSIngo Weinhold
2936c883121SIngo Weinhold // show the window
2946c883121SIngo Weinhold if (windowDeleter.Detach()->Go() == 0)
29538c62dfbSIngo Weinhold throw BAbortedByUserException();
29638c62dfbSIngo Weinhold }
29738c62dfbSIngo Weinhold
29838c62dfbSIngo Weinhold
29938c62dfbSIngo Weinhold void
Warn(status_t error,const char * format,...)30038c62dfbSIngo Weinhold PackageManager::Warn(status_t error, const char* format, ...)
30138c62dfbSIngo Weinhold {
30238c62dfbSIngo Weinhold va_list args;
30338c62dfbSIngo Weinhold va_start(args, format);
30438c62dfbSIngo Weinhold BString message;
30538c62dfbSIngo Weinhold message.SetToFormatVarArgs(format, args);
30638c62dfbSIngo Weinhold va_end(args);
30738c62dfbSIngo Weinhold
30838c62dfbSIngo Weinhold if (error != B_OK)
30938c62dfbSIngo Weinhold message << BString().SetToFormat(": %s", strerror(error));
31038c62dfbSIngo Weinhold
31138c62dfbSIngo Weinhold BNotification notification(B_ERROR_NOTIFICATION);
31299e5e3fdSHumdinger notification.SetGroup(B_TRANSLATE("Package daemon"));
31399e5e3fdSHumdinger notification.SetTitle(B_TRANSLATE("Warning"));
31438c62dfbSIngo Weinhold notification.SetContent(message);
31538c62dfbSIngo Weinhold notification.Send();
31638c62dfbSIngo Weinhold }
31738c62dfbSIngo Weinhold
31838c62dfbSIngo Weinhold
31938c62dfbSIngo Weinhold void
ProgressPackageDownloadStarted(const char * packageName)3209345049aSRene Gollent PackageManager::ProgressPackageDownloadStarted(const char* packageName)
3219345049aSRene Gollent {
3229345049aSRene Gollent }
3239345049aSRene Gollent
3249345049aSRene Gollent
3259345049aSRene Gollent void
ProgressPackageDownloadActive(const char * packageName,float completionPercentage,off_t bytes,off_t totalBytes)3269345049aSRene Gollent PackageManager::ProgressPackageDownloadActive(const char* packageName,
3271aaa0c21SAxel Dörfler float completionPercentage, off_t bytes, off_t totalBytes)
3289345049aSRene Gollent {
3299345049aSRene Gollent }
3309345049aSRene Gollent
3319345049aSRene Gollent
3329345049aSRene Gollent void
ProgressPackageDownloadComplete(const char * packageName)3339345049aSRene Gollent PackageManager::ProgressPackageDownloadComplete(const char* packageName)
3349345049aSRene Gollent {
3359345049aSRene Gollent }
3369345049aSRene Gollent
3379345049aSRene Gollent
3389345049aSRene Gollent void
ProgressPackageChecksumStarted(const char * title)3399345049aSRene Gollent PackageManager::ProgressPackageChecksumStarted(const char* title)
3409345049aSRene Gollent {
3419345049aSRene Gollent }
3429345049aSRene Gollent
3439345049aSRene Gollent
3449345049aSRene Gollent void
ProgressPackageChecksumComplete(const char * title)3459345049aSRene Gollent PackageManager::ProgressPackageChecksumComplete(const char* title)
3469345049aSRene Gollent {
3479345049aSRene Gollent }
3489345049aSRene Gollent
3499345049aSRene Gollent
3509345049aSRene Gollent void
ProgressStartApplyingChanges(InstalledRepository & repository)35138c62dfbSIngo Weinhold PackageManager::ProgressStartApplyingChanges(InstalledRepository& repository)
35238c62dfbSIngo Weinhold {
35338c62dfbSIngo Weinhold }
35438c62dfbSIngo Weinhold
35538c62dfbSIngo Weinhold
35638c62dfbSIngo Weinhold void
ProgressTransactionCommitted(InstalledRepository & repository,const BCommitTransactionResult & result)35738c62dfbSIngo Weinhold PackageManager::ProgressTransactionCommitted(InstalledRepository& repository,
358eee42275SIngo Weinhold const BCommitTransactionResult& result)
35938c62dfbSIngo Weinhold {
36038c62dfbSIngo Weinhold }
36138c62dfbSIngo Weinhold
36238c62dfbSIngo Weinhold
36338c62dfbSIngo Weinhold void
ProgressApplyingChangesDone(InstalledRepository & repository)36438c62dfbSIngo Weinhold PackageManager::ProgressApplyingChangesDone(InstalledRepository& repository)
36538c62dfbSIngo Weinhold {
36638c62dfbSIngo Weinhold }
36738c62dfbSIngo Weinhold
36838c62dfbSIngo Weinhold
36938c62dfbSIngo Weinhold void
JobFailed(BSupportKit::BJob * job)370e711e6e4SAxel Dörfler PackageManager::JobFailed(BSupportKit::BJob* job)
37138c62dfbSIngo Weinhold {
37238c62dfbSIngo Weinhold // TODO:...
37338c62dfbSIngo Weinhold }
37438c62dfbSIngo Weinhold
37538c62dfbSIngo Weinhold
37638c62dfbSIngo Weinhold void
JobAborted(BSupportKit::BJob * job)377e711e6e4SAxel Dörfler PackageManager::JobAborted(BSupportKit::BJob* job)
37838c62dfbSIngo Weinhold {
37938c62dfbSIngo Weinhold // TODO:...
38038c62dfbSIngo Weinhold }
38138c62dfbSIngo Weinhold
38238c62dfbSIngo Weinhold
38338c62dfbSIngo Weinhold bool
_AddResults(InstalledRepository & repository,ResultWindow * window)3846c883121SIngo Weinhold PackageManager::_AddResults(InstalledRepository& repository,
3856c883121SIngo Weinhold ResultWindow* window)
38638c62dfbSIngo Weinhold {
38738c62dfbSIngo Weinhold if (!repository.HasChanges())
38838c62dfbSIngo Weinhold return false;
38938c62dfbSIngo Weinhold
3906c883121SIngo Weinhold return window->AddLocationChanges(repository.Name(),
3916c883121SIngo Weinhold repository.PackagesToActivate(), fPackagesAddedByUser,
3926c883121SIngo Weinhold repository.PackagesToDeactivate(), fPackagesRemovedByUser);
39338c62dfbSIngo Weinhold }
39438c62dfbSIngo Weinhold
39538c62dfbSIngo Weinhold
39638c62dfbSIngo Weinhold BSolverPackage*
_SolverPackageFor(Package * package) const39738c62dfbSIngo Weinhold PackageManager::_SolverPackageFor(Package* package) const
39838c62dfbSIngo Weinhold {
39938c62dfbSIngo Weinhold SolverPackageMap::const_iterator it = fSolverPackages.find(package);
40038c62dfbSIngo Weinhold return it != fSolverPackages.end() ? it->second : NULL;
40138c62dfbSIngo Weinhold }
40238c62dfbSIngo Weinhold
40338c62dfbSIngo Weinhold
40438c62dfbSIngo Weinhold void
_InitGui()40538c62dfbSIngo Weinhold PackageManager::_InitGui()
40638c62dfbSIngo Weinhold {
40738c62dfbSIngo Weinhold BServer* server = dynamic_cast<BServer*>(be_app);
40838c62dfbSIngo Weinhold if (server == NULL || server->InitGUIContext() != B_OK)
40938c62dfbSIngo Weinhold throw BFatalErrorException("failed to initialize the GUI");
41038c62dfbSIngo Weinhold }
411