Class CInstallComposer#

Nested Relationships#

Nested Types#

Class Documentation#

class CInstallComposer#

Installation packager class.

Public Types

enum class EAddModuleFlags : uint32_t#

Flags to use with the AddModule function.

Values:

enumerator wildcards#

Add all modules that fit the modules path using wildcards to search for modules; could also point to a directory. Wildcards are ‘*’, ‘**’ and ‘?’. The ‘*’ will allow matching zero or more characters until the next separator (‘.’ or ‘/’). A ‘**’ allows matching of zero or more characters across the directory separator ‘/’. A ‘?’ allows matching one character. Examples (using path: /dir1/dir2/dir3/dir4/file.txt)

  • Pattern /dir1/

enumerator regex#

Add all modules that fit the modules path using regular expression to search for modules; could also point to a directory.

enumerator keep_structure#

Maintain the directory structure when adding modules (requires a valid base directory).

enum class EUpdateRules#

Installation update rules.

Values:

enumerator not_allowed#

Not allowed to update an existing installation.

enumerator update_when_new#

Allow to update when the installation is newer.

enumerator overwrite#

Always allow to update.

Public Functions

CInstallComposer() = default#

Default constructor.

~CInstallComposer()#

Destructor, finalizing the installation if not done so before.

void Clear()#

Clear the current package to allow a new package composition.

std::vector<std::filesystem::path> AddModule(const std::filesystem::path &rpathBasePath, const std::string &rssModulePath, const std::filesystem::path &rpathRelTargetDir = ".", uint32_t uiFlags = 0)#

Add a module to the installation.

Add a module to the installation package.

Attention

This function is part of the composer. Since it is loading a module to retrieve the component manifest of the module, module code could be executed. it therefore imposes a security risk. Do not call this function in sdv_core!

Throws:

Could – throw a sdv::XSysExcept based exception.

Parameters:
  • rpathBasePath[in] Reference to the base path to start searching for modules. Could be empty if the module path is absolute, in which case the directory structure cannot be stored at the target.

  • rssModulePath[in] Reference to the string containing the module path to install. Depending on the options, this path could contain a pattern with wildcards or regular expressions. If the path is relative, the module base path must be valid. The module path is optional. If not supplied, the base path must be provided and all files within all subdirectories will be added.

  • rpathRelTargetDir[in] Reference to the relative target directory the module(s) should be stored at.

  • uiFlags[in] Zero or more flags from EAddModuleFlags.

Returns:

Returns the a vector of modules that were added. In case of using wildcards or regular expression, this could also be an empty list, which is not an error.

void AddProperty(const std::string &rssName, const std::string &rssValue)#

Add a property value. This value will be added to the installation manifest.

Add a property value, which will be included in the installation manifest. The properties “Description” and “Version” are used during package management.

Parameters:
  • rssName[in] Name of the property. Spaces are allowed. Quotes are not allowed.

  • rssValue[in] Property value.

sdv::pointer<uint8_t> Compose(const std::string &rssInstallName) const#

Compose the package in memory.

Compose a package from all the modules added through the AddModule function. Additionally add an installation manifest containing the module and component details. If the module is an SDV module, the component manifest will automatically extracted from the component and added to the installation manifest.

Attention

This function is part of the composer. Since it is loading a module to retrieve the component manifest of the module, module code could be executed. it therefore imposes a security risk. Do not call this function in sdv_core!

Throws:

Could – throw a sdv::XSysExcept based exception.

Parameters:

rssInstallName[in] Reference to the string containing the installation name.

Returns:

Returns a buffer to the package content.

bool Compose(const std::filesystem::path &rpathPackage, const std::string &rssInstallName) const#

Compose the package to disk.

Compose a package from all the modules added through the AddModule function. Additionally add an installation manifest containing the module and component details. If the module is an SDV module, the component manifest will automatically extracted from the component and added to the installation manifest.

Attention

This function is part of the composer. Since it is loading a module to retrieve the component manifest of the module, module code could be executed. it therefore imposes a security risk. Do not call this function in sdv_core!

Throws:

Could – throw a sdv::XSysExcept based exception.

Parameters:
  • rpathPackage[in] Reference to the path receiving the package content. Any existing package will be overwritten.

  • rssInstallName[in] Reference to the string containing the installation name.

Returns:

Returns whether the package composing was successful.

CInstallManifest ComposeDirect(const std::string &rssInstallName, const std::filesystem::path &rpathInstallDir, EUpdateRules eUpdateRule = EUpdateRules::not_allowed) const#

Compose the installation directly at the target directory (without package composing and extracting).

