From 62ef2729eeb9dbe636b4e1ae57cfdb6998d251f3 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 26 Oct 2021 22:57:56 +0200 Subject: CPackIFW: add support for archive format and compression level options Adds the following CPackIFW variables: - CPACK_IFW_ARCHIVE_FORMAT - CPACK_IFW_ARCHIVE_COMPRESSION These variables control mirror the --archive-format and --compression options of the QtIFW binarycreator and repogen tools. Fixes: #22803 Co-authored-by: Erlend E. Aasland Co-authored-by: Awen Autret --- Help/cpack_gen/ifw.rst | 40 ++++++++++++++++++++++++++++ Help/release/dev/cpackifw-archive-format.rst | 9 +++++++ Source/CPack/IFW/cmCPackIFWGenerator.cxx | 30 +++++++++++++++++++++ Source/CPack/IFW/cmCPackIFWGenerator.h | 2 ++ 4 files changed, 81 insertions(+) create mode 100644 Help/release/dev/cpackifw-archive-format.rst diff --git a/Help/cpack_gen/ifw.rst b/Help/cpack_gen/ifw.rst index 6b8bc26..8bfcd98 100644 --- a/Help/cpack_gen/ifw.rst +++ b/Help/cpack_gen/ifw.rst @@ -292,6 +292,46 @@ Package This feature is available for QtIFW 4.0.0 and newer. +.. variable:: CPACK_IFW_ARCHIVE_FORMAT + + .. versionadded:: 3.23 + + Set the format used when packaging new component data archives. If you omit + this option, the ``7z`` format will be used as a default. Supported formats: + + * 7z + * zip + * tar.gz + * tar.bz2 + * tar.xz + + .. note:: + + If the Qt Installer Framework tools were built without libarchive support, + only ``7z`` format is supported. + + This feature is available for QtIFW 4.2.0 and newer. + +.. variable:: CPACK_IFW_ARCHIVE_COMPRESSION + + .. versionadded:: 3.23 + + Archive compression level. Defaults to 5 (*Normal compression*). + + * 0 (*No compression*) + * 1 (*Fastest compressing*) + * 3 (*Fast compressing*) + * 5 (*Normal compressing*) + * 7 (*Maximum compressing*) + * 9 (*Ultra compressing*) + + .. note:: + + Some formats do not support all the possible values. For example ``zip`` + compression only supports values from 1 to 7. + + This feature is available for QtIFW 4.2.0 and newer. + Components """""""""" diff --git a/Help/release/dev/cpackifw-archive-format.rst b/Help/release/dev/cpackifw-archive-format.rst new file mode 100644 index 0000000..8884d74 --- /dev/null +++ b/Help/release/dev/cpackifw-archive-format.rst @@ -0,0 +1,9 @@ + +cpackifw-archive-format +----------------------- + +* The :cpack_gen:`CPack IFW Generator` gained the new + :variable:`CPACK_IFW_ARCHIVE_FORMAT` and + :variable:`CPACK_IFW_ARCHIVE_COMPRESSION` variables for setting the format + used when packaging new component data archives, and choosing the compression + level used. These features are available for QtIFW 4.2 and newer. diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 9b33eec..f35d7e9 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -58,6 +58,17 @@ std::vector cmCPackIFWGenerator::BuildRepogenCommand() ifwCmd.emplace_back(this->RepoGen); + if (!this->IsVersionLess("4.2")) { + if (!this->ArchiveFormat.empty()) { + ifwCmd.emplace_back("--archive-format"); + ifwCmd.emplace_back(this->ArchiveFormat); + } + if (!this->ArchiveCompression.empty()) { + ifwCmd.emplace_back("--compression"); + ifwCmd.emplace_back(this->ArchiveCompression); + } + } + if (this->IsVersionLess("2.0.0")) { ifwCmd.emplace_back("-c"); ifwCmd.emplace_back(this->toplevel + "/config/config.xml"); @@ -157,6 +168,17 @@ std::vector cmCPackIFWGenerator::BuildBinaryCreatorCommmand() ifwCmd.emplace_back(this->BinCreator); + if (!this->IsVersionLess("4.2")) { + if (!this->ArchiveFormat.empty()) { + ifwCmd.emplace_back("--archive-format"); + ifwCmd.emplace_back(this->ArchiveFormat); + } + if (!this->ArchiveCompression.empty()) { + ifwCmd.emplace_back("--compression"); + ifwCmd.emplace_back(this->ArchiveCompression); + } + } + ifwCmd.emplace_back("-c"); ifwCmd.emplace_back(this->toplevel + "/config/config.xml"); @@ -354,6 +376,14 @@ int cmCPackIFWGenerator::InitializeInternal() cmExpandList(dirs, this->RepoDirsVector); } + // Archive format and compression level + if (cmValue af = this->GetOption("CPACK_IFW_ARCHIVE_FORMAT")) { + this->ArchiveFormat = *af; + } + if (cmValue ac = this->GetOption("CPACK_IFW_ARCHIVE_COMPRESSION")) { + this->ArchiveCompression = *ac; + } + // Installer this->Installer.Generator = this; this->Installer.ConfigureFromOptions(); diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 902ebaf..b853e18 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -151,6 +151,8 @@ private: std::string FrameworkVersion; std::string ExecutableSuffix; std::string OutputExtension; + std::string ArchiveFormat; + std::string ArchiveCompression; bool OnlineOnly; bool ResolveDuplicateNames; -- cgit v0.12