I am dealing with a packaging problem in the foxglove_msgs package, where custom message types are missing from the final deb, although they work when I build locally. I suspect the issue may be that the .msg files are copied during the build step:
These files are coming from a parent directory. If the debian source package does not include the parent directory, then when the build runs from the source package, the files would not be present.
Is it possible to run this code (or another script) during the “build sourcedeb” step so that I can ensure the necessary files are included in the source package?
It looks like you’re generating the msg files and committing them into the repository. As such I’d suggest just committing them into the package such that they’re available to build the package instead of having the package reach out and attempt to pull in content from outside of itself.
In general ROS source packages should expect to be relocatable and be checked out into anyone’s workspace with the deployers choice of peers including fully isolated. (subject to appropriate dependencies on the system etc.) As such a well formed package can’t rely on any parent or peer directories existing. The current approach will only work if a developer directly checks out your github repository, and will break if using the release tarballs and other mechanisms like the binary builds that you’ve pointed to above.
Just to reiterate what @tfoote said as a general rule (for anyone else reading this):
Packages should never reference files outside of the package’s source directory (directory containing the package.xml) relatively.
Instead they should only ever reference files from other packages through the install space, even if they’re in the same repository.
The ament_index exists, in part, to facilitate this.
You cannot assume that your package is built in the original source layout of your repository (only the layout of the package directory is guaranteed not to change), nor that it is in the same workspace as any other package, nor that it is installed to the same place as any other packages.