diff --git a/vinca/recipes.py b/vinca/recipes.py index 112dca5..a1883ad 100644 --- a/vinca/recipes.py +++ b/vinca/recipes.py @@ -400,9 +400,16 @@ def _adjust_requirements(requirements: Requirements, package_prefix: str) -> Non {"if": "build_platform != target_platform", "then": [dependency]} ) + # doxygen is a build-machine doc generator; keeping it (or the graphviz it + # expands to) in `host` leaks graphviz's run_exports into `run` and its + # post-link caches into $PREFIX. + while "doxygen" in requirements["host"]: + requirements["host"].remove("doxygen") + requirements["build"].append("doxygen") + # These run on the build machine, so a target-platform build of them is useless: # keep them in `host` only when not cross-compiling, and in `build` when we are. - for dependency in ("pyqt-builder", "git", "doxygen", "git-lfs"): + for dependency in ("pyqt-builder", "git", "git-lfs"): _replace_with_selector( requirements["host"], dependency, @@ -574,7 +581,7 @@ def generate_output( resolved = resolve_pkgname(dependency, vinca_conf, distro) if not resolved: unsatisfied.add(dependency) - elif "git" in resolved: + elif "git" in resolved or "doxygen" in resolved: output["requirements"]["build"].extend(resolved) elif conditional_python and resolved == ["python"]: pass @@ -590,13 +597,14 @@ def generate_output( } ) - _resolve_into( - build_dependencies, - output["requirements"]["host"], - vinca_conf, - distro, - unsatisfied, - ) + for dependency in build_dependencies: + resolved = resolve_pkgname(dependency, vinca_conf, distro) + if not resolved: + unsatisfied.add(dependency) + elif "doxygen" in resolved: + output["requirements"]["build"].extend(resolved) + else: + output["requirements"]["host"].extend(resolved) run_dependencies = ( _evaluated_dependency_names( [ diff --git a/vinca/test_recipes.py b/vinca/test_recipes.py index d1bbfa5..1ca4fed 100644 --- a/vinca/test_recipes.py +++ b/vinca/test_recipes.py @@ -28,7 +28,10 @@ "python-setuptools": ["setuptools"], "cmake": ["cmake"], "git": ["git"], - "doxygen": ["doxygen"], + "git-lfs": ["git-lfs"], + # matches robostack.yaml's real rosdep mapping: doxygen brings graphviz for dot + "doxygen": ["doxygen", "graphviz"], + "graphviz": ["graphviz"], "cyclonedds": ["ros2-cyclonedds"], "mimick_vendor": ["ros2-mimick-vendor"], "pybind11_vendor": ["ros2-pybind11-vendor"], @@ -438,17 +441,34 @@ def test_pybind11_vendor_pulls_in_pybind11(): def test_host_only_tools_are_split_across_build_and_host(): - output = build("demo", depends=[("build_depend", "doxygen")]) + output = build("demo", depends=[("build_depend", "git-lfs")]) assert { "if": "build_platform == target_platform", - "then": ["doxygen"], + "then": ["git-lfs"], } in output["requirements"]["host"] assert { "if": "build_platform != target_platform", - "then": ["doxygen"], + "then": ["git-lfs"], } in output["requirements"]["build"] + assert "git-lfs" not in output["requirements"]["host"] + + +@pytest.mark.parametrize("tag", ["build_depend", "buildtool_depend"]) +def test_doxygen_and_its_graphviz_go_to_build_not_host(tag): + output = build("demo", depends=[(tag, "doxygen")]) + + assert "doxygen" in output["requirements"]["build"] + assert "graphviz" in output["requirements"]["build"] assert "doxygen" not in output["requirements"]["host"] + assert "graphviz" not in output["requirements"]["host"] + + +def test_direct_graphviz_dependency_stays_in_host(): + output = build("demo", depends=[("build_depend", "graphviz")]) + + assert "graphviz" in output["requirements"]["host"] + assert "graphviz" not in output["requirements"]["build"] def test_cyclonedds_gets_a_build_platform_copy():