Merge topic 'cpackifw-options'

9a24ab6b CPackIFW: Add some options

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1298
This commit is contained in:
Brad King 2017-09-25 12:58:21 +00:00 committed by Kitware Robot
commit 62bdc587eb
4 changed files with 77 additions and 6 deletions

View File

@ -0,0 +1,6 @@
cpackifw-options
----------------
* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and
:command:`cpack_ifw_configure_component_group` commands gained a new
``REPLACES`` and ``CHECKABLE`` options.

View File

@ -323,7 +323,9 @@
# [LICENSES <display_name> <file_path> ...]
# [DEFAULT <value>]
# [USER_INTERFACES <file_path> <file_path> ...]
# [TRANSLATIONS <file_path> <file_path> ...])
# [TRANSLATIONS <file_path> <file_path> ...]
# [REPLACES <comp_id> ...]
# [CHECKABLE <value>])
#
# This command should be called after :command:`cpack_add_component` command.
#
@ -404,6 +406,15 @@
# ``TRANSLATIONS``
# is a list of <file_path> ('.qm' files) representing translations to load.
#
# ``REPLACES``
# list of identifiers of component or component group to replace.
#
# ``CHECKABLE``
# Possible values are: TRUE, FALSE.
# Set to FALSE if you want to hide the checkbox for an item.
# This is useful when only a few subcomponents should be selected
# instead of all.
#
#
# .. command:: cpack_ifw_configure_component_group
#
@ -426,7 +437,9 @@
# [LICENSES <display_name> <file_path> ...]
# [DEFAULT <value>]
# [USER_INTERFACES <file_path> <file_path> ...]
# [TRANSLATIONS <file_path> <file_path> ...])
# [TRANSLATIONS <file_path> <file_path> ...]
# [REPLACES <comp_id> ...]
# [CHECKABLE <value>])
#
# This command should be called after :command:`cpack_add_component_group`
# command.
@ -499,6 +512,15 @@
# ``TRANSLATIONS``
# is a list of <file_path> ('.qm' files) representing translations to load.
#
# ``REPLACES``
# list of identifiers of component or component group to replace.
#
# ``CHECKABLE``
# Possible values are: TRUE, FALSE.
# Set to FALSE if you want to hide the checkbox for an item.
# This is useful when only a few subcomponents should be selected
# instead of all.
#
#
# .. command:: cpack_ifw_add_repository
#
@ -882,8 +904,8 @@ macro(cpack_ifw_configure_component compname)
string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME)
set(_IFW_OPT COMMON ESSENTIAL VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS)
set(_IFW_ARGS NAME VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT)
set(_IFW_MULTI_ARGS DISPLAY_NAME DESCRIPTION DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS)
set(_IFW_ARGS NAME VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT CHECKABLE)
set(_IFW_MULTI_ARGS DISPLAY_NAME DESCRIPTION DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS REPLACES)
cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
_cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT)
@ -923,8 +945,8 @@ macro(cpack_ifw_configure_component_group grpname)
string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME)
set(_IFW_OPT VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS)
set(_IFW_ARGS NAME VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT)
set(_IFW_MULTI_ARGS DISPLAY_NAME DESCRIPTION DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS)
set(_IFW_ARGS NAME VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT CHECKABLE)
set(_IFW_MULTI_ARGS DISPLAY_NAME DESCRIPTION DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS REPLACES)
cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
_cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT)

View File

@ -482,6 +482,15 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
this->ForcedInstallation = "false";
}
// Replaces
option = prefix + "REPLACES";
if (this->IsSetToEmpty(option)) {
this->Replaces.clear();
} else if (const char* value = this->GetOption(option)) {
this->Replaces.clear();
cmSystemTools::ExpandListArgument(value, this->Replaces);
}
// Requires admin rights
option = prefix + "REQUIRES_ADMIN_RIGHTS";
if (this->IsSetToEmpty(option)) {
@ -492,6 +501,16 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
this->RequiresAdminRights = "false";
}
// Checkable
option = prefix + "CHECKABLE";
if (this->IsSetToEmpty(option)) {
this->Checkable.clear();
} else if (this->IsOn(option)) {
this->Checkable = "true";
} else if (this->IsSetToOff(option)) {
this->Checkable = "false";
}
return 1;
}
@ -652,6 +671,19 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.Element("ForcedInstallation", this->ForcedInstallation);
}
// Replaces
if (!this->Replaces.empty()) {
std::ostringstream replaces;
std::vector<std::string>::iterator it = this->Replaces.begin();
replaces << *it;
++it;
while (it != this->Replaces.end()) {
replaces << "," << *it;
++it;
}
xout.Element("Replaces", replaces.str());
}
if (!this->RequiresAdminRights.empty()) {
xout.Element("RequiresAdminRights", this->RequiresAdminRights);
}
@ -672,6 +704,11 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.Element("SortingPriority", this->SortingPriority);
}
// Checkable
if (!this->Checkable.empty()) {
xout.Element("Checkable", this->Checkable);
}
xout.EndElement();
xout.EndDocument();
}

View File

@ -114,9 +114,15 @@ public:
/// Determines that the package must always be installed
std::string ForcedInstallation;
/// List of components to replace
std::vector<std::string> Replaces;
/// Package needs to be installed with elevated permissions
std::string RequiresAdminRights;
/// Set to false if you want to hide the checkbox for an item
std::string Checkable;
public:
// Internal implementation