Compose a package from all the modules added through the AddModule function. Additionally add an installation manifest containing the module and component details. If the module is an SDV module, the component manifest will automatically extracted from the component and added to the installation manifest.

Attention

This function is part of the composer. Since it is loading a module to retrieve the component manifest of the module, module code could be executed. it therefore imposes a security risk. Do not call this function in sdv_core!

Throws:

Could – throw a sdv::XSysExcept based exception.

Parameters:
  • rssInstallName[in] Reference to the string containing the installation name.

  • rpathInstallDir[in] Reference to the installation directory.

  • eUpdateRule[in] Decide how to deal with updating an existing installation.

Returns:

Returns the installation manifest when the package extraction was successful; or an empty manifest when not.

CInstallManifest ComposeInstallManifest(const std::string &rssInstallName) const#

Compose an installation manifest.

Compose a package from all the modules added through the AddModule function. Additionally add an installation manifest containing the module and component details. If the module is an SDV module, the component manifest will automatically extracted from the component and added to the installation manifest.

Attention

This function is part of the composer. Since it is loading a module to retrieve the component manifest of the module, module code could be executed. it therefore imposes a security risk. Do not call this function in sdv_core!

Throws:

Could – throw a sdv::XSysExcept based exception.

Parameters:

rssInstallName[in] Reference to the string containing the installation name.

Returns:

Returns an initialized installation manifest if successful, or an empty manifest if not.

Public Static Functions

static CInstallManifest Extract(const sdv::pointer<uint8_t> &rptrPackage, const std::filesystem::path &rpathInstallDir, EUpdateRules eUpdateRule = EUpdateRules::not_allowed)#

Extract a package to an installation directory.

Throws:

Could – throw a sdv::XSysExcept based exception.

Parameters:
  • rptrPackage[in] Reference to the pointer containing the package content.

  • rpathInstallDir[in] Reference to the installation directory.

  • eUpdateRule[in] Decide how to deal with updating an existing installation.

Pre:

An installation directory must be available.

Returns:

Returns the installation manifest when the package extraction was successful; or an empty manifest when not.

static CInstallManifest Extract(const std::filesystem::path &rpathPackage, const std::filesystem::path &rpathInstallDir, EUpdateRules eUpdateRule = EUpdateRules::not_allowed)#

Extract a package to an installation directory.

Throws:

Could – throw a sdv::XSysExcept based exception.

Parameters:
  • rpathPackage[in] Reference to the path of the package file.

  • rpathInstallDir[in] Reference to the installation directory.

  • eUpdateRule[in] Decide how to deal with updating an existing installation.

Pre:

An installation directory must be available.

Returns:

Returns the installation manifest when the package extraction was successful; or an empty manifest when not.

static CInstallManifest Remove(const std::string &rssInstallName, const std::filesystem::path &rpathInstallDir)#

Remove an installation.

Throws:

Could – throw a sdv::XSysExcept based exception.

Parameters:
  • rssInstallName[in] Reference to the string containing the installation name.

  • rpathInstallDir[in] Reference to the installation directory.

Returns:

Returns the installation manifest of the removed installation when the removal was successful; or an empty manifest when not.

static bool Verify(const sdv::pointer<uint8_t> &rptrPackage)#

Verify the integrity of an installation package.

Throws:

Could – throw a sdv::XSysExcept based exception with information about the integrity violation.

Parameters:

rptrPackage[in] Reference to the pointer containing the package content.

Returns:

Returns ‘true’ when the package extraction was successful; ‘false’ when not.

static bool Verify(const std::filesystem::path &rpathPackage)#

Verify the integrity of an installation package.

Throws:

Could – throw a sdv::XSysExcept based exception with information about the integrity violation.

Parameters:

rpathPackage[in] Reference to the path of the package file.

Returns:

Returns ‘true’ when the package extraction was successful; ‘false’ when not.

static CInstallManifest ExtractInstallManifest(const sdv::pointer<uint8_t> &rptrPackage)#

Extract an installation manifest from a package.

Throws:

Could – throw a sdv::XSysExcept based exception.

Parameters:

rptrPackage[in] Reference to the pointer containing the package content.

Returns:

Returns ‘true’ when the package extraction was successful; ‘false’ when not.

static CInstallManifest ExtractInstallManifest(const std::filesystem::path &rpathPackage)#

Extract an installation manifest from a package.

Throws:

Could – throw a sdv::XSysExcept based exception.

Parameters:

rpathPackage[in] Reference to the path of the package file.

Returns:

Returns ‘true’ when the package extraction was successful; ‘false’ when not.