From 2b9ef77944cab3a330fa547dbe7e87aefd80b795 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Thu, 7 Oct 2021 21:43:41 +0300 Subject: CPack/DEB: deal with broken dpkg-shlibdeps on E2K architecture "OS Elbrus" (OSL for short), a reference Linux distro for E2K (Elbrus) platform may have broken dpkg-shlibdeps, that doesn't specify dependencies correctly. In this case, the only reliable way is to explicitly set dependencies of libc6 and lcc-libs, and then warn user to let him know this list may be incomplete. This commit does that. This fix has no effect on correctly working dpkg-shlibdeps, so when this bug will be fixed in new versions of OSL, CPack will work as expected with these distros. --- Modules/Internal/CPack/CPackDeb.cmake | 8 ++++++++ Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index c115f00..958a6db 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -332,6 +332,14 @@ function(cpack_deb_prepare_package_vars) RESULT_VARIABLE SHLIBDEPS_RESULT ERROR_VARIABLE SHLIBDEPS_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE ) + + # E2K OSL 6.0.1 and prior has broken dpkg-shlibdeps. CPack will deal with that (mocking SHLIBDEPS_OUTPUT), but inform user of this. + if("${SHLIBDEPS_ERROR}" MATCHES "unknown gcc system type e2k.*, falling back to default") + message(WARNING "CPackDeb: broken dpkg-shlibdeps on E2K detected, will fall back to minimal dependencies.\n" + "You should expect that dependencies list in the package will be incomplete.") + set(SHLIBDEPS_OUTPUT "shlibs:Depends=libc6, lcc-libs") + endif() + if(CPACK_DEBIAN_PACKAGE_DEBUG) # dpkg-shlibdeps will throw some warnings if some input files are not binary message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt b/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt index 5df274a..df777ea 100644 --- a/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt +++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt @@ -1 +1,2 @@ -^CPackDeb: ((- Generating dependency list)|(Using only user-provided dependencies because dpkg-shlibdeps is not found\.))$ +^CPackDeb: ((- Generating dependency list)( +CMake Warning.*broken dpkg-shlibdeps on E2K detected.*\(cpack_deb_prepare_package_vars\))?|(Using only user-provided dependencies because dpkg-shlibdeps is not found\.))$ -- cgit v0.12