e2c7bb900c
A bit of an explanation for these weirdly named functions: LatestActivePackageInfos() returns the packages on the system that are both installed and fully set up. When packages are in the middle of being installed, LatestInactivePackageInfos() shows the packages in the process of being installed. Once the installation process is done, LatestInactivePackageInfos() returns nothing. If there are packages that can't be fully activated without a reboot, CurrentlyActivePackageInfos() will return the same information as LatestActivePackageInfos(), or if everything has been installed and activated, it will return no packages. Change-Id: Ia1814a5abda6d815c46e0b46dc812b4e7af81de3 Reviewed-on: https://review.haiku-os.org/c/1129 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
106 lines
2.5 KiB
C++
106 lines
2.5 KiB
C++
/*
|
|
* Copyright 2011-2014, Haiku, Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _PACKAGE__PACKAGE_ROSTER_H_
|
|
#define _PACKAGE__PACKAGE_ROSTER_H_
|
|
|
|
|
|
#include <Entry.h>
|
|
#include <FindDirectory.h>
|
|
#include <Path.h>
|
|
|
|
#include <package/PackageDefs.h>
|
|
|
|
|
|
class BStringList;
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
struct BRepositoryConfigVisitor {
|
|
virtual ~BRepositoryConfigVisitor()
|
|
{
|
|
}
|
|
|
|
virtual status_t operator()(const BEntry& entry) = 0;
|
|
};
|
|
|
|
|
|
class BInstallationLocationInfo;
|
|
class BPackageInfoSet;
|
|
class BRepositoryCache;
|
|
class BRepositoryConfig;
|
|
|
|
|
|
// watchable events
|
|
enum {
|
|
B_WATCH_PACKAGE_INSTALLATION_LOCATIONS = 0x0001,
|
|
// de-/activation of packages in standard installation locations
|
|
};
|
|
|
|
// notification message "event" field values
|
|
enum {
|
|
B_INSTALLATION_LOCATION_PACKAGES_CHANGED,
|
|
// "location": int32
|
|
// the installation location
|
|
// (B_PACKAGE_INSTALLATION_LOCATION_{SYSTEM,HOME}
|
|
// "change count": int64
|
|
// the installation location change count
|
|
};
|
|
|
|
|
|
class BPackageRoster {
|
|
public:
|
|
BPackageRoster();
|
|
~BPackageRoster();
|
|
|
|
bool IsRebootNeeded();
|
|
|
|
status_t GetCommonRepositoryCachePath(BPath* path,
|
|
bool create = false) const;
|
|
status_t GetUserRepositoryCachePath(BPath* path,
|
|
bool create = false) const;
|
|
|
|
status_t GetCommonRepositoryConfigPath(BPath* path,
|
|
bool create = false) const;
|
|
status_t GetUserRepositoryConfigPath(BPath* path,
|
|
bool create = false) const;
|
|
|
|
status_t GetRepositoryNames(BStringList& names);
|
|
|
|
status_t VisitCommonRepositoryConfigs(
|
|
BRepositoryConfigVisitor& visitor);
|
|
status_t VisitUserRepositoryConfigs(
|
|
BRepositoryConfigVisitor& visitor);
|
|
|
|
status_t GetRepositoryCache(const BString& name,
|
|
BRepositoryCache* repositoryCache);
|
|
status_t GetRepositoryConfig(const BString& name,
|
|
BRepositoryConfig* repositoryConfig);
|
|
|
|
status_t GetInstallationLocationInfo(
|
|
BPackageInstallationLocation location,
|
|
BInstallationLocationInfo& _info);
|
|
status_t GetActivePackages(
|
|
BPackageInstallationLocation location,
|
|
BPackageInfoSet& packageInfos);
|
|
|
|
status_t StartWatching(const BMessenger& target,
|
|
uint32 eventMask);
|
|
status_t StopWatching(const BMessenger& target);
|
|
|
|
private:
|
|
status_t _GetRepositoryPath(BPath* path, bool create,
|
|
directory_which whichDir) const;
|
|
status_t _VisitRepositoryConfigs(const BPath& path,
|
|
BRepositoryConfigVisitor& visitor);
|
|
};
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
#endif // _PACKAGE__PACKAGE_ROSTER_H_
|