[Cmake-commits] CMake branch, next, updated. v3.0.0-rc1-1002-ge58ca21

Brad King brad.king at kitware.com
Thu Mar 13 16:35:19 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  e58ca2139b9b6c922bdac72e3c7e0d44e2623d7c (commit)
       via  bc96b6846512395bc427bf2880c8edfea188cb88 (commit)
      from  8adfd132d97ba3e1f956fe4010777e2dee0320f5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e58ca2139b9b6c922bdac72e3c7e0d44e2623d7c
commit e58ca2139b9b6c922bdac72e3c7e0d44e2623d7c
Merge: 8adfd13 bc96b68
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Mar 13 16:35:18 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Mar 13 16:35:18 2014 -0400

    Merge topic 'cpack-deb-compression-types' into next
    
    bc96b684 CPackDeb: Add option to set compression type


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bc96b6846512395bc427bf2880c8edfea188cb88
commit bc96b6846512395bc427bf2880c8edfea188cb88
Author:     Sean D'Epagnier <sean at depagnier.com>
AuthorDate: Mon Mar 10 13:37:26 2014 +0800
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Mar 13 16:32:50 2014 -0400

    CPackDeb: Add option to set compression type
    
    Add a CPACK_DEBIAN_COMPRESSION_TYPE option to set the compression type.
    Default to 'gzip' to preserve existing behavior.  Use "cmake -E tar"
    for 'gzip', 'bzip2', and 'none'.  Use system "tar" for 'lzma' and 'xz'.

diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index c79ef06..b210bbb 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -67,7 +67,12 @@
 #  * Mandatory : YES
 #  * Default   : 'devel'
 #
-#  The debian package section
+# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
+#
+#  * Mandatory : YES
+#  * Default   : 'gzip'
+#
+#     Possible values are: lzma, xz, bzip2 and gzip.
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
 #
@@ -390,6 +395,12 @@ if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
   set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
 endif()
 
+# Compression: (recommended)
+if(NOT CPACK_DEBIAN_COMPRESSION_TYPE)
+  set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
+endif()
+
+
 # Recommends:
 # You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
 
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 27e9d9f..dabc928 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -403,9 +403,35 @@ int cmCPackDebGenerator::createDeb()
   if (NULL != this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE")) {
       cmd += this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
   }
-  cmd += " \"";
-  cmd += cmakeExecutable;
-  cmd += "\" -E tar cfz data.tar.gz ";
+
+  const char* debian_compression_type =
+      this->GetOption("CPACK_DEBIAN_COMPRESSION_TYPE");
+
+  std::string cmake_tar = " ", compression_modifier = "a", compression_suffix;
+  if(!strcmp(debian_compression_type, "lzma")) {
+      compression_suffix = ".lzma";
+  } else if(!strcmp(debian_compression_type, "xz")) {
+      compression_suffix = ".xz";
+  } else if(!strcmp(debian_compression_type, "bzip2")) {
+      compression_suffix = ".bz2";
+      compression_modifier = "j";
+      cmake_tar += "\"" + std::string(cmakeExecutable) + "\" -E ";
+  } else if(!strcmp(debian_compression_type, "gzip")) {
+      compression_suffix = ".gz";
+      compression_modifier = "z";
+      cmake_tar += "\"" + std::string(cmakeExecutable) + "\" -E ";
+  } else if(!strcmp(debian_compression_type, "none")) {
+      compression_suffix = "";
+      compression_modifier = "";
+      cmake_tar += "\"" + std::string(cmakeExecutable) + "\" -E ";
+  } else {
+      cmCPackLogger(cmCPackLog::LOG_ERROR,
+                    "Error unrecognized compression type: "
+                    << debian_compression_type << std::endl);
+  }
+
+  cmd += cmake_tar + "tar c" + compression_modifier + "f data.tar"
+      + compression_suffix;
 
   // now add all directories which have to be compressed
   // collect all top level install dirs for that
@@ -493,9 +519,7 @@ int cmCPackDebGenerator::createDeb()
       {
       cmd = this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
       }
-    cmd += " \"";
-    cmd += cmakeExecutable;
-    cmd += "\" -E tar cfz control.tar.gz ./control ./md5sums";
+    cmd += cmake_tar + "tar czf control.tar.gz ./control ./md5sums";
     const char* controlExtra =
       this->GetOption("CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA");
   if( controlExtra )
@@ -514,7 +538,7 @@ int cmCPackDebGenerator::createDeb()
       if( cmsys::SystemTools::CopyFileIfDifferent(
             i->c_str(), localcopy.c_str()) )
         {
-        // debian is picky and need relative to ./ path in the tar.gz
+        // debian is picky and need relative to ./ path in the tar.*
         cmd += " ./";
         cmd += filenamename;
         }
@@ -538,7 +562,7 @@ int cmCPackDebGenerator::createDeb()
     return 0;
     }
 
-  // ar -r your-package-name.deb debian-binary control.tar.gz data.tar.gz
+  // ar -r your-package-name.deb debian-binary control.tar.* data.tar.*
   // since debian packages require BSD ar (most Linux distros and even
   // FreeBSD and NetBSD ship GNU ar) we use a copy of OpenBSD ar here.
   std::vector<std::string> arFiles;
@@ -546,7 +570,7 @@ int cmCPackDebGenerator::createDeb()
   topLevelString += "/";
   arFiles.push_back(topLevelString + "debian-binary");
   arFiles.push_back(topLevelString + "control.tar.gz");
-  arFiles.push_back(topLevelString + "data.tar.gz");
+  arFiles.push_back(topLevelString + "data.tar" + compression_suffix);
     std::string outputFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
     outputFileName += "/";
     outputFileName += this->GetOption("CPACK_OUTPUT_FILE_NAME");

-----------------------------------------------------------------------

Summary of changes:
 Modules/CPackDeb.cmake               |   13 ++++++++++-
 Source/CPack/cmCPackDebGenerator.cxx |   42 ++++++++++++++++++++++++++--------
 2 files changed, 45 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list