REUSE compatibility vs multi-package repo

Hi. I’ve started trying to have my repos REUSE-compliant.

It seems that single-package repos can easily be turned into REUSE-compliant by adding all the SPDX comments to files, moving the top-level LICENSE file into LICENSES/BSD-3-Clause.txt and specifying <license file="LICENSES/BSD-3-Clause.txt">BSD</license> in package.xml.

However, if I want to do the same for a multi-package repo, then the LICENSES folder has to be a top-level one, i.e. at the same level as are the packages (that is a REUSE requirement). At the same time, I’d like to not have to copy all licenses to each package - as it’s best if each is stored only once. However, if I put <license file="../LICENSES/BSD-3-Clause.txt"> in package.xml, then bloom-release fails not being able to find the license file. That’s because it builds each package from the repo in a separate directory that is moved outside the repo.

I don’t see a clean solution how to satisfy both REUSE and bloom (except not adding the file= attribute, but I’d like to keep it). My current dirty workaround is to just copy the license file into the root of each subpackage. That’s not nice, but it does the job.

Does anybody know of a cleaner solution? I think it would be very nice if ROS deployment process would be compatible with REUSE.

I’m not sure if it would work with bloom, but I suggest you add a symlink in each package to the root LICENCES folder

1 Like

No, that wouldn’t work (I think). Bloom would just copy the symlink to the separate directory and it would become broken.

I had a quick look at this in Bloom. Preserving and copying the LICENSE file from somewhere else in the repository into the package’s subdirectory is actually pretty easy, and we can do it with just a handful of lines added to Bloom’s sources. The less clean part of this would be changing the manifest itself to use the new path. Even catkin_pkg itself uses a regular expression to make modifications, as the serialization round-trip isn’t typically idempotent. I’d hate to do that here, but I don’t see another way.

If I’m reading the documentation correctly, this might actually work as far as Bloom is concerned. The “trimming” process uses shutil.copytree, which uses shutil.copy2, which seems to resolve symlinks by default.

Thanks for the great analysis, @cottsay . You convinced me to give the symlink approach a try.

If you’ll try to poke into bloom, let me know, I can test.

Thanks, @cottsay for your symlink idea. It works! The latest release of compass_stack - ROS Wiki follows it and all packages built, both in dev and release jobs.


To summarize the approach, the folder structure should be:

  • package_1
    • LICENSE → …/LICENSES/BSD-3-Clause.txt (this file is needed by bloom; name of the file is dictated by rosdistro)
    • package.xml (tag <license file="LICENSE">BSD</license>)
  • LICENSES
    • BSD-3-Clause.txt (this file is required by REUSE)
  • LICENSE → LICENSES/BSD-3-Clause.txt (this is optional, for e.g. github)

This way, I achieved full REUSE compliance of the whole stack repo without any duplication of the license files (only a few extra symlinks). Git seems to handle the symlinks nice on Linux. Windows users might need to set core.symlinks to true in git config.


Does anybody know what would be a good place to turn this into a docs page?