From 749a140a0c635dca69e03245bfd6e0f2f4f43753 Mon Sep 17 00:00:00 2001 From: Raffi Enficiaud Date: Mon, 28 Sep 2015 23:23:05 +0200 Subject: [PATCH 1/4] CPackDeb: allow empty directories in component packages --- Source/CPack/cmCPackDebGenerator.cxx | 2 ++ Tests/CPackComponentsDEB/CMakeLists.txt | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 5cdab5228..93c94e2c1 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -95,6 +95,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel, std::string findExpr(this->GetOption("GEN_WDIR")); findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseListDirs(true); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -222,6 +223,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne() std::string findExpr(this->GetOption("GEN_WDIR")); findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseListDirs(true); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Tests/CPackComponentsDEB/CMakeLists.txt b/Tests/CPackComponentsDEB/CMakeLists.txt index 98ed911c5..093b23fdd 100644 --- a/Tests/CPackComponentsDEB/CMakeLists.txt +++ b/Tests/CPackComponentsDEB/CMakeLists.txt @@ -110,9 +110,8 @@ install(FILES ${CPackComponentsDEB_BINARY_DIR}/symtest if(EXISTS "./dirtest") execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ./dirtest) endif() +# NOTE: directory left empty on purpose execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ./dirtest) -# BUG: apparently cannot add an empty directory -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../mylibapp ./dirtest/symtest) # NOTE: we should not add the trailing "/" to dirtest install(DIRECTORY ${CPackComponentsDEB_BINARY_DIR}/dirtest DESTINATION bin/ From 19c6f4eefce4f58538dd750af5d014bba23192f3 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Fri, 25 Sep 2015 01:23:35 +0200 Subject: [PATCH 2/4] SystemTools: set time file permissions On Windows if file permissions are read only FILE_WRITE_ATTRIBUTES will enables us to get file handle and change file time. --- Source/cmSystemTools.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 26750665d..fa84478b3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2048,7 +2048,7 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile) OPEN_EXISTING, 0, 0); cmSystemToolsWindowsHandle hTo = CreateFileW(SystemTools::ConvertToWindowsExtendedPath(toFile).c_str(), - GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); + FILE_WRITE_ATTRIBUTES, 0, 0, OPEN_EXISTING, 0, 0); if(!hFrom || !hTo) { return false; @@ -2127,7 +2127,7 @@ bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t) #if defined(_WIN32) && !defined(__CYGWIN__) cmSystemToolsWindowsHandle h = CreateFileW(SystemTools::ConvertToWindowsExtendedPath(fname).c_str(), - GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); + FILE_WRITE_ATTRIBUTES, 0, 0, OPEN_EXISTING, 0, 0); if(!h) { return false; From ecd71c9c1a0735cb84234344387f4138a1853fa5 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Mon, 28 Sep 2015 22:49:05 +0200 Subject: [PATCH 3/4] SystemTools: time operations on directories On windows FILE_FLAG_BACKUP_SEMANTICS enables us to read/write time both on files and directories. --- Source/cmSystemTools.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index fa84478b3..d3c1f16b9 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2045,10 +2045,11 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile) cmSystemToolsWindowsHandle hFrom = CreateFileW(SystemTools::ConvertToWindowsExtendedPath(fromFile).c_str(), GENERIC_READ, FILE_SHARE_READ, 0, - OPEN_EXISTING, 0, 0); + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); cmSystemToolsWindowsHandle hTo = CreateFileW(SystemTools::ConvertToWindowsExtendedPath(toFile).c_str(), - FILE_WRITE_ATTRIBUTES, 0, 0, OPEN_EXISTING, 0, 0); + FILE_WRITE_ATTRIBUTES, 0, 0, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, 0); if(!hFrom || !hTo) { return false; @@ -2100,7 +2101,8 @@ bool cmSystemTools::FileTimeGet(const char* fname, cmSystemToolsFileTime* t) #if defined(_WIN32) && !defined(__CYGWIN__) cmSystemToolsWindowsHandle h = CreateFileW(SystemTools::ConvertToWindowsExtendedPath(fname).c_str(), - GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, 0); if(!h) { return false; @@ -2127,7 +2129,8 @@ bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t) #if defined(_WIN32) && !defined(__CYGWIN__) cmSystemToolsWindowsHandle h = CreateFileW(SystemTools::ConvertToWindowsExtendedPath(fname).c_str(), - FILE_WRITE_ATTRIBUTES, 0, 0, OPEN_EXISTING, 0, 0); + FILE_WRITE_ATTRIBUTES, 0, 0, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, 0); if(!h) { return false; From 9298f56dcedb888ff140b6b1aab90be91162d50f Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Mon, 28 Sep 2015 22:50:15 +0200 Subject: [PATCH 4/4] CPack: allow packaging of empty directories --- Help/release/dev/cpack-package-empty-dirs.rts | 4 ++++ Source/CPack/cmCPackArchiveGenerator.cxx | 4 ++-- Source/CPack/cmCPackGenerator.cxx | 10 +++++++++- Tests/RunCMake/CMakeLists.txt | 2 +- Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake | 5 +++++ .../CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake | 5 +++++ .../CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake | 2 ++ Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake | 5 +++++ Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake | 1 + Tests/RunCMake/CPack/EMPTY_DIR.cmake | 4 ++++ .../CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake | 5 +++++ .../RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt | 1 + Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake | 5 +++++ Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt | 1 + Tests/RunCMake/CPack/RunCMakeTest.cmake | 4 +++- .../CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake | 3 +++ .../CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake | 1 + Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake | 3 +++ Tests/RunCMake/CPack/TGZ/Helpers.cmake | 10 ++++++++++ Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake | 5 +++++ Tests/RunCMake/CPack/TGZ/Prerequirements.cmake | 4 ++++ 21 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 Help/release/dev/cpack-package-empty-dirs.rts create mode 100644 Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake create mode 100644 Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake create mode 100644 Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake create mode 100644 Tests/RunCMake/CPack/EMPTY_DIR.cmake create mode 100644 Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt create mode 100644 Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt create mode 100644 Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake create mode 100644 Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/TGZ/Helpers.cmake create mode 100644 Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/TGZ/Prerequirements.cmake diff --git a/Help/release/dev/cpack-package-empty-dirs.rts b/Help/release/dev/cpack-package-empty-dirs.rts new file mode 100644 index 000000000..1f56e1a90 --- /dev/null +++ b/Help/release/dev/cpack-package-empty-dirs.rts @@ -0,0 +1,4 @@ +cpack-package-empty-dirs +------------------------ + +* The :module:`CPack` module learned to package empty directories. diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 58bd94730..70de757c7 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -78,7 +78,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, std::string rp = filePrefix + *fileIt; cmCPackLogger(cmCPackLog::LOG_DEBUG,"Adding file: " << rp << std::endl); - archive.Add(rp); + archive.Add(rp, 0, 0, false); if (!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: " @@ -284,7 +284,7 @@ int cmCPackArchiveGenerator::PackageFiles() // Get the relative path to the file std::string rp = cmSystemTools::RelativePath(toplevel.c_str(), fileIt->c_str()); - archive.Add(rp); + archive.Add(rp, 0, 0, false); if(!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem while adding file< " diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 92a4b2bcd..def9fc7b6 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -367,6 +367,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Install directory: " << top << std::endl); gl.RecurseOn(); + gl.SetRecurseListDirs(true); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -379,7 +380,11 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( for ( gfit = files.begin(); gfit != files.end(); ++ gfit ) { bool skip = false; - std::string &inFile = *gfit; + std::string inFile = *gfit; + if(cmSystemTools::FileIsDirectory(*gfit)) + { + inFile += '/'; + } for ( regIt= ignoreFilesRegex.begin(); regIt!= ignoreFilesRegex.end(); ++ regIt) @@ -869,6 +874,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cmsys::Glob glB; findExpr += "/*"; glB.RecurseOn(); + glB.SetRecurseListDirs(true); glB.FindFiles(findExpr); filesBefore = glB.GetFiles(); std::sort(filesBefore.begin(),filesBefore.end()); @@ -908,6 +914,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( { cmsys::Glob glA; glA.RecurseOn(); + glA.SetRecurseListDirs(true); glA.FindFiles(findExpr); std::vector filesAfter = glA.GetFiles(); std::sort(filesAfter.begin(),filesAfter.end()); @@ -1074,6 +1081,7 @@ int cmCPackGenerator::DoPackage() std::string findExpr = tempDirectory; findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseListDirs(true); gl.SetRecurseThroughSymlinks(false); if ( !gl.FindFiles(findExpr) ) { diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index f11d20c6c..1a0019f5e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -290,7 +290,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(CompilerLauncher) endif() -add_RunCMake_test_group(CPack "DEB;RPM") +add_RunCMake_test_group(CPack "DEB;RPM;TGZ") # add a test to make sure symbols are exported from a shared library # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) diff --git a/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake b/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake new file mode 100644 index 000000000..7210e7d63 --- /dev/null +++ b/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake @@ -0,0 +1,5 @@ +set(CPACK_COMPONENTS_ALL test) +install(DIRECTORY DESTINATION empty + COMPONENT test) + +set(CPACK_PACKAGE_NAME "components_empty_dir") diff --git a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 000000000..5adca685a --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "components_empty_dir*.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$") diff --git a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake new file mode 100644 index 000000000..2720fe921 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake @@ -0,0 +1,2 @@ +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEB_COMPONENT_INSTALL "ON") diff --git a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 000000000..1552a36ad --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "empty_dir*.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$") diff --git a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake new file mode 100644 index 000000000..8821ab9be --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake @@ -0,0 +1 @@ +set(CPACK_PACKAGE_CONTACT "someone") diff --git a/Tests/RunCMake/CPack/EMPTY_DIR.cmake b/Tests/RunCMake/CPack/EMPTY_DIR.cmake new file mode 100644 index 000000000..023ba173e --- /dev/null +++ b/Tests/RunCMake/CPack/EMPTY_DIR.cmake @@ -0,0 +1,4 @@ +install(DIRECTORY DESTINATION empty + COMPONENT test) + +set(CPACK_PACKAGE_NAME "empty_dir") diff --git a/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 000000000..d3962768f --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "components_empty_dir*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/empty$") diff --git a/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt new file mode 100644 index 000000000..6ddca1275 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/COMPONENTS_EMPTY_DIR-build/_CPack_Packages/.*/RPM/SPECS/components_empty_dir.spec$ diff --git a/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 000000000..0c2977f7b --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "empty_dir*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/empty$") diff --git a/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt new file mode 100644 index 000000000..1777aa01d --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/EMPTY_DIR-build/_CPack_Packages/.*/RPM/SPECS/empty_dir.spec$ diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 3e5714d2c..b7295f450 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -4,7 +4,9 @@ include(RunCMake) include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") # args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP -run_cpack_test(MINIMAL "RPM;DEB" false) +run_cpack_test(MINIMAL "RPM;DEB;TGZ" false) run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false) run_cpack_test(DEB_EXTRA "DEB" false) run_cpack_test(DEPENDENCIES "RPM;DEB" true) +run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true) +run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true) diff --git a/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 000000000..26e2ab06b --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,3 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "components_empty_dir*.tar.gz") +set(EXPECTED_FILE_CONTENT_1 "^[^\n]*empty/$") diff --git a/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake new file mode 100644 index 000000000..81a5035a3 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake @@ -0,0 +1 @@ +set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") diff --git a/Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 000000000..a75514a7a --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,3 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "empty_dir*.tar.gz") +set(EXPECTED_FILE_CONTENT_1 "^[^\n]*empty_dir-0.1.1-[^\n]*/empty/$") diff --git a/Tests/RunCMake/CPack/TGZ/Helpers.cmake b/Tests/RunCMake/CPack/TGZ/Helpers.cmake new file mode 100644 index 000000000..f14d53267 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/Helpers.cmake @@ -0,0 +1,10 @@ +set(ALL_FILES_GLOB "*.tar.gz") + +function(getPackageContent FILE RESULT_VAR) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar -ztvf ${FILE} + OUTPUT_VARIABLE package_content_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake new file mode 100644 index 000000000..5c31f276a --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "minimal*.tar.gz") +set(EXPECTED_FILE_CONTENT_1 "^[^\n]*minimal-0.1.1-[^\n]*/foo/\n[^\n]*minimal-0.1.1-[^\n]*/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/TGZ/Prerequirements.cmake b/Tests/RunCMake/CPack/TGZ/Prerequirements.cmake new file mode 100644 index 000000000..dbaf682e5 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/Prerequirements.cmake @@ -0,0 +1,4 @@ +function(get_test_prerequirements found_var config_file) + file(WRITE "${config_file}" "") + set(${found_var} true PARENT_SCOPE) +endfunction()