summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/dev/cpack-ifw-options.rst18
-rw-r--r--Modules/CPackIFW.cmake85
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx172
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h11
4 files changed, 247 insertions, 39 deletions
diff --git a/Help/release/dev/cpack-ifw-options.rst b/Help/release/dev/cpack-ifw-options.rst
index cbe0f63..9838fd4 100644
--- a/Help/release/dev/cpack-ifw-options.rst
+++ b/Help/release/dev/cpack-ifw-options.rst
@@ -3,5 +3,19 @@ cpack-ifw-options
* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and
:command:`cpack_ifw_configure_component_group` commands gained a new
- ``DEFAULT``, ``VIRTUAL``, ``FORCED_INSTALLATION``, ``DISPLAY_NAME``,
- ``DESCRIPTION`` and ``RELEASE_DATE`` options to more specific configuration.
+ ``DEFAULT``, ``VIRTUAL``, ``FORCED_INSTALLATION``, ``REQUIRES_ADMIN_RIGHTS``,
+ ``DISPLAY_NAME``, ``UPDATE_TEXT``, ``DESCRIPTION``, ``RELEASE_DATE``,
+ ``AUTO_DEPEND_ON`` and ``TRANSLATIONS`` options to more specific
+ configuration.
+
+* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component`
+ command gained a new ``DEPENDENCIES`` alias for ``DEPENDS`` option.
+
+* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component_group`
+ command gained a new ``DEPENDS`` option. The ``DEPENDENCIES`` alias also
+ added.
+
+* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and
+ :command:`cpack_ifw_configure_component_group` commands ``PRIORITY``
+ option now is deprecated and will be removed in a future version of CMake.
+ Please use new ``SORTING_PRIORITY`` option instead.
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index ae595fb..deb724c 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -227,18 +227,21 @@
# ::
#
# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] [VIRTUAL]
-# [FORCED_INSTALLATION]
+# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
# [NAME <name>]
# [DISPLAY_NAME <display_name>]
# [DESCRIPTION <description>]
+# [UPDATE_TEXT <update_text>]
# [VERSION <version>]
# [RELEASE_DATE <release_date>]
# [SCRIPT <script>]
-# [PRIORITY <priority>]
-# [DEPENDS <com_id> ...]
+# [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated
+# [DEPENDS|DEPENDENCIES <com_id> ...]
+# [AUTO_DEPEND_ON <comp_id> ...]
# [LICENSES <display_name> <file_path> ...]
# [DEFAULT <value>]
-# [USER_INTERFACES <file_path> <file_path> ...])
+# [USER_INTERFACES <file_path> <file_path> ...]
+# [TRANSLATIONS <file_path> <file_path> ...])
#
# This command should be called after :command:`cpack_add_component` command.
#
@@ -260,6 +263,9 @@
# It is a equivalent of the ``REQUARED`` option from the
# :command:`cpack_add_component` command.
#
+# ``REQUIRES_ADMIN_RIGHTS``
+# set it if the component needs to be installed with elevated permissions.
+#
# ``NAME``
# is used to create domain-like identification for this component.
# By default used origin component name.
@@ -272,6 +278,10 @@
# set to rewrite original description configured by
# :command:`cpack_add_component` command.
#
+# ``UPDATE_TEXT``
+# will be added to the component description if this is an update to
+# the component.
+#
# ``VERSION``
# is version of component.
# By default used :variable:`CPACK_PACKAGE_VERSION`.
@@ -283,11 +293,18 @@
# is a relative or absolute path to operations script
# for this component.
#
-# ``PRIORITY``
+# ``PRIORITY`` | ``SORTING_PRIORITY``
# is priority of the component in the tree.
+# The ``PRIORITY`` option is deprecated and will be removed in a future
+# version of CMake. Please use ``SORTING_PRIORITY`` option instead.
+#
+# ``DEPENDS`` | ``DEPENDENCIES``
+# list of dependency component or component group identifiers in
+# QtIFW_ style.
#
-# ``DEPENDS``
-# list of dependency component identifiers in QtIFW_ style.
+# ``AUTO_DEPEND_ON``
+# list of identifiers of component or component group in QtIFW_ style
+# that this component has an automatic dependency on.
#
# ``LICENSES``
# pair of <display_name> and <file_path> of license text for this
@@ -300,7 +317,10 @@
# as a value of the ``SCRIPT`` option).
#
# ``USER_INTERFACES``
-# a list of <file_path> representing pages to load
+# is a list of <file_path> ('.ui' files) representing pages to load.
+#
+# ``TRANSLATIONS``
+# is a list of <file_path> ('.qm' files) representing translations to load.
#
#
# .. command:: cpack_ifw_configure_component_group
@@ -310,17 +330,21 @@
# ::
#
# cpack_ifw_configure_component_group(<groupname> [VIRTUAL]
-# [FORCED_INSTALLATION]
+# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
# [NAME <name>]
# [DISPLAY_NAME <display_name>]
# [DESCRIPTION <description>]
+# [UPDATE_TEXT <update_text>]
# [VERSION <version>]
# [RELEASE_DATE <release_date>]
# [SCRIPT <script>]
-# [PRIORITY <priority>]
+# [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated
+# [DEPENDS|DEPENDENCIES <com_id> ...]
+# [AUTO_DEPEND_ON <comp_id> ...]
# [LICENSES <display_name> <file_path> ...]
# [DEFAULT <value>]
-# [USER_INTERFACES <file_path> <file_path> ...])
+# [USER_INTERFACES <file_path> <file_path> ...]
+# [TRANSLATIONS <file_path> <file_path> ...])
#
# This command should be called after :command:`cpack_add_component_group`
# command.
@@ -332,6 +356,10 @@
# ``FORCED_INSTALLATION``
# if set, then the group must always be installed.
#
+# ``REQUIRES_ADMIN_RIGHTS``
+# set it if the component group needs to be installed with elevated
+# permissions.
+#
# ``NAME``
# is used to create domain-like identification for this component group.
# By default used origin component group name.
@@ -344,6 +372,10 @@
# set to rewrite original description configured by
# :command:`cpack_add_component_group` command.
#
+# ``UPDATE_TEXT``
+# will be added to the component group description if this is an update to
+# the component group.
+#
# ``VERSION``
# is version of component group.
# By default used :variable:`CPACK_PACKAGE_VERSION`.
@@ -355,8 +387,18 @@
# is a relative or absolute path to operations script
# for this component group.
#
-# ``PRIORITY``
+# ``PRIORITY`` | ``SORTING_PRIORITY``
# is priority of the component group in the tree.
+# The ``PRIORITY`` option is deprecated and will be removed in a future
+# version of CMake. Please use ``SORTING_PRIORITY`` option instead.
+#
+# ``DEPENDS`` | ``DEPENDENCIES``
+# list of dependency component or component group identifiers in
+# QtIFW_ style.
+#
+# ``AUTO_DEPEND_ON``
+# list of identifiers of component or component group in QtIFW_ style
+# that this component group has an automatic dependency on.
#
# ``LICENSES``
# pair of <display_name> and <file_path> of license text for this
@@ -370,7 +412,10 @@
# the script as a value of the ``SCRIPT`` option).
#
# ``USER_INTERFACES``
-# a list of <file_path> representing pages to load
+# is a list of <file_path> ('.ui' files) representing pages to load.
+#
+# ``TRANSLATIONS``
+# is a list of <file_path> ('.qm' files) representing translations to load.
#
#
# .. command:: cpack_ifw_add_repository
@@ -711,14 +756,15 @@ macro(cpack_ifw_configure_component compname)
string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME)
- set(_IFW_OPT COMMON ESSENTIAL VIRTUAL FORCED_INSTALLATION)
- set(_IFW_ARGS NAME DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY DEFAULT)
- set(_IFW_MULTI_ARGS DEPENDS LICENSES USER_INTERFACES)
+ set(_IFW_OPT COMMON ESSENTIAL VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS)
+ set(_IFW_ARGS NAME DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT)
+ set(_IFW_MULTI_ARGS DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS)
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)
_cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES)
_cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_USER_INTERFACES)
+ _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_TRANSLATIONS)
set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n")
@@ -751,14 +797,15 @@ macro(cpack_ifw_configure_component_group grpname)
string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME)
- set(_IFW_OPT VIRTUAL FORCED_INSTALLATION)
- set(_IFW_ARGS NAME DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY DEFAULT)
- set(_IFW_MULTI_ARGS LICENSES USER_INTERFACES)
+ set(_IFW_OPT VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS)
+ set(_IFW_ARGS NAME DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT)
+ set(_IFW_MULTI_ARGS DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS)
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)
_cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES)
_cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_USER_INTERFACES)
+ _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_TRANSLATIONS)
set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index c868a14..e23b1b9 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -62,6 +62,13 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct(
} else if ((pos = dependence.find('>')) != std::string::npos) {
Compare.Type = CompareGreater;
Compare.Value = dependence.substr(pos + 1);
+ } else if ((pos = dependence.find('-')) != std::string::npos) {
+ Compare.Type = CompareNone;
+ Compare.Value = dependence.substr(pos + 1);
+ }
+ size_t dashPos = dependence.find('-');
+ if (dashPos != std::string::npos) {
+ pos = dashPos;
}
Name = pos == std::string::npos ? dependence : dependence.substr(0, pos);
}
@@ -74,6 +81,10 @@ std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const
std::string result = Name;
+ if (Compare.Type != CompareNone || !Compare.Value.empty()) {
+ result += "-";
+ }
+
if (Compare.Type == CompareLessOrEqual) {
result += "<=";
} else if (Compare.Type == CompareGreaterOrEqual) {
@@ -154,11 +165,14 @@ void cmCPackIFWPackage::DefaultConfiguration()
Script = "";
Licenses.clear();
UserInterfaces.clear();
+ Translations.clear();
SortingPriority = "";
+ UpdateText = "";
Default = "";
Essential = "";
Virtual = "";
ForcedInstallation = "";
+ RequiresAdminRights = "";
}
// Defaul configuration (all in one package)
@@ -245,24 +259,6 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
}
}
- // QtIFW dependencies
- if (const char* option = this->GetOption(prefix + "DEPENDS")) {
- std::vector<std::string> deps;
- cmSystemTools::ExpandListArgument(option, deps);
- for (std::vector<std::string>::iterator dit = deps.begin();
- dit != deps.end(); ++dit) {
- DependenceStruct dep(*dit);
- if (!Generator->Packages.count(dep.Name)) {
- bool hasDep = Generator->DependentPackages.count(dep.Name) > 0;
- DependenceStruct& depRef = Generator->DependentPackages[dep.Name];
- if (!hasDep) {
- depRef = dep;
- }
- AlienDependencies.insert(&depRef);
- }
- }
- }
-
// Licenses
if (const char* option = this->GetOption(prefix + "LICENSES")) {
Licenses.clear();
@@ -280,6 +276,11 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
// Priority
if (const char* option = this->GetOption(prefix + "PRIORITY")) {
SortingPriority = option;
+ cmCPackLogger(
+ cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set "
+ << "for component \"" << component->Name << "\", but there option is "
+ << "deprecated. Please use \"SORTING_PRIORITY\" option instead."
+ << std::endl);
}
// Default
@@ -352,6 +353,12 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
// Priority
if (const char* option = this->GetOption(prefix + "PRIORITY")) {
SortingPriority = option;
+ cmCPackLogger(
+ cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set "
+ << "for component group \"" << group->Name
+ << "\", but there option is "
+ << "deprecated. Please use \"SORTING_PRIORITY\" option instead."
+ << std::endl);
}
return ConfigureFromPrefix(prefix);
@@ -420,6 +427,79 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
ReleaseDate = value;
}
+ // Sorting priority
+ option = prefix + "SORTING_PRIORITY";
+ if (IsSetToEmpty(option)) {
+ SortingPriority.clear();
+ } else if (const char* value = GetOption(option)) {
+ SortingPriority = value;
+ }
+
+ // Update text
+ option = prefix + "UPDATE_TEXT";
+ if (IsSetToEmpty(option)) {
+ UpdateText.clear();
+ } else if (const char* value = GetOption(option)) {
+ UpdateText = value;
+ }
+
+ // Translations
+ option = prefix + "TRANSLATIONS";
+ if (IsSetToEmpty(option)) {
+ Translations.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ Translations.clear();
+ cmSystemTools::ExpandListArgument(value, Translations);
+ }
+
+ // QtIFW dependencies
+ std::vector<std::string> deps;
+ option = prefix + "DEPENDS";
+ if (const char* value = this->GetOption(option)) {
+ cmSystemTools::ExpandListArgument(value, deps);
+ }
+ option = prefix + "DEPENDENCIES";
+ if (const char* value = this->GetOption(option)) {
+ cmSystemTools::ExpandListArgument(value, deps);
+ }
+ for (std::vector<std::string>::iterator dit = deps.begin();
+ dit != deps.end(); ++dit) {
+ DependenceStruct dep(*dit);
+ if (Generator->Packages.count(dep.Name)) {
+ cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name];
+ dep.Name = depPkg.Name;
+ }
+ bool hasDep = Generator->DependentPackages.count(dep.Name) > 0;
+ DependenceStruct& depRef = Generator->DependentPackages[dep.Name];
+ if (!hasDep) {
+ depRef = dep;
+ }
+ AlienDependencies.insert(&depRef);
+ }
+
+ // Automatic dependency on
+ option = prefix + "AUTO_DEPEND_ON";
+ if (IsSetToEmpty(option)) {
+ AlienAutoDependOn.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ std::vector<std::string> depsOn;
+ cmSystemTools::ExpandListArgument(value, depsOn);
+ for (std::vector<std::string>::iterator dit = depsOn.begin();
+ dit != depsOn.end(); ++dit) {
+ DependenceStruct dep(*dit);
+ if (Generator->Packages.count(dep.Name)) {
+ cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name];
+ dep.Name = depPkg.Name;
+ }
+ bool hasDep = Generator->DependentPackages.count(dep.Name) > 0;
+ DependenceStruct& depRef = Generator->DependentPackages[dep.Name];
+ if (!hasDep) {
+ depRef = dep;
+ }
+ AlienAutoDependOn.insert(&depRef);
+ }
+ }
+
// Visibility
option = prefix + "VIRTUAL";
if (IsSetToEmpty(option)) {
@@ -455,6 +535,16 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
ForcedInstallation = "false";
}
+ // Requires admin rights
+ option = prefix + "REQUIRES_ADMIN_RIGHTS";
+ if (IsSetToEmpty(option)) {
+ RequiresAdminRights.clear();
+ } else if (IsOn(option)) {
+ RequiresAdminRights = "true";
+ } else if (IsSetToOff(option)) {
+ RequiresAdminRights = "false";
+ }
+
return 1;
}
@@ -481,6 +571,12 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.Element("DisplayName", DisplayName);
xout.Element("Description", Description);
+
+ // Update text
+ if (!UpdateText.empty()) {
+ xout.Element("UpdateText", UpdateText);
+ }
+
xout.Element("Name", Name);
xout.Element("Version", Version);
@@ -515,6 +611,23 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.EndElement();
}
+ // Translations (copy to meta dir)
+ std::vector<std::string> translations = Translations;
+ for (size_t i = 0; i < translations.size(); i++) {
+ std::string name = cmSystemTools::GetFilenameName(translations[i]);
+ std::string path = Directory + "/meta/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(translations[i].data(),
+ path.data());
+ translations[i] = name;
+ }
+ if (!translations.empty()) {
+ xout.StartElement("Translations");
+ for (size_t i = 0; i < translations.size(); i++) {
+ xout.Element("Translation", translations[i]);
+ }
+ xout.EndElement();
+ }
+
// Dependencies
std::set<DependenceStruct> compDepSet;
for (std::set<DependenceStruct*>::iterator ait = AlienDependencies.begin();
@@ -538,6 +651,25 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.Element("Dependencies", dependencies.str());
}
+ // Automatic dependency on
+ std::set<DependenceStruct> compAutoDepSet;
+ for (std::set<DependenceStruct*>::iterator ait = AlienAutoDependOn.begin();
+ ait != AlienAutoDependOn.end(); ++ait) {
+ compAutoDepSet.insert(*(*ait));
+ }
+ // Write automatic dependency on
+ if (!compAutoDepSet.empty()) {
+ std::ostringstream dependencies;
+ std::set<DependenceStruct>::iterator it = compAutoDepSet.begin();
+ dependencies << it->NameWithCompare();
+ ++it;
+ while (it != compAutoDepSet.end()) {
+ dependencies << "," << it->NameWithCompare();
+ ++it;
+ }
+ xout.Element("AutoDependOn", dependencies.str());
+ }
+
// Licenses (copy to meta dir)
std::vector<std::string> licenses = Licenses;
for (size_t i = 1; i < licenses.size(); i += 2) {
@@ -561,6 +693,10 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.Element("ForcedInstallation", ForcedInstallation);
}
+ if (!RequiresAdminRights.empty()) {
+ xout.Element("RequiresAdminRights", RequiresAdminRights);
+ }
+
if (!Virtual.empty()) {
xout.Element("Virtual", Virtual);
} else if (!Default.empty()) {
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index 76ed540..bd1d6c5 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -92,9 +92,15 @@ public:
/// List of pages to load
std::vector<std::string> UserInterfaces;
+ /// List of translation files to load
+ std::vector<std::string> Translations;
+
/// Priority of the component in the tree
std::string SortingPriority;
+ /// Description added to the component description
+ std::string UpdateText;
+
/// Set to true to preselect the component in the installer
std::string Default;
@@ -107,6 +113,9 @@ public:
/// Determines that the package must always be installed
std::string ForcedInstallation;
+ /// Package needs to be installed with elevated permissions
+ std::string RequiresAdminRights;
+
public:
// Internal implementation
@@ -139,6 +148,8 @@ public:
std::set<cmCPackIFWPackage*> Dependencies;
// Collection of unresolved dependencies
std::set<DependenceStruct*> AlienDependencies;
+ // Collection of unresolved automatic dependency on
+ std::set<DependenceStruct*> AlienAutoDependOn;
// Patch to package directory
std::string Directory;