Merge topic 'cpack-ifw-updates'
ed9684a2
CPackIFW: Added support for multiple repositoriesf9f74874
CPackIFW: Search algorithm update
This commit is contained in:
commit
1ed0379f79
|
@ -25,6 +25,8 @@
|
||||||
# and Mac OS X.
|
# and Mac OS X.
|
||||||
#
|
#
|
||||||
# To use CPack ``IFW`` generator you must also install QtIFW_.
|
# To use CPack ``IFW`` generator you must also install QtIFW_.
|
||||||
|
# If you are not using the default path for the installation, please set
|
||||||
|
# the path to the variable ``QTIFWDIR``.
|
||||||
#
|
#
|
||||||
# Variables
|
# Variables
|
||||||
# ^^^^^^^^^
|
# ^^^^^^^^^
|
||||||
|
@ -83,6 +85,19 @@
|
||||||
# The root package name, which will be used if configuration group is not
|
# The root package name, which will be used if configuration group is not
|
||||||
# specified
|
# specified
|
||||||
#
|
#
|
||||||
|
# .. variable:: CPACK_IFW_REPOSITORIES_ALL
|
||||||
|
#
|
||||||
|
# The list of remote repositories.
|
||||||
|
#
|
||||||
|
# The default value of this variable is computed by CPack and contains
|
||||||
|
# all repositories added with command :command:`cpack_ifw_add_repository`
|
||||||
|
#
|
||||||
|
# .. variable:: CPACK_IFW_DOWNLOAD_ALL
|
||||||
|
#
|
||||||
|
# If this is ``ON`` all components will be downloaded.
|
||||||
|
# By default is ``OFF`` or used value
|
||||||
|
# from :variable:`CPACK_DOWNLOAD_ALL` if set
|
||||||
|
#
|
||||||
# Components
|
# Components
|
||||||
# """"""""""
|
# """"""""""
|
||||||
#
|
#
|
||||||
|
@ -95,7 +110,7 @@
|
||||||
# Additional prepared packages dirs that will be used to resolve
|
# Additional prepared packages dirs that will be used to resolve
|
||||||
# dependent components.
|
# dependent components.
|
||||||
#
|
#
|
||||||
# Advanced
|
# Tools
|
||||||
# """"""""
|
# """"""""
|
||||||
#
|
#
|
||||||
# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
|
# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
|
||||||
|
@ -104,20 +119,12 @@
|
||||||
#
|
#
|
||||||
# This variable is cached and can be configured user if need.
|
# This variable is cached and can be configured user if need.
|
||||||
#
|
#
|
||||||
# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND
|
|
||||||
#
|
|
||||||
# True if the "binarycreator" command line client was found.
|
|
||||||
#
|
|
||||||
# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
|
# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
|
||||||
#
|
#
|
||||||
# The path to "repogen" command line client.
|
# The path to "repogen" command line client.
|
||||||
#
|
#
|
||||||
# This variable is cached and can be configured user if need.
|
# This variable is cached and can be configured user if need.
|
||||||
#
|
#
|
||||||
# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE_FOUND
|
|
||||||
#
|
|
||||||
# True if the "repogen" command line client was found.
|
|
||||||
#
|
|
||||||
# Commands
|
# Commands
|
||||||
# ^^^^^^^^^
|
# ^^^^^^^^^
|
||||||
#
|
#
|
||||||
|
@ -191,6 +198,33 @@
|
||||||
# ``LICENSES`` pair of <display_name> and <file_path> of license text for this
|
# ``LICENSES`` pair of <display_name> and <file_path> of license text for this
|
||||||
# component group. You can specify more then one license.
|
# component group. You can specify more then one license.
|
||||||
#
|
#
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# .. command:: cpack_ifw_add_repository
|
||||||
|
#
|
||||||
|
# Add QtIFW_ specific remote repository.
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# cpack_ifw_add_repository(<reponame> [DISABLED]
|
||||||
|
# URL <url>
|
||||||
|
# [USERNAME <username>]
|
||||||
|
# [PASSWORD <password>]
|
||||||
|
# [DISPLAY_NAME <display_name>])
|
||||||
|
#
|
||||||
|
# This macro will also add the <reponame> repository
|
||||||
|
# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`
|
||||||
|
#
|
||||||
|
# ``DISABLED`` if set, then the repository will be disabled by default.
|
||||||
|
#
|
||||||
|
# ``URL`` is points to a list of available components.
|
||||||
|
#
|
||||||
|
# ``USERNAME`` is used as user on a protected repository.
|
||||||
|
#
|
||||||
|
# ``PASSWORD`` is password to use on a protected repository.
|
||||||
|
#
|
||||||
|
# ``DISPLAY_NAME`` is string to display instead of the URL.
|
||||||
|
#
|
||||||
# Example usage
|
# Example usage
|
||||||
# ^^^^^^^^^^^^^
|
# ^^^^^^^^^^^^^
|
||||||
#
|
#
|
||||||
|
@ -198,7 +232,7 @@
|
||||||
#
|
#
|
||||||
# set(CPACK_PACKAGE_NAME "MyPackage")
|
# set(CPACK_PACKAGE_NAME "MyPackage")
|
||||||
# set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyPackage Installation Example")
|
# set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyPackage Installation Example")
|
||||||
# set(CPACK_PACKAGE_VERSION "1.0.0")
|
# set(CPACK_PACKAGE_VERSION "1.0.0") # Version of installer
|
||||||
#
|
#
|
||||||
# include(CPack)
|
# include(CPack)
|
||||||
# include(CPackIFW)
|
# include(CPackIFW)
|
||||||
|
@ -207,8 +241,15 @@
|
||||||
# DISPLAY_NAME "MyApp"
|
# DISPLAY_NAME "MyApp"
|
||||||
# DESCRIPTION "My Application")
|
# DESCRIPTION "My Application")
|
||||||
# cpack_ifw_configure_component(myapp
|
# cpack_ifw_configure_component(myapp
|
||||||
# VERSION "1.2.3"
|
# VERSION "1.2.3" # Version of component
|
||||||
# SCRIPT "operations.qs")
|
# SCRIPT "operations.qs")
|
||||||
|
# cpack_add_component(mybigplugin
|
||||||
|
# DISPLAY_NAME "MyBigPlugin"
|
||||||
|
# DESCRIPTION "My Big Downloadable Plugin"
|
||||||
|
# DOWNLOADED)
|
||||||
|
# cpack_ifw_add_repository(myrepo
|
||||||
|
# URL "http://example.com/ifw/repo/myapp"
|
||||||
|
# DISPLAY_NAME "My Application Repository")
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Online installer
|
# Online installer
|
||||||
|
@ -223,8 +264,11 @@
|
||||||
# Then you would use the command :command:`cpack_configure_downloads`.
|
# Then you would use the command :command:`cpack_configure_downloads`.
|
||||||
# If you set ``ALL`` option all components will be downloaded.
|
# If you set ``ALL`` option all components will be downloaded.
|
||||||
#
|
#
|
||||||
|
# You also can use command :command:`cpack_ifw_add_repository` and
|
||||||
|
# variable :variable:`CPACK_IFW_DOWNLOAD_ALL` for more specific configuration.
|
||||||
|
#
|
||||||
# CPack IFW generator create "repository" dir in current binary dir. You
|
# CPack IFW generator create "repository" dir in current binary dir. You
|
||||||
# would copy content of this dir to specified ``site``.
|
# would copy content of this dir to specified ``site`` (``url``).
|
||||||
#
|
#
|
||||||
# See Also
|
# See Also
|
||||||
# ^^^^^^^^
|
# ^^^^^^^^
|
||||||
|
@ -264,48 +308,41 @@
|
||||||
|
|
||||||
# Default path
|
# Default path
|
||||||
|
|
||||||
|
set(_CPACK_IFW_PATHS
|
||||||
|
"${QTIFWDIR}"
|
||||||
|
"$ENV{QTIFWDIR}"
|
||||||
|
"${QTDIR}"
|
||||||
|
"$ENV{QTIFWDIR}")
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(_CPACK_IFW_PATHS
|
list(APPEND _CPACK_IFW_PATHS
|
||||||
"$ENV{HOMEDRIVE}/Qt"
|
"$ENV{HOMEDRIVE}/Qt"
|
||||||
"C:/Qt"
|
"C:/Qt")
|
||||||
)
|
|
||||||
else()
|
else()
|
||||||
set(_CPACK_IFW_PATHS
|
list(APPEND _CPACK_IFW_PATHS
|
||||||
"$ENV{HOME}/Qt"
|
"$ENV{HOME}/Qt"
|
||||||
"/opt/Qt"
|
"/opt/Qt")
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(_CPACK_IFW_SUFFIXES
|
set(_CPACK_IFW_SUFFIXES
|
||||||
"QtIFW-1.7.0/bin"
|
"bin"
|
||||||
"QtIFW-1.6.0/bin"
|
"QtIFW-1.7.0/bin"
|
||||||
"QtIFW-1.5.0/bin"
|
"QtIFW-1.6.0/bin"
|
||||||
"QtIFW-1.4.0/bin"
|
"QtIFW-1.5.0/bin"
|
||||||
"QtIFW-1.3.0/bin"
|
"QtIFW-1.4.0/bin"
|
||||||
)
|
"QtIFW-1.3.0/bin")
|
||||||
|
|
||||||
# Look for 'binarycreator'
|
# Look for 'binarycreator'
|
||||||
|
|
||||||
if(NOT CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND)
|
|
||||||
|
|
||||||
find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE
|
find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE
|
||||||
NAMES binarycreator
|
NAMES binarycreator
|
||||||
PATHS ${_CPACK_IFW_PATHS}
|
PATHS ${_CPACK_IFW_PATHS}
|
||||||
PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
|
PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
|
||||||
DOC "QtIFW binarycreator command line client"
|
DOC "QtIFW binarycreator command line client")
|
||||||
)
|
|
||||||
mark_as_advanced(CPACK_IFW_BINARYCREATOR_EXECUTABLE)
|
mark_as_advanced(CPACK_IFW_BINARYCREATOR_EXECUTABLE)
|
||||||
|
|
||||||
if(EXISTS ${CPACK_IFW_BINARYCREATOR_EXECUTABLE})
|
|
||||||
set(CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif() # NOT CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND
|
|
||||||
|
|
||||||
# Look for 'repogen'
|
# Look for 'repogen'
|
||||||
|
|
||||||
if(NOT CPACK_IFW_REPOGEN_EXECUTABLE_FOUND)
|
|
||||||
|
|
||||||
find_program(CPACK_IFW_REPOGEN_EXECUTABLE
|
find_program(CPACK_IFW_REPOGEN_EXECUTABLE
|
||||||
NAMES repogen
|
NAMES repogen
|
||||||
PATHS ${_CPACK_IFW_PATHS}
|
PATHS ${_CPACK_IFW_PATHS}
|
||||||
|
@ -314,12 +351,6 @@ find_program(CPACK_IFW_REPOGEN_EXECUTABLE
|
||||||
)
|
)
|
||||||
mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE)
|
mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE)
|
||||||
|
|
||||||
if(EXISTS ${CPACK_IFW_REPOGEN_EXECUTABLE})
|
|
||||||
set(CPACK_IFW_REPOGEN_EXECUTABLE_FOUND 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif() # NOT CPACK_IFW_REPOGEN_EXECUTABLE_FOUND
|
|
||||||
|
|
||||||
#
|
#
|
||||||
## Next code is included only once
|
## Next code is included only once
|
||||||
#
|
#
|
||||||
|
@ -444,4 +475,43 @@ macro(cpack_ifw_configure_component_group grpname)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# Macro for adding repository
|
||||||
|
macro(cpack_ifw_add_repository reponame)
|
||||||
|
|
||||||
|
string(TOUPPER ${reponame} _CPACK_IFWREPO_UNAME)
|
||||||
|
|
||||||
|
set(_IFW_OPT DISABLED)
|
||||||
|
set(_IFW_ARGS URL USERNAME PASSWORD DISPLAY_NAME)
|
||||||
|
set(_IFW_MULTI_ARGS)
|
||||||
|
cmake_parse_arguments(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
|
||||||
|
|
||||||
|
set(_CPACK_IFWREPO_STR "\n# Configuration for IFW repository \"${reponame}\"\n")
|
||||||
|
|
||||||
|
foreach(_IFW_ARG_NAME ${_IFW_OPT})
|
||||||
|
cpack_append_option_set_command(
|
||||||
|
CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
|
||||||
|
_CPACK_IFWREPO_STR)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(_IFW_ARG_NAME ${_IFW_ARGS})
|
||||||
|
cpack_append_string_variable_set_command(
|
||||||
|
CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
|
||||||
|
_CPACK_IFWREPO_STR)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
|
||||||
|
cpack_append_variable_set_command(
|
||||||
|
CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
|
||||||
|
_CPACK_IFWREPO_STR)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
|
||||||
|
set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
|
||||||
|
|
||||||
|
if(CPack_CMake_INCLUDED)
|
||||||
|
file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endmacro()
|
||||||
|
|
||||||
endif() # NOT CPackIFW_CMake_INCLUDED
|
endif() # NOT CPackIFW_CMake_INCLUDED
|
||||||
|
|
|
@ -56,7 +56,7 @@ int cmCPackIFWGenerator::PackageFiles()
|
||||||
ifwTmpFile += "/IFWOutput.log";
|
ifwTmpFile += "/IFWOutput.log";
|
||||||
|
|
||||||
// Run repogen
|
// Run repogen
|
||||||
if (!DownloadSite.empty())
|
if (!Installer.Repositories.empty())
|
||||||
{
|
{
|
||||||
std::string ifwCmd = RepoGen;
|
std::string ifwCmd = RepoGen;
|
||||||
ifwCmd += " -c " + this->toplevel + "/config/config.xml";
|
ifwCmd += " -c " + this->toplevel + "/config/config.xml";
|
||||||
|
@ -128,7 +128,7 @@ int cmCPackIFWGenerator::PackageFiles()
|
||||||
{
|
{
|
||||||
ifwCmd += " --online-only";
|
ifwCmd += " --online-only";
|
||||||
}
|
}
|
||||||
else if (!DownloadedPackages.empty() && !DownloadSite.empty())
|
else if (!DownloadedPackages.empty() && !Installer.Repositories.empty())
|
||||||
{
|
{
|
||||||
ifwCmd += " -e ";
|
ifwCmd += " -e ";
|
||||||
std::set<cmCPackIFWPackage*>::iterator it
|
std::set<cmCPackIFWPackage*>::iterator it
|
||||||
|
@ -223,23 +223,25 @@ int cmCPackIFWGenerator::InitializeInternal()
|
||||||
{
|
{
|
||||||
// Search Qt Installer Framework tools
|
// Search Qt Installer Framework tools
|
||||||
|
|
||||||
if(!this->IsOn("CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND") ||
|
const std::string BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE";
|
||||||
!this->IsOn("CPACK_IFW_REPOGEN_EXECUTABLE_FOUND"))
|
const std::string RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE";
|
||||||
|
|
||||||
|
if(!this->IsSet(BinCreatorOpt) ||
|
||||||
|
!this->IsSet(RepoGenOpt))
|
||||||
{
|
{
|
||||||
this->ReadListFile("CPackIFW.cmake");
|
this->ReadListFile("CPackIFW.cmake");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look 'binarycreator' executable (needs)
|
// Look 'binarycreator' executable (needs)
|
||||||
|
|
||||||
if(this->IsOn("CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND"))
|
const char *BinCreatorStr = this->GetOption(BinCreatorOpt);
|
||||||
|
if(!BinCreatorStr || cmSystemTools::IsNOTFOUND(BinCreatorStr))
|
||||||
{
|
{
|
||||||
const char *ifwBinCreatorStr =
|
BinCreator = "";
|
||||||
this->GetOption("CPACK_IFW_BINARYCREATOR_EXECUTABLE");
|
|
||||||
BinCreator = ifwBinCreatorStr ? ifwBinCreatorStr : "";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BinCreator = "";
|
BinCreator = BinCreatorStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BinCreator.empty())
|
if (BinCreator.empty())
|
||||||
|
@ -253,15 +255,14 @@ int cmCPackIFWGenerator::InitializeInternal()
|
||||||
|
|
||||||
// Look 'repogen' executable (optional)
|
// Look 'repogen' executable (optional)
|
||||||
|
|
||||||
if(this->IsOn("CPACK_IFW_REPOGEN_EXECUTABLE_FOUND"))
|
const char *RepoGenStr = this->GetOption(RepoGenOpt);
|
||||||
|
if(!RepoGenStr || cmSystemTools::IsNOTFOUND(RepoGenStr))
|
||||||
{
|
{
|
||||||
const char *ifwRepoGenStr =
|
RepoGen = "";
|
||||||
this->GetOption("CPACK_IFW_REPOGEN_EXECUTABLE");
|
|
||||||
RepoGen = ifwRepoGenStr ? ifwRepoGenStr : "";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RepoGen = "";
|
RepoGen = RepoGenStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables that Change Behavior
|
// Variables that Change Behavior
|
||||||
|
@ -277,16 +278,26 @@ int cmCPackIFWGenerator::InitializeInternal()
|
||||||
PkgsDirsVector);
|
PkgsDirsVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remote repository
|
// Installer
|
||||||
|
Installer.Generator = this;
|
||||||
|
Installer.ConfigureFromOptions();
|
||||||
|
|
||||||
if (const char *site = this->GetOption("CPACK_DOWNLOAD_SITE"))
|
if (const char* ifwDownloadAll =
|
||||||
|
this->GetOption("CPACK_IFW_DOWNLOAD_ALL"))
|
||||||
{
|
{
|
||||||
DownloadSite = site;
|
OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll);
|
||||||
|
}
|
||||||
|
else if (const char* cpackDownloadAll =
|
||||||
|
this->GetOption("CPACK_DOWNLOAD_ALL"))
|
||||||
|
{
|
||||||
|
OnlineOnly = cmSystemTools::IsOn(cpackDownloadAll);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OnlineOnly = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
OnlineOnly = this->IsOn("CPACK_DOWNLOAD_ALL") ? true : false;
|
if (!Installer.Repositories.empty() && RepoGen.empty()) {
|
||||||
|
|
||||||
if (!DownloadSite.empty() && RepoGen.empty()) {
|
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||||
"Cannot find QtIFW repository generator \"repogen\": "
|
"Cannot find QtIFW repository generator \"repogen\": "
|
||||||
"likely it is not installed, or not in your PATH"
|
"likely it is not installed, or not in your PATH"
|
||||||
|
@ -294,10 +305,6 @@ int cmCPackIFWGenerator::InitializeInternal()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Installer
|
|
||||||
Installer.Generator = this;
|
|
||||||
Installer.ConfigureFromOptions();
|
|
||||||
|
|
||||||
return this->Superclass::InitializeInternal();
|
return this->Superclass::InitializeInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,6 @@ private:
|
||||||
std::string RepoGen;
|
std::string RepoGen;
|
||||||
std::string BinCreator;
|
std::string BinCreator;
|
||||||
|
|
||||||
std::string DownloadSite;
|
|
||||||
|
|
||||||
bool OnlineOnly;
|
bool OnlineOnly;
|
||||||
bool ResolveDuplicateNames;
|
bool ResolveDuplicateNames;
|
||||||
std::vector<std::string> PkgsDirsVector;
|
std::vector<std::string> PkgsDirsVector;
|
||||||
|
|
|
@ -44,6 +44,12 @@ const char *cmCPackIFWInstaller::GetOption(const std::string &op) const
|
||||||
return Generator ? Generator->GetOption(op) : 0;
|
return Generator ? Generator->GetOption(op) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmCPackIFWInstaller::IsOn(const std::string &op) const
|
||||||
|
{
|
||||||
|
return Generator ? Generator->IsOn(op) : false;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmCPackIFWInstaller::ConfigureFromOptions()
|
void cmCPackIFWInstaller::ConfigureFromOptions()
|
||||||
{
|
{
|
||||||
|
@ -167,6 +173,78 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
|
||||||
{
|
{
|
||||||
AdminTargetDir = option;
|
AdminTargetDir = option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Repositories
|
||||||
|
Repositories.clear();
|
||||||
|
RepositoryStruct Repo;
|
||||||
|
if (const char *site = this->GetOption("CPACK_DOWNLOAD_SITE"))
|
||||||
|
{
|
||||||
|
Repo.Url = site;
|
||||||
|
Repositories.push_back(Repo);
|
||||||
|
}
|
||||||
|
if(const char *RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL"))
|
||||||
|
{
|
||||||
|
std::vector<std::string> RepoAllVector;
|
||||||
|
cmSystemTools::ExpandListArgument(RepoAllStr,
|
||||||
|
RepoAllVector);
|
||||||
|
for(std::vector<std::string>::iterator
|
||||||
|
rit = RepoAllVector.begin(); rit != RepoAllVector.end(); ++rit)
|
||||||
|
{
|
||||||
|
std::string prefix = "CPACK_IFW_REPOSITORY_"
|
||||||
|
+ cmsys::SystemTools::UpperCase(*rit)
|
||||||
|
+ "_";
|
||||||
|
// Url
|
||||||
|
if (const char* url = GetOption(prefix + "URL"))
|
||||||
|
{
|
||||||
|
Repo.Url = url;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Repo.Url = "";
|
||||||
|
}
|
||||||
|
// Enabled
|
||||||
|
if (IsOn(prefix + "DISABLED"))
|
||||||
|
{
|
||||||
|
Repo.Enabled = "0";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Repo.Enabled = "";
|
||||||
|
}
|
||||||
|
// Username
|
||||||
|
if (const char* username = GetOption(prefix + "USERNAME"))
|
||||||
|
{
|
||||||
|
Repo.Username = username;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Repo.Username = "";
|
||||||
|
}
|
||||||
|
// Password
|
||||||
|
if (const char* password = GetOption(prefix + "PASSWORD"))
|
||||||
|
{
|
||||||
|
Repo.Password = password;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Repo.Password = "";
|
||||||
|
}
|
||||||
|
// DisplayName
|
||||||
|
if (const char* displayName = GetOption(prefix + "DISPLAY_NAME"))
|
||||||
|
{
|
||||||
|
Repo.DisplayName = displayName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Repo.DisplayName = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!Repo.Url.empty())
|
||||||
|
{
|
||||||
|
Repositories.push_back(Repo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -246,19 +324,43 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
|
||||||
<< "</AdminTargetDir>" << std::endl;
|
<< "</AdminTargetDir>" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Site
|
// Remote repositories
|
||||||
if (!Generator->DownloadSite.empty())
|
if (!Repositories.empty())
|
||||||
{
|
{
|
||||||
xout << " <RemoteRepositories>" << std::endl;
|
xout << " <RemoteRepositories>" << std::endl;
|
||||||
xout << " <Repository>" << std::endl;
|
for(std::vector<RepositoryStruct>::iterator
|
||||||
xout << " <Url>" << Generator->DownloadSite
|
rit = Repositories.begin(); rit != Repositories.end(); ++rit)
|
||||||
<< "</Url>" << std::endl;
|
{
|
||||||
// These properties can not be set from "cpack_configure_downloads"
|
xout << " <Repository>" << std::endl;
|
||||||
// <Enabled>1</Enabled>
|
// Url
|
||||||
// <Username>user</Username>
|
xout << " <Url>" << rit->Url
|
||||||
// <Password>password</Password>
|
<< "</Url>" << std::endl;
|
||||||
// <DisplayName>Example repository</DisplayName>
|
// Enabled
|
||||||
xout << " </Repository>" << std::endl;
|
if(!rit->Enabled.empty())
|
||||||
|
{
|
||||||
|
xout << " <Enabled>" << rit->Enabled
|
||||||
|
<< "</Enabled>" << std::endl;
|
||||||
|
}
|
||||||
|
// Username
|
||||||
|
if(!rit->Username.empty())
|
||||||
|
{
|
||||||
|
xout << " <Username>" << rit->Username
|
||||||
|
<< "</Username>" << std::endl;
|
||||||
|
}
|
||||||
|
// Password
|
||||||
|
if(!rit->Password.empty())
|
||||||
|
{
|
||||||
|
xout << " <Password>" << rit->Password
|
||||||
|
<< "</Password>" << std::endl;
|
||||||
|
}
|
||||||
|
// DisplayName
|
||||||
|
if(!rit->DisplayName.empty())
|
||||||
|
{
|
||||||
|
xout << " <DisplayName>" << rit->DisplayName
|
||||||
|
<< "</DisplayName>" << std::endl;
|
||||||
|
}
|
||||||
|
xout << " </Repository>" << std::endl;
|
||||||
|
}
|
||||||
xout << " </RemoteRepositories>" << std::endl;
|
xout << " </RemoteRepositories>" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,15 @@ public: // Types
|
||||||
|
|
||||||
typedef std::map<std::string, cmCPackIFWPackage*> PackagesMap;
|
typedef std::map<std::string, cmCPackIFWPackage*> PackagesMap;
|
||||||
|
|
||||||
|
struct RepositoryStruct
|
||||||
|
{
|
||||||
|
std::string Url;
|
||||||
|
std::string Enabled;
|
||||||
|
std::string Username;
|
||||||
|
std::string Password;
|
||||||
|
std::string DisplayName;
|
||||||
|
};
|
||||||
|
|
||||||
public: // Constructor
|
public: // Constructor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,6 +78,7 @@ public: // Configuration
|
||||||
public: // Internal implementation
|
public: // Internal implementation
|
||||||
|
|
||||||
const char* GetOption(const std::string& op) const;
|
const char* GetOption(const std::string& op) const;
|
||||||
|
bool IsOn(const std::string& op) const;
|
||||||
|
|
||||||
void ConfigureFromOptions();
|
void ConfigureFromOptions();
|
||||||
|
|
||||||
|
@ -78,6 +88,7 @@ public: // Internal implementation
|
||||||
|
|
||||||
cmCPackIFWGenerator* Generator;
|
cmCPackIFWGenerator* Generator;
|
||||||
PackagesMap Packages;
|
PackagesMap Packages;
|
||||||
|
std::vector<RepositoryStruct> Repositories;
|
||||||
std::string Directory;
|
std::string Directory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue