package daemon: Don't apply system package changes immediately

When a system package is going to be deactivated, activate/deactivate
the packages of the whole transaction only to the latest state.
Afterward latest state and active state will differ.
This commit is contained in:
Ingo Weinhold
2014-05-01 18:18:37 +02:00
parent 2dbf8167fe
commit fe28d36222
2 changed files with 25 additions and 0 deletions
@@ -368,6 +368,11 @@ CommitTransactionHandler::_RemovePackagesToDeactivate()
for (PackageSet::const_iterator it = fPackagesToDeactivate.begin();
it != fPackagesToDeactivate.end(); ++it) {
Package* package = *it;
// When deactivating (or updating) a system package, don't do that live.
if (_IsSystemPackage(package))
fVolumeStateIsActive = false;
if (fPackagesAlreadyRemoved.find(package)
!= fPackagesAlreadyRemoved.end()) {
fRemovedPackages.insert(package);
@@ -1508,6 +1513,24 @@ CommitTransactionHandler::_FillInActivationChangeItem(
}
bool
CommitTransactionHandler::_IsSystemPackage(Package* package)
{
// package name should be "haiku[_<arch>]"
const BString& name = package->Info().Name();
if (!name.StartsWith("haiku"))
return false;
if (name.Length() == 5)
return true;
if (name[5] != '_')
return false;
BPackageArchitecture architecture;
return BPackageInfo::GetArchitectureByName(name.String() + 6, architecture)
== B_OK;
}
/*static*/ BString
CommitTransactionHandler::_GetPath(const FSUtils::Entry& entry,
const BString& fallback)
@@ -127,6 +127,8 @@ private:
PackageFSActivationChangeType type,
Package* package, char*& nameBuffer);
bool _IsSystemPackage(Package* package);
static BString _GetPath(const FSUtils::Entry& entry,
const BString& fallback);