This commit is contained in:
Michal Sojka 2025-06-05 11:36:52 +00:00 committed by GitHub
commit e6f28d35c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 348 additions and 169 deletions

View file

@ -44,7 +44,7 @@ jobs:
# permittedInsecurePackages is needed for updating some gz-*-vendor packages.
# Note that this runs without access to SUPERFLORE_GITHUB_TOKEN.
mkdir -p ~/.config/nixpkgs
echo '{ permittedInsecurePackages = [ "freeimage-unstable-2021-11-01" ]; }' > ~/.config/nixpkgs/config.nix
echo '{ permittedInsecurePackages = [ "freeimage-3.18.0-unstable-2024-04-18" ]; }' > ~/.config/nixpkgs/config.nix
NIX_PATH=nixpkgs=$PWD ./maintainers/scripts/update-ament-vendor.sh || ret=$?
git commit -m 'Update vendored-source.json files' $(find -name vendored-source.json) || :
exit $ret

View file

@ -0,0 +1,86 @@
# CMake code that wraps ament_vendor macro for use with Nix. The
# wrapped version of ament_vendor serves two purposes:
#
# 1) Capturing information about what needs to be prefetched from from
# the Internet and stores it into vendored-source.json.
#
# 2) Modifying ament_vendor behavior to use the prefetched data
# instead of downloading them (downloading is not possible in Nix
# build sandbox).
#
# The functionality of the wrapper is controlled with the following
# CMake variables:
#
# AMENT_VENDOR_NIX_PREFETCH: If true, ament_vendor captures the
# information needed for prefetching the data. If false or undefined,
# ament_vendor obtains the data from the Nix store.
#
# AMENT_VENDOR_NIX_TAR_${TARGET_NAME}: Nix store path of the vendored
# source.
#
# The above variables are set in Nix function patchAmentVendorGit.
if(NOT ament_cmake_vendor_package_FIND_QUIETLY)
message(STATUS "Using ament_vendor wrapped for Nix patching (${ament_cmake_vendor_package_DIR})")
endif()
if(AMENT_VENDOR_NIX_PREFETCH)
# Write empty JSON object to vendored-source.json. Subsequent calls to
# ament_vendor() will add entries to it.
file(WRITE ${CMAKE_BINARY_DIR}/vendored-source.json "{}")
find_program(JQ jq)
find_program(NIX_PREFETCH_GIT nix-prefetch-git)
endif()
macro(ament_vendor TARGET_NAME)
cmake_parse_arguments(_ARG "GLOBAL_HOOK;SKIP_INSTALL" "SOURCE_SUBDIR;VCS_TYPE;VCS_URL;VCS_VERSION;SATISFIED" "CMAKE_ARGS;PATCHES" ${ARGN})
if(_ARG_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "ament_vendor() called with unused arguments: "
"${_ARG_UNPARSED_ARGUMENTS}")
endif()
if(AMENT_VENDOR_NIX_PREFETCH)
# Read previous version of vendored-source.json
file(READ ${CMAKE_BINARY_DIR}/vendored-source.json VENDORED_SOURCE_JSON)
# Add new entry to vendored-source.json
execute_process(
COMMAND ${NIX_PREFETCH_GIT} --url ${_ARG_VCS_URL} --rev ${_ARG_VCS_VERSION} --fetch-submodules
COMMAND ${JQ} "${VENDORED_SOURCE_JSON} + {${TARGET_NAME}: {url: \"${_ARG_VCS_URL}\", rev: \"${_ARG_VCS_VERSION}\", hash: .hash}}"
OUTPUT_FILE ${CMAKE_BINARY_DIR}/vendored-source.json
COMMAND_ECHO STDOUT
COMMAND_ERROR_IS_FATAL ANY)
# Minimal implementation of the original ament_vendor macro that
# makes zenoh_cpp_vendor happy. Without this, generation of
# zenoh-cpp-vendor/vendored-source.json fails. If needed, we could
# also use ament_vendor_orig as below, but this is faster, because
# is doesn't download anything.
include(ExternalProject)
externalproject_add(
${TARGET_NAME}
DOWNLOAD_COMMAND ""
)
else()
if(_ARG_GLOBAL_HOOK)
set(_ARG_GLOBAL_HOOK "GLOBAL_HOOK")
else()
unset(_ARG_GLOBAL_HOOK)
endif()
if(_ARG_SKIP_INSTALL)
set(_ARG_SKIP_INSTALL "SKIP_INSTALL")
else()
unset(_ARG_SKIP_INSTALL)
endif()
cmake_language(CALL ament_vendor_orig ${TARGET_NAME}
VCS_TYPE tar
VCS_URL file://${AMENT_VENDOR_NIX_TAR_${TARGET_NAME}}
VCS_VERSION ${_ARG_VCS_VERSION}
${_ARG_GLOBAL_HOOK}
SATISFIED ${_ARG_SATISFIED}
${_ARG_SKIP_INSTALL}
SOURCE_SUBDIR ${_ARG_SOURCE_SUBDIR}
PATCHES ${_ARG_PATCHES}
CMAKE_ARGS ${_ARG_CMAKE_ARGS}
)
endif()
endmacro()

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-cmake.git",
"rev": "gz-cmake3_3.5.4",
"hash": "sha256-mP0bBPWWAoUFsUwKn95Eqv1lW3lJdPEu3hhfmiK3mNQ="
"gz_cmake_vendor": {
"url": "https://github.com/gazebosim/gz-cmake.git",
"rev": "gz-cmake3_3.5.4",
"hash": "sha256-mP0bBPWWAoUFsUwKn95Eqv1lW3lJdPEu3hhfmiK3mNQ="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-common.git",
"rev": "gz-common5_5.7.1",
"hash": "sha256-vNCjCSQYCSUHXKwXnq8vwWXiSK2+cD3yPSLT1FdAWrE="
"gz_common_vendor": {
"url": "https://github.com/gazebosim/gz-common.git",
"rev": "gz-common5_5.7.1",
"hash": "sha256-vNCjCSQYCSUHXKwXnq8vwWXiSK2+cD3yPSLT1FdAWrE="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/dartsim/dart.git",
"rev": "v6.13.2",
"hash": "sha256-AfKPqUiW6BsM98TIzTY2ZcFP1WvURs8/dGOzanIiB9g="
"gz_dartsim_vendor": {
"url": "https://github.com/dartsim/dart.git",
"rev": "v6.13.2",
"hash": "sha256-AfKPqUiW6BsM98TIzTY2ZcFP1WvURs8/dGOzanIiB9g="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-fuel-tools.git",
"rev": "gz-fuel-tools9_9.1.1",
"hash": "sha256-XQoBcCtzwzzPypS1kIeTCIbjtxrzaW3JvZLCYbwXAOk="
"gz_fuel_tools_vendor": {
"url": "https://github.com/gazebosim/gz-fuel-tools.git",
"rev": "gz-fuel-tools9_9.1.1",
"hash": "sha256-XQoBcCtzwzzPypS1kIeTCIbjtxrzaW3JvZLCYbwXAOk="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-gui.git",
"rev": "gz-gui8_8.4.0",
"hash": "sha256-gf9XZzAX2g6r9ThIA0v2H2X/+uu9VnwvyvrdL5ZazM0="
"gz_gui_vendor": {
"url": "https://github.com/gazebosim/gz-gui.git",
"rev": "gz-gui8_8.4.0",
"hash": "sha256-gf9XZzAX2g6r9ThIA0v2H2X/+uu9VnwvyvrdL5ZazM0="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-launch.git",
"rev": "gz-launch7_7.1.1",
"hash": "sha256-S63DWe/c3cnEztxr3uJc0A4AmuiQk4o6m9yXj0X97Yk="
"gz_launch_vendor": {
"url": "https://github.com/gazebosim/gz-launch.git",
"rev": "gz-launch7_7.1.1",
"hash": "sha256-S63DWe/c3cnEztxr3uJc0A4AmuiQk4o6m9yXj0X97Yk="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-math.git",
"rev": "gz-math7_7.5.2",
"hash": "sha256-LwYeyv8nwX06n5ju+ra2uqNMedMSLRumem8qDHXtNns="
"gz_math_vendor": {
"url": "https://github.com/gazebosim/gz-math.git",
"rev": "gz-math7_7.5.2",
"hash": "sha256-LwYeyv8nwX06n5ju+ra2uqNMedMSLRumem8qDHXtNns="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-msgs.git",
"rev": "gz-msgs10_10.3.2",
"hash": "sha256-gxhRqLzBCaDmK67T5RryDpxbDR3WLgV9DFs7w6ieMxQ="
"gz_msgs_vendor": {
"url": "https://github.com/gazebosim/gz-msgs.git",
"rev": "gz-msgs10_10.3.2",
"hash": "sha256-gxhRqLzBCaDmK67T5RryDpxbDR3WLgV9DFs7w6ieMxQ="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/OGRECave/ogre-next.git",
"rev": "v2.3.3",
"hash": "sha256-elSj35LwsLzj1ssDPsk9NW/KSXfiOGYmw9hQSAWdpFM="
"gz_ogre_next_vendor": {
"url": "https://github.com/OGRECave/ogre-next.git",
"rev": "v2.3.3",
"hash": "sha256-elSj35LwsLzj1ssDPsk9NW/KSXfiOGYmw9hQSAWdpFM="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-physics.git",
"rev": "gz-physics7_7.5.0",
"hash": "sha256-75myTqDeEybvj5rsJxRambLPle1cen6HIatZGbVoXro="
"gz_physics_vendor": {
"url": "https://github.com/gazebosim/gz-physics.git",
"rev": "gz-physics7_7.5.0",
"hash": "sha256-75myTqDeEybvj5rsJxRambLPle1cen6HIatZGbVoXro="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-plugin.git",
"rev": "gz-plugin2_2.0.4",
"hash": "sha256-iL4+EdFFAU55FVqE/CvyTv1zNaXxBWqWx44L0BeG2MU="
"gz_plugin_vendor": {
"url": "https://github.com/gazebosim/gz-plugin.git",
"rev": "gz-plugin2_2.0.4",
"hash": "sha256-iL4+EdFFAU55FVqE/CvyTv1zNaXxBWqWx44L0BeG2MU="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-rendering.git",
"rev": "gz-rendering8_8.2.2",
"hash": "sha256-x+QHn8d+19U12CG1+HEmP0KcM3beY00Vvrc8mrxvAs0="
"gz_rendering_vendor": {
"url": "https://github.com/gazebosim/gz-rendering.git",
"rev": "gz-rendering8_8.2.2",
"hash": "sha256-x+QHn8d+19U12CG1+HEmP0KcM3beY00Vvrc8mrxvAs0="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-sensors.git",
"rev": "gz-sensors8_8.2.2",
"hash": "sha256-TRDMCMesJXVSVGA3bnRngtXTi4VVf0y12AJQ79EEMiI="
"gz_sensors_vendor": {
"url": "https://github.com/gazebosim/gz-sensors.git",
"rev": "gz-sensors8_8.2.2",
"hash": "sha256-TRDMCMesJXVSVGA3bnRngtXTi4VVf0y12AJQ79EEMiI="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-sim.git",
"rev": "gz-sim8_8.9.0",
"hash": "sha256-hvhq2XBzcIoupJdJyJzk38LDXoEnd9iBCCiXvPZsPqY="
"gz_sim_vendor": {
"url": "https://github.com/gazebosim/gz-sim.git",
"rev": "gz-sim8_8.9.0",
"hash": "sha256-hvhq2XBzcIoupJdJyJzk38LDXoEnd9iBCCiXvPZsPqY="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-tools.git",
"rev": "gz-tools2_2.0.2",
"hash": "sha256-CY+W1jWIkszKwKuLgKmJpZMXHn0RnueMHFSDhOXIzLg="
"gz_tools_vendor": {
"url": "https://github.com/gazebosim/gz-tools.git",
"rev": "gz-tools2_2.0.2",
"hash": "sha256-CY+W1jWIkszKwKuLgKmJpZMXHn0RnueMHFSDhOXIzLg="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-transport.git",
"rev": "gz-transport13_13.4.1",
"hash": "sha256-hCP+yVoyl1c3KNmQ5jKrYvPT1IlAy9JkCh0c0mOF+KM="
"gz_transport_vendor": {
"url": "https://github.com/gazebosim/gz-transport.git",
"rev": "gz-transport13_13.4.1",
"hash": "sha256-hCP+yVoyl1c3KNmQ5jKrYvPT1IlAy9JkCh0c0mOF+KM="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-utils.git",
"rev": "gz-utils2_2.2.1",
"hash": "sha256-utVW8pTP/emEWblTxVb6jzulKdxss+2VfS552MWMqm4="
"gz_utils_vendor": {
"url": "https://github.com/gazebosim/gz-utils.git",
"rev": "gz-utils2_2.2.1",
"hash": "sha256-utVW8pTP/emEWblTxVb6jzulKdxss+2VfS552MWMqm4="
}
}

View file

@ -250,4 +250,6 @@ in {
})
];
});
zenoh-cpp-vendor = lib.patchAmentVendorGit rosSuper.zenoh-cpp-vendor { };
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/OGRECave/ogre.git",
"rev": "v1.12.10",
"hash": "sha256-Z0ixdSmkV93coBBVZ5R3lPLfVMXRfWsFz/RsSyqPWFY="
"ogre_vendor": {
"url": "https://github.com/OGRECave/ogre.git",
"rev": "v1.12.10",
"hash": "sha256-Z0ixdSmkV93coBBVZ5R3lPLfVMXRfWsFz/RsSyqPWFY="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/sdformat.git",
"rev": "sdformat14_14.7.0",
"hash": "sha256-p2e01bCoMpDhia1yOFa5wIP2ritBiWNT5jYbp/bg1+g="
"sdformat_vendor": {
"url": "https://github.com/gazebosim/sdformat.git",
"rev": "sdformat14_14.7.0",
"hash": "sha256-p2e01bCoMpDhia1yOFa5wIP2ritBiWNT5jYbp/bg1+g="
}
}

View file

@ -0,0 +1,12 @@
{
"zenoh_c_vendor": {
"url": "https://github.com/eclipse-zenoh/zenoh-c.git",
"rev": "e6a1971139f405f7887bf5bb54f0efe402123032",
"hash": "sha256-eJbnb1UJbtuYb+dSpKqVgI1p/97bSc+KTcbO1GNg9jU="
},
"zenoh_cpp_vendor": {
"url": "https://github.com/eclipse-zenoh/zenoh-cpp",
"rev": "8ad67f6c7a9031acd437c8739bbc8ddab0ca8173",
"hash": "sha256-0iRhmMtrhDdM7X0ByiICT4s7lDFcGLSR1dEImzT1mWs="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-cmake.git",
"rev": "gz-cmake4_4.1.1",
"hash": "sha256-BWgRm+3UW65Cu7TqXtFFG05JlYF52dbpAsIE8aDnJM0="
"gz_cmake_vendor": {
"url": "https://github.com/gazebosim/gz-cmake.git",
"rev": "gz-cmake4_4.1.1",
"hash": "sha256-BWgRm+3UW65Cu7TqXtFFG05JlYF52dbpAsIE8aDnJM0="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-common.git",
"rev": "gz-common6_6.0.2",
"hash": "sha256-sY9g+AatS+ddYSUAjqumfZNi2JIc+DFbiVYMaWKMC78="
"gz_common_vendor": {
"url": "https://github.com/gazebosim/gz-common.git",
"rev": "gz-common6_6.0.2",
"hash": "sha256-sY9g+AatS+ddYSUAjqumfZNi2JIc+DFbiVYMaWKMC78="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/dartsim/dart.git",
"rev": "v6.13.2",
"hash": "sha256-AfKPqUiW6BsM98TIzTY2ZcFP1WvURs8/dGOzanIiB9g="
"gz_dartsim_vendor": {
"url": "https://github.com/dartsim/dart.git",
"rev": "v6.13.2",
"hash": "sha256-AfKPqUiW6BsM98TIzTY2ZcFP1WvURs8/dGOzanIiB9g="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-fuel-tools.git",
"rev": "gz-fuel-tools10_10.0.1",
"hash": "sha256-/Xfhec6kpv6srSp+hudqBaK4dKFn0QK45aGqxzNyytw="
"gz_fuel_tools_vendor": {
"url": "https://github.com/gazebosim/gz-fuel-tools.git",
"rev": "gz-fuel-tools10_10.0.1",
"hash": "sha256-/Xfhec6kpv6srSp+hudqBaK4dKFn0QK45aGqxzNyytw="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-gui.git",
"rev": "gz-gui9_9.0.1",
"hash": "sha256-ZBDgd37TPBOldorGZimsCk57fVa7tTc8wRwUGFBZnDk="
"gz_gui_vendor": {
"url": "https://github.com/gazebosim/gz-gui.git",
"rev": "gz-gui9_9.0.1",
"hash": "sha256-ZBDgd37TPBOldorGZimsCk57fVa7tTc8wRwUGFBZnDk="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-launch.git",
"rev": "gz-launch8_8.0.1",
"hash": "sha256-el+4sVBOmeBj8VJqKut8pIhVJeyEyodrt6titunbBF0="
"gz_launch_vendor": {
"url": "https://github.com/gazebosim/gz-launch.git",
"rev": "gz-launch8_8.0.1",
"hash": "sha256-el+4sVBOmeBj8VJqKut8pIhVJeyEyodrt6titunbBF0="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-math.git",
"rev": "gz-math8_8.1.1",
"hash": "sha256-E7u3EtpqNLvcqI5ycezwwAlbVHM3JdqeyLFWYlEaOYo="
"gz_math_vendor": {
"url": "https://github.com/gazebosim/gz-math.git",
"rev": "gz-math8_8.1.1",
"hash": "sha256-E7u3EtpqNLvcqI5ycezwwAlbVHM3JdqeyLFWYlEaOYo="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-msgs.git",
"rev": "gz-msgs11_11.0.2",
"hash": "sha256-PUhFOmVPRiOVWfOjAU8z8dcxKPdcoTrgRwDGXP/vsUs="
"gz_msgs_vendor": {
"url": "https://github.com/gazebosim/gz-msgs.git",
"rev": "gz-msgs11_11.0.2",
"hash": "sha256-PUhFOmVPRiOVWfOjAU8z8dcxKPdcoTrgRwDGXP/vsUs="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/OGRECave/ogre-next.git",
"rev": "v2.3.3",
"hash": "sha256-elSj35LwsLzj1ssDPsk9NW/KSXfiOGYmw9hQSAWdpFM="
"gz_ogre_next_vendor": {
"url": "https://github.com/OGRECave/ogre-next.git",
"rev": "v2.3.3",
"hash": "sha256-elSj35LwsLzj1ssDPsk9NW/KSXfiOGYmw9hQSAWdpFM="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-physics.git",
"rev": "gz-physics8_8.1.0",
"hash": "sha256-FnVKVbPCn3B6/sZKiPJqUjUgVilwoeP/H97eg/dirz8="
"gz_physics_vendor": {
"url": "https://github.com/gazebosim/gz-physics.git",
"rev": "gz-physics8_8.1.0",
"hash": "sha256-FnVKVbPCn3B6/sZKiPJqUjUgVilwoeP/H97eg/dirz8="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-plugin.git",
"rev": "gz-plugin3_3.0.1",
"hash": "sha256-7v6fzylJ4R1uoyQFM+eyl2/bXVy5MGC5dPjS7/taB8U="
"gz_plugin_vendor": {
"url": "https://github.com/gazebosim/gz-plugin.git",
"rev": "gz-plugin3_3.0.1",
"hash": "sha256-7v6fzylJ4R1uoyQFM+eyl2/bXVy5MGC5dPjS7/taB8U="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-rendering.git",
"rev": "gz-rendering9_9.1.0",
"hash": "sha256-L2xkd93zhXtvbbzRrdjsoxbDtopp/RpcWBh1tfGvLeM="
"gz_rendering_vendor": {
"url": "https://github.com/gazebosim/gz-rendering.git",
"rev": "gz-rendering9_9.1.0",
"hash": "sha256-L2xkd93zhXtvbbzRrdjsoxbDtopp/RpcWBh1tfGvLeM="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-sensors.git",
"rev": "gz-sensors9_9.1.0",
"hash": "sha256-dMqJqp5229r/mKjBzUJD/tEbsYZANAFNycHYc7CIkz8="
"gz_sensors_vendor": {
"url": "https://github.com/gazebosim/gz-sensors.git",
"rev": "gz-sensors9_9.1.0",
"hash": "sha256-dMqJqp5229r/mKjBzUJD/tEbsYZANAFNycHYc7CIkz8="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-sim.git",
"rev": "gz-sim9_9.1.0",
"hash": "sha256-niVXuqMvEhwCW2NcrEhIChh3DsD2M8ZTspDi+zF0kBc="
"gz_sim_vendor": {
"url": "https://github.com/gazebosim/gz-sim.git",
"rev": "gz-sim9_9.1.0",
"hash": "sha256-niVXuqMvEhwCW2NcrEhIChh3DsD2M8ZTspDi+zF0kBc="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-tools.git",
"rev": "gz-tools2_2.0.2",
"hash": "sha256-CY+W1jWIkszKwKuLgKmJpZMXHn0RnueMHFSDhOXIzLg="
"gz_tools_vendor": {
"url": "https://github.com/gazebosim/gz-tools.git",
"rev": "gz-tools2_2.0.2",
"hash": "sha256-CY+W1jWIkszKwKuLgKmJpZMXHn0RnueMHFSDhOXIzLg="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-transport.git",
"rev": "gz-transport14_14.0.1",
"hash": "sha256-pSoadkpVaAEswmZuK13Y7PhxgvzTK1G2wI5+Fomlm/o="
"gz_transport_vendor": {
"url": "https://github.com/gazebosim/gz-transport.git",
"rev": "gz-transport14_14.0.1",
"hash": "sha256-pSoadkpVaAEswmZuK13Y7PhxgvzTK1G2wI5+Fomlm/o="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/gz-utils.git",
"rev": "gz-utils3_3.1.1",
"hash": "sha256-fYzysdB608jfMb/EbqiGD4hXmPxcaVTUrt9Wx0dBlto="
"gz_utils_vendor": {
"url": "https://github.com/gazebosim/gz-utils.git",
"rev": "gz-utils3_3.1.1",
"hash": "sha256-fYzysdB608jfMb/EbqiGD4hXmPxcaVTUrt9Wx0dBlto="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/OGRECave/ogre.git",
"rev": "v1.12.10",
"hash": "sha256-Z0ixdSmkV93coBBVZ5R3lPLfVMXRfWsFz/RsSyqPWFY="
"ogre_vendor": {
"url": "https://github.com/OGRECave/ogre.git",
"rev": "v1.12.10",
"hash": "sha256-Z0ixdSmkV93coBBVZ5R3lPLfVMXRfWsFz/RsSyqPWFY="
}
}

View file

@ -1,5 +1,7 @@
{
"url": "https://github.com/gazebosim/sdformat.git",
"rev": "sdformat15_15.2.0",
"hash": "sha256-RarpOKoJ9w+yJw5HU5exZYjx1zVdtkE05+8PBADhOwY="
"sdformat_vendor": {
"url": "https://github.com/gazebosim/sdformat.git",
"rev": "sdformat15_15.2.0",
"hash": "sha256-RarpOKoJ9w+yJw5HU5exZYjx1zVdtkE05+8PBADhOwY="
}
}

View file

@ -23,7 +23,6 @@ rosSelf: rosSuper: with rosSelf.lib; {
# to worry about collisions with system packages and Nix tooling generally
# expects standard directories.
postPatch = postPatch + ''
ls -l cmake/templates
substituteInPlace cmake/ament_vendor.cmake \
--replace-fail 'opt/''${PROJECT_NAME}' .
substituteInPlace cmake/templates/vendor_package.dsv.in \
@ -35,6 +34,23 @@ rosSelf: rosSuper: with rosSelf.lib; {
'';
});
# Version of ament-cmake-vendor-package for use in Nix build sandbox
# without network access. The unwrapped version is still useful in
# e.g. nix-shell.
ament-cmake-vendor-package-wrapped = rosSelf.ament-cmake-vendor-package.overrideAttrs ({
postPatch ? "", ...
}: {
postPatch = postPatch + ''
# Rename the macro so that we can wrap it with our wrapper
substituteInPlace cmake/ament_vendor.cmake \
--replace-fail 'macro(ament_vendor TARGET_NAME)' 'macro(ament_vendor_orig TARGET_NAME)'
cp ${./ament_vendor_wrapper.cmake} ament_vendor_wrapper.cmake
# Add our wrapper to the list of cmake files
substituteInPlace CMakeLists.txt \
--replace-fail 'CONFIG_EXTRAS' 'CONFIG_EXTRAS "ament_vendor_wrapper.cmake"'
'';
});
backward-ros = rosSuper.backward-ros.overrideAttrs ({ postPatch ? "", ... }: {
# The `--as-needed` flag directs the linker to search all libraries specified

View file

@ -1,32 +0,0 @@
# CMake package that defines alternative version of ament_vendor macro
# to extract information about vendored source to
# vendored-source.json. Normally, the ament_vendor macro is defined in
# the ament_cmake_vendor_package and it downloads the vendored source
# code at compile time. This is not possible with Nix, because Nix
# builds packages without network access. Therefore, we inject this
# alternative macro to cmake at update time and it extracts the
# information needed by Nix to download the source code. The main
# entry point to all this functionality is in the patchAmentVendorGit
# function.
if(NOT ament_cmake_vendor_package_FIND_QUIETLY)
message(STATUS "Found ament_cmake_vendor_package: Dummy version for Nix patching (${ament_cmake_vendor_package_DIR})")
endif()
find_program(JQ jq)
find_program(NIX_PREFETCH_GIT nix-prefetch-git)
macro(ament_vendor TARGET_NAME)
cmake_parse_arguments(_ARG "GLOBAL_HOOK;SKIP_INSTALL" "SOURCE_SUBDIR;VCS_TYPE;VCS_URL;VCS_VERSION;SATISFIED" "CMAKE_ARGS;PATCHES" ${ARGN})
if(_ARG_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "ament_vendor() called with unused arguments: "
"${_ARG_UNPARSED_ARGUMENTS}")
endif()
execute_process(
COMMAND ${NIX_PREFETCH_GIT} --url ${_ARG_VCS_URL} --rev ${_ARG_VCS_VERSION}
COMMAND ${JQ} "{url: \"${_ARG_VCS_URL}\", rev: \"${_ARG_VCS_VERSION}\", hash: .hash}"
OUTPUT_FILE ${CMAKE_BINARY_DIR}/vendored-source.json
COMMAND_ECHO STDOUT
COMMAND_ERROR_IS_FATAL ANY)
endmacro()

View file

@ -85,56 +85,67 @@
fetchgitArgs ? {},
tarSourceArgs ? {}
}: pkg.overrideAttrs ({
cmakeFlags ? [],
nativeBuildInputs ? [],
passthru ? {},
postPatch ? "", ...
}: let
# Make sure that non-existence of vendored-source.json file
# doesn't cause eval errors. This would break automatic updates.
vendoredSourceJson = "${dirOf pkg.meta.position}/vendored-source.json";
inherit (builtins) stringLength substring pathExists;
inherit (builtins) stringLength substring pathExists mapAttrs attrValues;
nameStart = 5 + stringLength pkg.rosDistro; # e.g. ros-jazzy- => 10
attr = substring nameStart (-1) pkg.pname;
errMsg = ''
error: File ${vendoredSourceJson} missing.
Run "$(nix-build -A rosPackages.${pkg.rosDistro}.${attr}.updateAmentVendor)" to create it.
'';
sourceInfo = builtins.fromJSON (builtins.readFile vendoredSourceJson);
sourceInfos = builtins.fromJSON (builtins.readFile vendoredSourceJson);
# ament_vendor doesn't allow patches for path inputs, so we have to pack it
# into a tar first. Additionally, vcstool only accepts tarballs with the
# version number as the root directory name.
vendor = lib.tarSource tarSourceArgs (
vendor = sourceInfo: lib.tarSource tarSourceArgs (
self.fetchgit (sourceInfo // fetchgitArgs // {
name = sourceInfo.rev;
}));
in {
# CMake ExternalProject patches are applied with git apply
nativeBuildInputs = nativeBuildInputs ++ [ self.git ];
postPatch = (if pathExists vendoredSourceJson then ''
sed -i '\|VCS_URL\s*|c\
VCS_URL "file://${vendor}"\
VCS_TYPE tar' \
${lib.escapeShellArg file}
'' else ''
echo >&2 ${lib.escapeShellArg errMsg}
exit 1
'') + postPatch;
nativeBuildInputs = [
# Prepend wrapped ament_vendor to be found by CMake before the
# unwrapped one
rosSelf.ament-cmake-vendor-package-wrapped
] ++ nativeBuildInputs ++ [
# CMake ExternalProject patches are applied with git apply
self.git
];
cmakeFlags = cmakeFlags ++ lib.optionals (pathExists vendoredSourceJson)
(
# Tell ament_vendor_wrapper.cmake where to find tarballs with vendored sources
attrValues (mapAttrs (n: v: "-DAMENT_VENDOR_NIX_TAR_${n}=${vendor v}") sourceInfos)
);
postPatch =
if pathExists vendoredSourceJson then
postPatch
else ''
echo >&2 ${lib.escapeShellArg errMsg}
exit 1
'';
passthru = passthru // {
# Script to automatically update vendored-source.json by running
# CMake with injected modified version of ament_cmake macro.
updateAmentVendor = let
source = self.srcOnly pkg;
sourceDrvPath = builtins.unsafeDiscardOutputDependency source.drvPath;
amentVendorNix = self.runCommand "ament_cmake_vendor_package_nix" {} ''
install -D ${./ament_cmake_vendor_packageConfig.cmake} $out/ament_cmake_vendor_packageConfig.cmake
'';
updateScript = self.writeShellScript "ament-vendor-update.sh" ''
set -eo pipefail
cd "$(${self.coreutils}/bin/mktemp -d)"
trap "${self.coreutils}/bin/rm -rf '$PWD'" SIGINT SIGTERM ERR EXIT
source "$stdenv/setup"
export NIX_SSL_CERT_FILE="${self.cacert}/etc/ssl/certs/ca-bundle.crt"
# Inject our version of ament_cmake_vendor_package
export PATH="${lib.makeBinPath (with self; [ nix-prefetch-git jq ])}:$PATH"
export CMAKE_PREFIX_PATH=${amentVendorNix}
export PATH="${lib.makeBinPath (with self; [ nix-prefetch-git jq nix ])}:$PATH"
# Ask CMake to generate vendored-source.json
export CMAKE_PREFIX_PATH=${rosSelf.ament-cmake-vendor-package-wrapped}
cmakeFlags+='-DAMENT_VENDOR_NIX_PREFETCH=ON'
phases="''${prePhases[*]:-} unpackPhase patchPhase ''${preConfigurePhases[*]:-} configurePhase ''${preBuildPhases[*]:-}" \
genericBuild
# Copy the resulting data to package source directory

View file

@ -10,10 +10,18 @@ set -euo pipefail
# Run it from the top-level directory of this repo, i.e.,
# ./maintainers/scripts/update-ament-vendor.sh
# TODO: Remove after nixos-24.11 EOL
if nix-eval-jobs --show-input-drvs --expr null >/dev/null; then
# Needed since v2.26.0
nix_eval_jobs="nix-eval-jobs --show-input-drvs"
else
nix_eval_jobs="nix-eval-jobs"
fi
# Find potential candidates for updating
candidates=$(
# Extract all rosPackages (ignoring eval errors)
nix-eval-jobs --expr '(import ./. {}).rosPackages' |
$nix_eval_jobs --expr '(import ./. {}).rosPackages' |
# Select only packages that depend on ament-cmake-vendor-package
jq -r 'select(.inputDrvs|objects|keys|any(contains("ament-cmake-vendor-package"))).attr')