CPack/DEB: fix md5sums paths in dbgsym packages

The Debian `lintian` tool reported the dbgsym package issue as
`md5sums-lists-nonexistent-file`.

The DEB generator writes `md5sums` entries by stripping a top-level prefix
from each packaged file path. That used `CPACK_TEMPORARY_DIRECTORY`, which
works for regular debs but not for dbgsym packages.

Dbgsym package files are collected from `GEN_DBGSYMDIR` and passed to
`DebGenerator` with `WorkDir` rooted there. Because the `md5sums` writer
stripped `TemporaryDir` instead, the prefix did not match and absolute
staging paths leaked into `md5sums`.

Strip `WorkDir` instead. That is the actual root of `PackageFiles` for both
regular deb and dbgsym package generation, so `md5sums` entries stay
relative in both cases.
This commit is contained in:
Alex Turbov
2026-04-12 07:37:49 +04:00
parent 87dd963851
commit 1ef92d645d
2 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -302,7 +302,7 @@ std::string DebGenerator::generateMD5File() const
cmGeneratedFileStream out;
out.Open(md5filename, false, true);
std::string topLevelWithTrailingSlash = cmStrCat(this->TemporaryDir, '/');
std::string topLevelWithTrailingSlash = cmStrCat(this->WorkDir, '/');
for (std::string const& file : this->PackageFiles) {
// hash only regular files
if (cmSystemTools::FileIsDirectory(file) ||
@@ -0,0 +1,19 @@
if(NOT GENERATOR_TYPE STREQUAL "DEB")
return()
endif()
set(whitespaces_ "[\t\n\r ]*")
set(hashsyms_ "[a-f0-9]+")
set(dbgsym_md5sums_md5sums
"^(${hashsyms_} usr/lib/debug/\\.build-id/[^/\r\n]+/[^/\r\n]+\\.debug${whitespaces_})+$")
set(dbgsym_md5sums_md5sums_permissions "-rw-r--r--")
if(PACKAGING_TYPE STREQUAL "COMPONENT")
verifyDebControl("${FOUND_FILE_4}" "dbgsym_md5sums" "md5sums")
verifyDebControl("${FOUND_FILE_5}" "dbgsym_md5sums" "md5sums")
elseif(PACKAGING_TYPE STREQUAL "MONOLITHIC")
verifyDebControl("${FOUND_FILE_2}" "dbgsym_md5sums" "md5sums")
endif()