<div dir="ltr"><div>Package: dh-fortran<br>Version: 0.85<br>Severity: normal<br>X-Debbugs-Cc: <a href="mailto:mckinstry@debian.org">mckinstry@debian.org</a>, <a href="mailto:talha.can.havadar@canonical.com">talha.can.havadar@canonical.com</a><br><br>Dear Maintainer,<br><br>dh_fortran_cmake finds CMake config/target files matching a package's<br>debian/<pkg>.fortran-cmake glob, but never actually installs or<br>rewrites them into the binary package. The files are silently dropped:<br>dh_missing does not flag them as missing (they are recorded as<br>"handled" before processing), but they simply never appear in the<br>built .deb.<br><br>Root cause: CMakeFileHelper.process_file() in dhfortran/cmake.py is an<br>unimplemented stub:<br><br>    def process_file(self, pkg, cmake_file, target_pkg, target_dest=None):<br>        cli.debug_print(<br>            f"process_file [lib]  name {cmake_file} {target_pkg} {target_dest}"<br>        )<br>        ...<br><br>Unlike ModFileHelper.process_file() (dhfortran/module.py), which<br>actually calls dh.install_dir() and self.doit(["cp", ...]) to copy the<br>matched file, CMakeFileHelper.process_file() has no body beyond the<br>debug print and the Ellipsis placeholder.<br><br>A second, related bug: even if process_file() were implemented to copy<br>the file, the module also defines a rewrite_cmake() helper intended to<br>patch IMPORTED_LOCATION / INTERFACE_INCLUDE_DIRECTORIES references<br>inside the CMake target file to point at wherever dh_fortran_lib /<br>dh_fortran_mod actually relocated the corresponding .a/.mod files (the<br>docstring and inline comments describe exactly this: "rename<br>references to Fortran libs", with example sed substitutions for<br>${_IMPORT_PREFIX}/lib, /include, and /module). But rewrite_cmake()<br>itself is also broken:<br><br>    with open(oldname, "r") as f:<br>        with open(newname, "w") as n:<br>            n.write(f.read)<br><br>f.read is missing its call parentheses -- this writes the bound<br>method object's repr instead of the file's contents, and the function<br>appears to never be called from anywhere in the current codebase<br>regardless.<br><br>Impact: any package that declares a debian/<pkg>.fortran-cmake file<br>ends up shipping no CMake config at all in the location dh-fortran<br>would place it, and any package that DOES install its own CMake<br>config verbatim (bypassing dh_fortran_cmake) ends up with<br>IMPORTED_LOCATION / INTERFACE_INCLUDE_DIRECTORIES entries still<br>pointing at the pre-relocation paths, since nothing rewrites them to<br>match dh_fortran_lib's/dh_fortran_mod's per-compiler destinations.<br>find_package(<pkg>) then either finds nothing, or finds a config<br>referencing files that don't exist.<br><br>This was hit packaging hipfort 10.0.0 for Ubuntu: we ended up working<br>around it by disabling hipfort's own multitoolchain CMake layout<br>entirely (so the CMake config lands at the plain, non-relocated<br>per-arch path that find_package resolves natively) and installing the<br>CMake config/target files and static libraries via a plain<br>debian/<pkg>.install line instead of routing them through<br>dh_fortran_cmake/dh_fortran_lib. See the packaging for reference (Ubuntu<br>git, branch hipfort-10.0 -- not yet pushed to Salsa):<br><br>  <a href="https://git.launchpad.net/~bullwinkle-team/ubuntu/+source/hipfort">https://git.launchpad.net/~bullwinkle-team/ubuntu/+source/hipfort</a><br>  debian/patches/0001-disable-multitoolchain-layout-by-default.patch<br>  debian/rules (see the comment block above override_dh_auto_install)<br><br>To reproduce in isolation: any Fortran package using CMake with a<br>debian/<pkg>.fortran-cmake config file listing a glob that matches<br>real files in debian/tmp at build time. After the build,<br>debian/<pkg>/ will not contain those files under the expected<br>/usr/lib/<multiarch>/fortran/cmake/<target>/ destination (or anywhere<br>else) -- dh_fortran_cmake's log shows no install_dir/doit lines for<br>them at all, only the "source=... binary packages=..." header line.<br><br>Thank you for maintaining dh-fortran -- it's a great addition to<br>Debian's Fortran packaging tooling once this is fixed.<br><br>-- System Information:<br>Debian Release: trixie/sid<br>  APT prefers unstable<br>  APT policy: (500, 'unstable')<br>Architecture: amd64<br><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><br></div><img src="https://assets.ubuntu.com/v1/e3fc2c4f-20%20YEARS_logo_white-bg.png" width="200" height="29"><br><table style="color:rgb(34,34,34)"><tbody><tr><td colspan="2" style="vertical-align:top;padding:0px 0px 0px 5px;font-size:0px"><p style="display:inline-block;font-size:13px;line-height:16px;padding-top:0.8px;margin-bottom:0px;margin-top:0.8px;font-weight:600">Igor Luppi<br></p></td></tr><tr><td colspan="2" style="vertical-align:top;padding:0px 0px 0px 5px;font-size:0px"><p style="display:inline-block;font-size:13px;line-height:16px;padding-top:0.8px;margin-bottom:8px;margin-top:0.8px;color:rgb(117,117,117)">Software Engineer<br></p><table><tbody><tr><td style="vertical-align:top;padding:0px 0px 0px 5px"><p style="display:inline-block;font-size:13px;line-height:17px;padding-top:0.8px;margin-bottom:0px;margin-top:0.8px;color:rgb(117,117,117)">Email:</p></td><td style="vertical-align:top;padding:0px 4px 0px 5px"><p style="display:inline-block;font-size:13px;line-height:17px;padding-top:0.8px;margin-bottom:0px;margin-top:0.8px;margin-left:12px"><a href="mailto:igor.luppi@canonical.com" style="color:rgb(17,85,204)" target="_blank">igor.luppi@canonical.com</a></p></td></tr><tr><td style="vertical-align:top;padding:0px 0px 0px 5px"><p style="display:inline-block;font-size:13px;line-height:17px;padding-top:0.8px;margin-bottom:0px;margin-top:0.8px;color:rgb(117,117,117)">Location:</p></td><td style="vertical-align:top;padding:0px 0px 0px 5px"><p style="display:inline-block;font-size:13px;line-height:17px;padding-top:0.8px;margin-bottom:0px;margin-top:0.8px;margin-left:12px">Brazil<br></p></td></tr><tr><td style="vertical-align:top;padding:0px 0px 0px 5px"><br></td><td style="vertical-align:top;padding:0px 0px 0px 5px"><br></td></tr><tr><td colspan="2" style="vertical-align:top;padding:0px 0px 0px 5px"><a href="https://canonical.com/" style="color:rgb(0,102,204)" target="_blank"><p style="display:inline-block;font-size:13px;line-height:17px;padding-top:0.8px;margin-bottom:0px;margin-top:8.8px"></p></a><a href="https://canonical.com/" style="color:rgb(0,102,204)" target="_blank"><p style="display:inline-block;font-size:13px;line-height:17px;padding-top:0.8px;margin-bottom:0px;margin-top:8.8px">canonical.com</p></a></td></tr><tr><td colspan="2" style="vertical-align:top;padding:0px 0px 0px 5px"><a href="https://ubuntu.com/" style="color:rgb(0,102,204)" target="_blank"><p style="display:inline-block;font-size:13px;line-height:17px;padding-top:0.8px;margin-bottom:0px;margin-top:0.8px">ubuntu.com</p></a></td></tr></tbody></table></td></tr></tbody></table></div></div></div></div>