hpkg format: Generalize user/global settings file attributes
* For all identifiers: Rename global settings file to global writable file. We want to use the respective attribute also for other writable files, not only settings files. * User settings file/global writable file info/attribute: Add isDirectory property/child attribute. This allows declaring global/ user settings directories associated with the package.
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _PACKAGE__GLOBAL_SETTINGS_FILE_INFO_H_
|
||||
#define _PACKAGE__GLOBAL_SETTINGS_FILE_INFO_H_
|
||||
|
||||
|
||||
#include <package/SettingsFileUpdateType.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
namespace BHPKG {
|
||||
struct BGlobalSettingsFileInfoData;
|
||||
}
|
||||
|
||||
|
||||
class BGlobalSettingsFileInfo {
|
||||
public:
|
||||
BGlobalSettingsFileInfo();
|
||||
BGlobalSettingsFileInfo(
|
||||
const BHPKG::BGlobalSettingsFileInfoData&
|
||||
infoData);
|
||||
BGlobalSettingsFileInfo(const BString& path,
|
||||
BSettingsFileUpdateType updateType);
|
||||
~BGlobalSettingsFileInfo();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
const BString& Path() const;
|
||||
bool IsIncluded() const;
|
||||
BSettingsFileUpdateType UpdateType() const;
|
||||
|
||||
void SetTo(const BString& path,
|
||||
BSettingsFileUpdateType updateType);
|
||||
|
||||
private:
|
||||
BString fPath;
|
||||
BSettingsFileUpdateType fUpdateType;
|
||||
};
|
||||
|
||||
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _PACKAGE__GLOBAL_SETTINGS_FILE_INFO_H_
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2013, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _PACKAGE__GLOBAL_WRITABLE_FILE_INFO_H_
|
||||
#define _PACKAGE__GLOBAL_WRITABLE_FILE_INFO_H_
|
||||
|
||||
|
||||
#include <package/WritableFileUpdateType.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
namespace BHPKG {
|
||||
struct BGlobalWritableFileInfoData;
|
||||
}
|
||||
|
||||
|
||||
class BGlobalWritableFileInfo {
|
||||
public:
|
||||
BGlobalWritableFileInfo();
|
||||
BGlobalWritableFileInfo(
|
||||
const BHPKG::BGlobalWritableFileInfoData&
|
||||
infoData);
|
||||
BGlobalWritableFileInfo(const BString& path,
|
||||
BWritableFileUpdateType updateType,
|
||||
bool isDirectory);
|
||||
~BGlobalWritableFileInfo();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
const BString& Path() const;
|
||||
bool IsIncluded() const;
|
||||
BWritableFileUpdateType UpdateType() const;
|
||||
bool IsDirectory() const;
|
||||
|
||||
void SetTo(const BString& path,
|
||||
BWritableFileUpdateType updateType,
|
||||
bool isDirectory);
|
||||
|
||||
private:
|
||||
BString fPath;
|
||||
BWritableFileUpdateType fUpdateType;
|
||||
bool fIsDirectory;
|
||||
};
|
||||
|
||||
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _PACKAGE__GLOBAL_WRITABLE_FILE_INFO_H_
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <String.h>
|
||||
#include <StringList.h>
|
||||
|
||||
#include <package/GlobalSettingsFileInfo.h>
|
||||
#include <package/GlobalWritableFileInfo.h>
|
||||
#include <package/PackageArchitecture.h>
|
||||
#include <package/PackageFlags.h>
|
||||
#include <package/PackageInfoAttributes.h>
|
||||
@@ -82,8 +82,8 @@ public:
|
||||
const BStringList& URLList() const;
|
||||
const BStringList& SourceURLList() const;
|
||||
|
||||
const BObjectList<BGlobalSettingsFileInfo>&
|
||||
GlobalSettingsFileInfos() const;
|
||||
const BObjectList<BGlobalWritableFileInfo>&
|
||||
GlobalWritableFileInfos() const;
|
||||
const BObjectList<BUserSettingsFileInfo>&
|
||||
UserSettingsFileInfos() const;
|
||||
|
||||
@@ -133,9 +133,9 @@ public:
|
||||
void ClearSourceURLList();
|
||||
status_t AddSourceURL(const BString& url);
|
||||
|
||||
void ClearGlobalSettingsFileInfos();
|
||||
status_t AddGlobalSettingsFileInfo(
|
||||
const BGlobalSettingsFileInfo& info);
|
||||
void ClearGlobalWritableFileInfos();
|
||||
status_t AddGlobalWritableFileInfo(
|
||||
const BGlobalWritableFileInfo& info);
|
||||
|
||||
void ClearUserSettingsFileInfos();
|
||||
status_t AddUserSettingsFileInfo(
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
public:
|
||||
static const char* const kElementNames[];
|
||||
static const char* const kArchitectureNames[];
|
||||
static const char* const kSettingsFileUpdateTypes[];
|
||||
static const char* const kWritableFileUpdateTypes[];
|
||||
|
||||
private:
|
||||
class Parser;
|
||||
@@ -206,8 +206,8 @@ private:
|
||||
typedef BObjectList<BPackageResolvableExpression>
|
||||
ResolvableExpressionList;
|
||||
|
||||
typedef BObjectList<BGlobalSettingsFileInfo>
|
||||
GlobalSettingsFileInfoList;
|
||||
typedef BObjectList<BGlobalWritableFileInfo>
|
||||
GlobalWritableFileInfoList;
|
||||
typedef BObjectList<BUserSettingsFileInfo>
|
||||
UserSettingsFileInfoList;
|
||||
|
||||
@@ -227,9 +227,9 @@ private:
|
||||
const char* field,
|
||||
const ResolvableExpressionList&
|
||||
expressions);
|
||||
static status_t _AddGlobalSettingsFileInfos(BMessage* archive,
|
||||
static status_t _AddGlobalWritableFileInfos(BMessage* archive,
|
||||
const char* field,
|
||||
const GlobalSettingsFileInfoList&
|
||||
const GlobalWritableFileInfoList&
|
||||
infos);
|
||||
static status_t _AddUserSettingsFileInfos(BMessage* archive,
|
||||
const char* field,
|
||||
@@ -249,9 +249,9 @@ private:
|
||||
static status_t _ExtractResolvableExpressions(BMessage* archive,
|
||||
const char* field,
|
||||
ResolvableExpressionList& _expressions);
|
||||
static status_t _ExtractGlobalSettingsFileInfos(
|
||||
static status_t _ExtractGlobalWritableFileInfos(
|
||||
BMessage* archive, const char* field,
|
||||
GlobalSettingsFileInfoList& _infos);
|
||||
GlobalWritableFileInfoList& _infos);
|
||||
static status_t _ExtractUserSettingsFileInfos(
|
||||
BMessage* archive, const char* field,
|
||||
UserSettingsFileInfoList& _infos);
|
||||
@@ -277,7 +277,7 @@ private:
|
||||
BStringList fURLList;
|
||||
BStringList fSourceURLList;
|
||||
|
||||
BObjectList<BGlobalSettingsFileInfo> fGlobalSettingsFileInfos;
|
||||
BObjectList<BGlobalWritableFileInfo> fGlobalWritableFileInfos;
|
||||
BObjectList<BUserSettingsFileInfo> fUserSettingsFileInfos;
|
||||
|
||||
UserList fUsers;
|
||||
|
||||
@@ -41,8 +41,8 @@ enum BPackageInfoAttributeID {
|
||||
B_PACKAGE_INFO_INSTALL_PATH, // package install path; only for package
|
||||
// building
|
||||
B_PACKAGE_INFO_BASE_PACKAGE, // name of the base package for this package
|
||||
B_PACKAGE_INFO_GLOBAL_SETTINGS_FILES,
|
||||
// list of global settings file infos
|
||||
B_PACKAGE_INFO_GLOBAL_WRITABLE_FILES,
|
||||
// list of global writable file infos
|
||||
B_PACKAGE_INFO_USER_SETTINGS_FILES,
|
||||
// list of user settings file infos
|
||||
B_PACKAGE_INFO_USERS,
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _PACKAGE__SETTINGS_FILE_UPDATE_TYPE_H_
|
||||
#define _PACKAGE__SETTINGS_FILE_UPDATE_TYPE_H_
|
||||
|
||||
|
||||
#include <String.h>
|
||||
|
||||
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
// global settings file update types -- specifies behavior in case the previous
|
||||
// version of a settings file provided by a package has been changed by the
|
||||
// user.
|
||||
enum BSettingsFileUpdateType {
|
||||
B_SETTINGS_FILE_UPDATE_TYPE_KEEP_OLD = 0,
|
||||
// the old settings file can be kept
|
||||
B_SETTINGS_FILE_UPDATE_TYPE_MANUAL = 1,
|
||||
// the old settings file needs to be updated manually
|
||||
B_SETTINGS_FILE_UPDATE_TYPE_AUTO_MERGE = 2,
|
||||
// try a three-way merge
|
||||
|
||||
B_SETTINGS_FILE_UPDATE_TYPE_ENUM_COUNT,
|
||||
|
||||
B_SETTINGS_FILE_UPDATE_TYPE_DEFAULT = B_SETTINGS_FILE_UPDATE_TYPE_KEEP_OLD
|
||||
};
|
||||
|
||||
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _PACKAGE__SETTINGS_FILE_UPDATE_TYPE_H_
|
||||
@@ -25,19 +25,25 @@ public:
|
||||
infoData);
|
||||
BUserSettingsFileInfo(const BString& path,
|
||||
const BString& templatePath = BString());
|
||||
BUserSettingsFileInfo(const BString& path,
|
||||
bool isDirectory);
|
||||
~BUserSettingsFileInfo();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
const BString& Path() const;
|
||||
const BString& TemplatePath() const;
|
||||
bool IsDirectory() const;
|
||||
|
||||
void SetTo(const BString& path,
|
||||
const BString& templatePath = BString());
|
||||
void SetTo(const BString& path,
|
||||
bool isDirectory);
|
||||
|
||||
private:
|
||||
BString fPath;
|
||||
BString fTemplatePath;
|
||||
bool fIsDirectory;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2013, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _PACKAGE__WRITABLE_FILE_UPDATE_TYPE_H_
|
||||
#define _PACKAGE__WRITABLE_FILE_UPDATE_TYPE_H_
|
||||
|
||||
|
||||
#include <String.h>
|
||||
|
||||
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
// global writable file update types -- specifies behavior in case the previous
|
||||
// version of a writable file provided by a package has been changed by the
|
||||
// user.
|
||||
enum BWritableFileUpdateType {
|
||||
B_WRITABLE_FILE_UPDATE_TYPE_KEEP_OLD = 0,
|
||||
// the old writable file can be kept
|
||||
B_WRITABLE_FILE_UPDATE_TYPE_MANUAL = 1,
|
||||
// the old writable file needs to be updated manually
|
||||
B_WRITABLE_FILE_UPDATE_TYPE_AUTO_MERGE = 2,
|
||||
// try a three-way merge
|
||||
|
||||
B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT,
|
||||
|
||||
B_WRITABLE_FILE_UPDATE_TYPE_DEFAULT = B_WRITABLE_FILE_UPDATE_TYPE_KEEP_OLD
|
||||
};
|
||||
|
||||
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _PACKAGE__WRITABLE_FILE_UPDATE_TYPE_H_
|
||||
@@ -62,12 +62,12 @@ B_DEFINE_HPKG_ATTRIBUTE(40, STRING, "package:install-path",
|
||||
PACKAGE_INSTALL_PATH)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(41, STRING, "package:base-package",
|
||||
PACKAGE_BASE_PACKAGE)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(42, STRING, "package:global-settings-file",
|
||||
PACKAGE_GLOBAL_SETTINGS_FILE)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(42, STRING, "package:global-writable-file",
|
||||
PACKAGE_GLOBAL_WRITABLE_FILE)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(43, STRING, "package:user-settings-file",
|
||||
PACKAGE_USER_SETTINGS_FILE)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(44, UINT, "package:settings-file-update-type",
|
||||
PACKAGE_SETTINGS_FILE_UPDATE_TYPE)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(44, UINT, "package:writable-file-update-type",
|
||||
PACKAGE_WRITABLE_FILE_UPDATE_TYPE)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(45, STRING, "package:settings-file-template",
|
||||
PACKAGE_SETTINGS_FILE_TEMPLATE)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(46, STRING, "package:user", PACKAGE_USER)
|
||||
@@ -79,3 +79,5 @@ B_DEFINE_HPKG_ATTRIBUTE(50, STRING, "package:user.group", PACKAGE_USER_GROUP)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(51, STRING, "package:group", PACKAGE_GROUP)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(52, STRING, "package:post-install-script",
|
||||
PACKAGE_POST_INSTALL_SCRIPT)
|
||||
B_DEFINE_HPKG_ATTRIBUTE(53, UINT, "package:is-writable-directory",
|
||||
PACKAGE_IS_WRITABLE_DIRECTORY)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <package/PackageArchitecture.h>
|
||||
#include <package/PackageInfoAttributes.h>
|
||||
#include <package/PackageResolvableOperator.h>
|
||||
#include <package/SettingsFileUpdateType.h>
|
||||
#include <package/WritableFileUpdateType.h>
|
||||
|
||||
|
||||
namespace BPackageKit {
|
||||
@@ -47,15 +47,17 @@ struct BPackageResolvableExpressionData {
|
||||
};
|
||||
|
||||
|
||||
struct BGlobalSettingsFileInfoData {
|
||||
struct BGlobalWritableFileInfoData {
|
||||
const char* path;
|
||||
BSettingsFileUpdateType updateType;
|
||||
BWritableFileUpdateType updateType;
|
||||
bool isDirectory;
|
||||
};
|
||||
|
||||
|
||||
struct BUserSettingsFileInfoData {
|
||||
const char* path;
|
||||
const char* templatePath;
|
||||
bool isDirectory;
|
||||
};
|
||||
|
||||
|
||||
@@ -76,7 +78,7 @@ struct BPackageInfoAttributeValue {
|
||||
BPackageVersionData version;
|
||||
BPackageResolvableData resolvable;
|
||||
BPackageResolvableExpressionData resolvableExpression;
|
||||
BGlobalSettingsFileInfoData globalSettingsFileInfo;
|
||||
BGlobalWritableFileInfoData globalWritableFileInfo;
|
||||
BUserSettingsFileInfoData userSettingsFileInfo;
|
||||
BUserData user;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user