Le 23/10/15 17:04, Brad King a écrit :
On 10/23/2015 06:04 AM, Raffi Enficiaud wrote:
Fix attached! (based on current master a03c13a)

Thanks.  I backported it to 'release' and applied:

  CPackDEB: Use proper compression scheme for control.tar.gz
  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=66178ae5

PS.: I will add the test later today

Great.  We can add that when ready.

Sorry for the delay.

Please find attached a test that fires the bug (failure with dpkg-deb). It is based your previous commit, 66178ae.

Thanks,
Raffi
>From 4c7f916f7eb6088f4b07864584dae69c0976e5cf Mon Sep 17 00:00:00 2001
From: Raffi Enficiaud <raffi.enfici...@mines-paris.org>
Date: Tue, 3 Nov 2015 01:44:30 +0100
Subject: [PATCH] CPackDeb: adding tests to the compression scheme leak

---
 Tests/CMakeLists.txt                               |  3 +-
 .../MyLibCPackConfig-compression.cmake.in          | 11 +++++
 .../RunCPackVerifyResult-compression.cmake         | 55 ++++++++++++++++++++++
 .../CPackComponentsDEB/RunCPackVerifyResult.cmake  |  7 ++-
 4 files changed, 73 insertions(+), 3 deletions(-)
 create mode 100644 
Tests/CPackComponentsDEB/MyLibCPackConfig-compression.cmake.in
 create mode 100644 
Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake

diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 2c6a42c..d223f99 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1034,7 +1034,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P 
${CMake_SOURCE_DIR}/Utilities/Release
                                      "components-description2"
                                      "components-shlibdeps1"
                                      "components-depend1"
-                                     "components-depend2")
+                                     "components-depend2"
+                                     "compression")
       set(CPackGen "DEB")
       set(CPackRun_CPackGen "-DCPackGen=${CPackGen}")
 
diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-compression.cmake.in 
b/Tests/CPackComponentsDEB/MyLibCPackConfig-compression.cmake.in
new file mode 100644
index 0000000..ff18834
--- /dev/null
+++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-compression.cmake.in
@@ -0,0 +1,11 @@
+#
+# Test that setting the compression produces valid
+# packages (compression does not leak to the DEBIAN/ files that use gzip)
+#
+
+if(CPACK_GENERATOR MATCHES "DEB")
+   set(CPACK_DEB_COMPONENT_INSTALL "OFF")
+endif()
+
+set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE)
+set(CPACK_DEBIAN_COMPRESSION_TYPE xz)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake 
b/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake
new file mode 100644
index 0000000..dbd4b2b
--- /dev/null
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake
@@ -0,0 +1,55 @@
+if(NOT CPackComponentsDEB_SOURCE_DIR)
+  message(FATAL_ERROR "CPackComponentsDEB_SOURCE_DIR not set")
+endif()
+
+include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
+
+# TODO: currently debian doens't produce lower cased names
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/MyLib-*.deb")
+set(expected_count 1)
+
+
+set(actual_output)
+run_cpack(actual_output
+          CPack_output
+          CPack_error
+          EXPECTED_FILE_MASK "${expected_file_mask}"
+          CONFIG_ARGS "${config_args}"
+          CONFIG_VERBOSE "${config_verbose}")
+
+if(NOT actual_output)
+  message(STATUS "expected_count='${expected_count}'")
+  message(STATUS "expected_file_mask='${expected_file_mask}'")
+  message(STATUS "actual_output_files='${actual_output}'")
+  message(FATAL_ERROR "error: expected_files do not exist: CPackComponentsDEB 
test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}")
+endif()
+
+list(LENGTH actual_output actual_count)
+if(NOT actual_count EQUAL expected_count)
+  message(STATUS "actual_count='${actual_count}'")
+  message(FATAL_ERROR "error: expected_count=${expected_count} does not match 
actual_count=${actual_count}: CPackComponents test fails. 
(CPack_output=${CPack_output}, CPack_error=${CPack_error})")
+endif()
+
+
+# dpkg-deb checks
+find_program(DPKGDEB_EXECUTABLE dpkg-deb)
+if(DPKGDEB_EXECUTABLE)
+  set(dpkgdeb_output_errors_all "")
+  foreach(_f IN LISTS actual_output)
+    run_dpkgdeb(dpkg_output
+                FILENAME "${_f}"
+                )
+
+    # message(FATAL_ERROR "output = '${dpkg_output}'")
+    if("${dpkg_output}" STREQUAL "")
+      set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}"
+                                    "dpkg-deb: ${_f}: empty content returned 
by dpkg-deb")
+    endif()
+  endforeach()
+
+  if(NOT "${dpkgdeb_output_errors_all}" STREQUAL "")
+    message(FATAL_ERROR "dpkg-deb checks 
failed:\n${dpkgdeb_output_errors_all}")
+  endif()
+else()
+  message("dpkg-deb executable not found - skipping dpkg-deb test")
+endif()
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake 
b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake
index b96669e..49457b8 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake
@@ -148,12 +148,11 @@ function(run_dpkgdeb dpkg_deb_output)
     set(multiValueArgs "")
     cmake_parse_arguments(run_dpkgdeb_deb "${options}" "${oneValueArgs}" 
"${multiValueArgs}" ${ARGN} )
 
-
     if(NOT run_dpkgdeb_deb_FILENAME)
       message(FATAL_ERROR "error: run_dpkgdeb needs FILENAME to be set")
     endif()
 
-    # run lintian
+    # run dpkg-deb
     execute_process(COMMAND ${DPKGDEB_EXECUTABLE} -I 
${run_dpkgdeb_deb_FILENAME}
       WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
       OUTPUT_VARIABLE DPKGDEB_OUTPUT
@@ -161,6 +160,10 @@ function(run_dpkgdeb dpkg_deb_output)
       ERROR_VARIABLE DPKGDEB_ERROR
       OUTPUT_STRIP_TRAILING_WHITESPACE )
 
+    if(NOT ("${DPKGDEB_RESULT}" EQUAL "0"))
+      message(FATAL_ERROR "Error '${DPKGDEB_RESULT}' returned by dpkg-deb: 
'${DPKGDEB_ERROR}'")
+    endif()
+
     set(${dpkg_deb_output} "${DPKGDEB_OUTPUT}" PARENT_SCOPE)
   else()
     message(FATAL_ERROR "run_dpkgdeb called without dpkg-deb executable being 
present")
-- 
2.0.1

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to