diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2015-09-22 00:08:26 (GMT) |
---|---|---|
committer | Domen Vrankar <domen.vrankar@gmail.com> | 2015-09-22 00:08:26 (GMT) |
commit | b58de9fe2ba4ac3e194403ecd118fd54681ffae8 (patch) | |
tree | 789846ed936c0a2e0cf09abb755d487042263720 | |
parent | 47b060aee0871bdb5fea63b398a1f1cb07fa3b37 (diff) | |
download | CMake-b58de9fe2ba4ac3e194403ecd118fd54681ffae8.zip CMake-b58de9fe2ba4ac3e194403ecd118fd54681ffae8.tar.gz CMake-b58de9fe2ba4ac3e194403ecd118fd54681ffae8.tar.bz2 |
CPack: allow packaging of empty directories
-rw-r--r-- | Help/release/dev/cpack-package-empty-dirs.rts | 4 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 21 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/EMPTY_DIR.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RunCMakeTest.cmake | 2 |
15 files changed, 67 insertions, 1 deletions
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 0000000..1f56e1a --- /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/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 92a4b2b..aa4f181 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -367,6 +367,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Install directory: " << top << std::endl); gl.RecurseOn(); + gl.SetRecurseListDirs(true); +// gl.SetRecurseThroughSymlinks(false); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -869,6 +871,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 +911,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( { cmsys::Glob glA; glA.RecurseOn(); + glA.SetRecurseListDirs(true); glA.FindFiles(findExpr); std::vector<std::string> filesAfter = glA.GetFiles(); std::sort(filesAfter.begin(),filesAfter.end()); @@ -1074,6 +1078,7 @@ int cmCPackGenerator::DoPackage() std::string findExpr = tempDirectory; findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseListDirs(true); gl.SetRecurseThroughSymlinks(false); if ( !gl.FindFiles(findExpr) ) { diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 2675066..c24b5ea 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -895,12 +895,33 @@ std::string cmSystemTools::FileExistsInParentDirectories(const char* fname, bool cmSystemTools::cmCopyFile(const char* source, const char* destination) { + // FIXME remove if statement once kwsys SystemTools get support for + // source is directory handling in CopyFileAlways function + if(cmSystemTools::FileIsDirectory(source)) + { + return Superclass::MakeDirectory(destination); + } + return Superclass::CopyFileAlways(source, destination); } bool cmSystemTools::CopyFileIfDifferent(const char* source, const char* destination) { + // FIXME remove if statement once kwsys SystemTools get support for + // source is directory handling in CopyFileIfDifferent function + if(cmSystemTools::FileIsDirectory(source)) + { + if(SystemTools::FileExists(destination)) + { + return true; + } + else + { + return Superclass::MakeDirectory(destination); + } + } + return Superclass::CopyFileIfDifferent(source, destination); } diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt index 46f1367..449172a 100644 --- a/Tests/RunCMake/CPack/CMakeLists.txt +++ b/Tests/RunCMake/CPack/CMakeLists.txt @@ -8,5 +8,5 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/${RunCMake_TEST}-specif include("${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake") endif() -set(CPACK_GENERATOR "${GENERATOR_TYPE}") +set(CPACK_GENERATOR "${GENERATOR_TYPE};TGZ") include(CPack) diff --git a/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake b/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake new file mode 100644 index 0000000..7210e7d --- /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 0000000..5adca68 --- /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 0000000..2720fe9 --- /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 0000000..1552a36 --- /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 0000000..8821ab9 --- /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 0000000..023ba17 --- /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 0000000..d396276 --- /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 0000000..6ddca12 --- /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 0000000..0c2977f --- /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 0000000..1777aa0 --- /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 3e5714d..89673c2 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -8,3 +8,5 @@ run_cpack_test(MINIMAL "RPM;DEB" 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" true) +run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB" true) |