mirror of
https://github.com/lopsided98/nix-ros-overlay.git
synced 2025-06-09 17:42:22 +03:00
Update patchAmentVendorGit to use automatically extracted information about vendored source
The information is stored in vendored-source.json files in the package directories. The file can be automatically generated by running command like this: $(nix-build -A rosPackages.jazzy.gz-math-vendor.updateAmentVendor)' This command executes Cmake for the given package with an alternative implementation of the ament_vendor Cmake macro, which generates the file instead of fetching the source code. The above command generates `distros/jazzy/gz-math-vendor/vendored-source.json` files with this content: { "url": "https://github.com/gazebosim/gz-math.git", "rev": "gz-math7_7.5.2", "hash": "sha256-LwYeyv8nwX06n5ju+ra2uqNMedMSLRumem8qDHXtNns=" } patchAmentVendorGit function is updated to pick the information about patching from that file instead of from its arguments. patchGzAmentVendorGit is updated similarly and the check for version mismatch is removed, because it would not work (version information is not available from function arguments) and more importantly, it is (hopefully) no longer needed, because the version will always be updated automatically by CI.
This commit is contained in:
parent
693deec830
commit
0ecce1a1b5
4 changed files with 119 additions and 182 deletions
|
@ -42,36 +42,20 @@ in {
|
|||
fetchgitArgs.hash = "sha256-gztnxui9Fe/FTieMjdvfJjWHjkImtlsHn6fM1FruyME=";
|
||||
};
|
||||
|
||||
gz-cmake-vendor = lib.patchGzAmentVendorGit rosSuper.gz-cmake-vendor {
|
||||
version = "3.5.4";
|
||||
hash = "sha256-mP0bBPWWAoUFsUwKn95Eqv1lW3lJdPEu3hhfmiK3mNQ=";
|
||||
};
|
||||
gz-cmake-vendor = lib.patchGzAmentVendorGit rosSuper.gz-cmake-vendor { };
|
||||
|
||||
gz-common-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-common-vendor {
|
||||
version = "5.7.1";
|
||||
hash = "sha256-vNCjCSQYCSUHXKwXnq8vwWXiSK2+cD3yPSLT1FdAWrE=";
|
||||
}).overrideAttrs ({
|
||||
gz-common-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-common-vendor { }).overrideAttrs ({
|
||||
nativeBuildInputs ? [], ...
|
||||
}: {
|
||||
# https://github.com/gazebo-release/gz_common_vendor/pull/2
|
||||
nativeBuildInputs = nativeBuildInputs ++ [ self.pkg-config ];
|
||||
});
|
||||
|
||||
gz-dartsim-vendor = lib.patchAmentVendorGit rosSuper.gz-dartsim-vendor {
|
||||
url = "https://github.com/dartsim/dart.git";
|
||||
rev = "v6.13.2";
|
||||
fetchgitArgs.hash = "sha256-AfKPqUiW6BsM98TIzTY2ZcFP1WvURs8/dGOzanIiB9g=";
|
||||
};
|
||||
gz-dartsim-vendor = lib.patchAmentVendorGit rosSuper.gz-dartsim-vendor { };
|
||||
|
||||
gz-fuel-tools-vendor = lib.patchGzAmentVendorGit rosSuper.gz-fuel-tools-vendor {
|
||||
version = "9.1.1";
|
||||
hash = "sha256-XQoBcCtzwzzPypS1kIeTCIbjtxrzaW3JvZLCYbwXAOk=";
|
||||
};
|
||||
gz-fuel-tools-vendor = lib.patchGzAmentVendorGit rosSuper.gz-fuel-tools-vendor { };
|
||||
|
||||
gz-gui-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-gui-vendor {
|
||||
version = "8.4.0";
|
||||
hash = "sha256-gf9XZzAX2g6r9ThIA0v2H2X/+uu9VnwvyvrdL5ZazM0=";
|
||||
}).overrideAttrs ({
|
||||
gz-gui-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-gui-vendor { }).overrideAttrs ({
|
||||
postInstall ? "", ...
|
||||
}: {
|
||||
# "RPATH of binary libGrid3D.so contains a forbidden reference to
|
||||
|
@ -81,58 +65,27 @@ in {
|
|||
'';
|
||||
});
|
||||
|
||||
gz-launch-vendor = lib.patchGzAmentVendorGit rosSuper.gz-launch-vendor {
|
||||
version = "7.1.1";
|
||||
hash = "sha256-S63DWe/c3cnEztxr3uJc0A4AmuiQk4o6m9yXj0X97Yk=";
|
||||
};
|
||||
gz-launch-vendor = lib.patchGzAmentVendorGit rosSuper.gz-launch-vendor { };
|
||||
|
||||
gz-math-vendor = lib.patchGzAmentVendorGit rosSuper.gz-math-vendor {
|
||||
version = "7.5.2";
|
||||
hash = "sha256-LwYeyv8nwX06n5ju+ra2uqNMedMSLRumem8qDHXtNns=";
|
||||
};
|
||||
gz-math-vendor = lib.patchGzAmentVendorGit rosSuper.gz-math-vendor { };
|
||||
|
||||
gz-msgs-vendor = lib.patchGzAmentVendorGit rosSuper.gz-msgs-vendor {
|
||||
version = "10.3.2";
|
||||
hash = "sha256-gxhRqLzBCaDmK67T5RryDpxbDR3WLgV9DFs7w6ieMxQ=";
|
||||
};
|
||||
gz-msgs-vendor = lib.patchGzAmentVendorGit rosSuper.gz-msgs-vendor { };
|
||||
|
||||
gz-ogre-next-vendor = (lib.patchAmentVendorGit rosSuper.gz-ogre-next-vendor {
|
||||
url = "https://github.com/OGRECave/ogre-next.git";
|
||||
rev = "v2.3.3";
|
||||
fetchgitArgs.hash = "sha256-elSj35LwsLzj1ssDPsk9NW/KSXfiOGYmw9hQSAWdpFM=";
|
||||
}).overrideAttrs({ ... }: {
|
||||
gz-ogre-next-vendor = (lib.patchAmentVendorGit rosSuper.gz-ogre-next-vendor { }).overrideAttrs({ ... }: {
|
||||
dontFixCmake = true;
|
||||
});
|
||||
|
||||
gz-physics-vendor = lib.patchGzAmentVendorGit rosSuper.gz-physics-vendor {
|
||||
version = "7.5.0";
|
||||
hash = "sha256-75myTqDeEybvj5rsJxRambLPle1cen6HIatZGbVoXro=";
|
||||
};
|
||||
gz-physics-vendor = lib.patchGzAmentVendorGit rosSuper.gz-physics-vendor { };
|
||||
|
||||
gz-plugin-vendor = lib.patchGzAmentVendorGit rosSuper.gz-plugin-vendor {
|
||||
version = "2.0.4";
|
||||
hash = "sha256-iL4+EdFFAU55FVqE/CvyTv1zNaXxBWqWx44L0BeG2MU=";
|
||||
};
|
||||
gz-plugin-vendor = lib.patchGzAmentVendorGit rosSuper.gz-plugin-vendor { };
|
||||
|
||||
gz-rendering-vendor = lib.patchGzAmentVendorGit rosSuper.gz-rendering-vendor {
|
||||
version = "8.2.2";
|
||||
hash = "sha256-x+QHn8d+19U12CG1+HEmP0KcM3beY00Vvrc8mrxvAs0=";
|
||||
};
|
||||
gz-rendering-vendor = lib.patchGzAmentVendorGit rosSuper.gz-rendering-vendor { };
|
||||
|
||||
gz-sensors-vendor = lib.patchGzAmentVendorGit rosSuper.gz-sensors-vendor {
|
||||
version = "8.2.2";
|
||||
hash = "sha256-TRDMCMesJXVSVGA3bnRngtXTi4VVf0y12AJQ79EEMiI=";
|
||||
};
|
||||
gz-sensors-vendor = lib.patchGzAmentVendorGit rosSuper.gz-sensors-vendor { };
|
||||
|
||||
gz-sim-vendor = lib.patchGzAmentVendorGit rosSuper.gz-sim-vendor {
|
||||
version = "8.9.0";
|
||||
hash = "sha256-hvhq2XBzcIoupJdJyJzk38LDXoEnd9iBCCiXvPZsPqY=";
|
||||
};
|
||||
gz-sim-vendor = lib.patchGzAmentVendorGit rosSuper.gz-sim-vendor { };
|
||||
|
||||
gz-tools-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-tools-vendor {
|
||||
version = "2.0.2";
|
||||
hash = "sha256-CY+W1jWIkszKwKuLgKmJpZMXHn0RnueMHFSDhOXIzLg=";
|
||||
}).overrideAttrs({
|
||||
gz-tools-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-tools-vendor { }).overrideAttrs({
|
||||
nativeBuildInputs ? [],
|
||||
propagatedNativeBuildInputs ? [],
|
||||
qtWrapperArgs ? [],
|
||||
|
@ -154,19 +107,13 @@ in {
|
|||
'';
|
||||
});
|
||||
|
||||
gz-transport-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-transport-vendor {
|
||||
version = "13.4.1";
|
||||
hash = "sha256-hCP+yVoyl1c3KNmQ5jKrYvPT1IlAy9JkCh0c0mOF+KM=";
|
||||
}).overrideAttrs({
|
||||
gz-transport-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-transport-vendor { }).overrideAttrs({
|
||||
buildInputs ? [], ...
|
||||
}: {
|
||||
buildInputs = buildInputs ++ [ self.libsodium ];
|
||||
});
|
||||
|
||||
gz-utils-vendor = lib.patchGzAmentVendorGit rosSuper.gz-utils-vendor {
|
||||
version = "2.2.1";
|
||||
hash = "sha256-utVW8pTP/emEWblTxVb6jzulKdxss+2VfS552MWMqm4=";
|
||||
};
|
||||
gz-utils-vendor = lib.patchGzAmentVendorGit rosSuper.gz-utils-vendor { };
|
||||
|
||||
iceoryx-hoofs = rosSuper.iceoryx-hoofs.overrideAttrs ({
|
||||
patches ? [], ...
|
||||
|
@ -222,9 +169,6 @@ in {
|
|||
});
|
||||
|
||||
rviz-ogre-vendor = lib.patchAmentVendorGit rosSuper.rviz-ogre-vendor {
|
||||
url = "https://github.com/OGRECave/ogre.git";
|
||||
rev = "v1.12.10";
|
||||
fetchgitArgs.hash = "sha256-Z0ixdSmkV93coBBVZ5R3lPLfVMXRfWsFz/RsSyqPWFY=";
|
||||
tarSourceArgs.hook = let
|
||||
version = "1.79";
|
||||
imgui = self.fetchFromGitHub rec {
|
||||
|
@ -255,10 +199,7 @@ in {
|
|||
sha256 = "sha256-TyFt3d78GidhDGD17KgjAaZl/qvAcGJP8lmu4EOxpYg=";
|
||||
};
|
||||
|
||||
sdformat-vendor = lib.patchGzAmentVendorGit rosSuper.sdformat-vendor {
|
||||
version = "14.7.0";
|
||||
hash = "sha256-p2e01bCoMpDhia1yOFa5wIP2ritBiWNT5jYbp/bg1+g=";
|
||||
};
|
||||
sdformat-vendor = lib.patchGzAmentVendorGit rosSuper.sdformat-vendor { };
|
||||
|
||||
urdfdom = rosSuper.urdfdom.overrideAttrs ({
|
||||
patches ? [], ...
|
||||
|
|
|
@ -42,36 +42,20 @@ in {
|
|||
fetchgitArgs.hash = "sha256-gztnxui9Fe/FTieMjdvfJjWHjkImtlsHn6fM1FruyME=";
|
||||
};
|
||||
|
||||
gz-cmake-vendor = lib.patchGzAmentVendorGit rosSuper.gz-cmake-vendor {
|
||||
version = "4.1.1";
|
||||
hash = "sha256-BWgRm+3UW65Cu7TqXtFFG05JlYF52dbpAsIE8aDnJM0=";
|
||||
};
|
||||
gz-cmake-vendor = lib.patchGzAmentVendorGit rosSuper.gz-cmake-vendor { };
|
||||
|
||||
gz-common-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-common-vendor {
|
||||
version = "6.0.0";
|
||||
hash = "sha256-Oo4dGN2vsVaElKf/KYjjJq6tlYLRPr0/uh6urGxvDdc=";
|
||||
}).overrideAttrs ({
|
||||
gz-common-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-common-vendor { }).overrideAttrs ({
|
||||
nativeBuildInputs ? [], ...
|
||||
}: {
|
||||
# https://github.com/gazebo-release/gz_common_vendor/pull/2
|
||||
nativeBuildInputs = nativeBuildInputs ++ [ self.pkg-config ];
|
||||
});
|
||||
|
||||
gz-dartsim-vendor = lib.patchAmentVendorGit rosSuper.gz-dartsim-vendor {
|
||||
url = "https://github.com/dartsim/dart.git";
|
||||
rev = "v6.13.2";
|
||||
fetchgitArgs.hash = "sha256-AfKPqUiW6BsM98TIzTY2ZcFP1WvURs8/dGOzanIiB9g=";
|
||||
};
|
||||
gz-dartsim-vendor = lib.patchAmentVendorGit rosSuper.gz-dartsim-vendor { };
|
||||
|
||||
gz-fuel-tools-vendor = lib.patchGzAmentVendorGit rosSuper.gz-fuel-tools-vendor {
|
||||
version = "10.0.0";
|
||||
hash = "sha256-9WskZnci7D09aW32lzmdtlhRBM+hcmhG6iNgf3OC1js=";
|
||||
};
|
||||
gz-fuel-tools-vendor = lib.patchGzAmentVendorGit rosSuper.gz-fuel-tools-vendor { };
|
||||
|
||||
gz-gui-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-gui-vendor {
|
||||
version = "9.0.0";
|
||||
hash = "sha256-/YJW6XmdGwbyd5Nx3wcTqnRlpwE1unVGaNX91qfZmiM=";
|
||||
}).overrideAttrs ({
|
||||
gz-gui-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-gui-vendor { }).overrideAttrs ({
|
||||
postInstall ? "", ...
|
||||
}: {
|
||||
# "RPATH of binary libGrid3D.so contains a forbidden reference to
|
||||
|
@ -81,58 +65,27 @@ in {
|
|||
'';
|
||||
});
|
||||
|
||||
gz-launch-vendor = lib.patchGzAmentVendorGit rosSuper.gz-launch-vendor {
|
||||
version = "8.0.0";
|
||||
hash = "sha256-K2W2SSlhJvF9mxEMNa7tZa3/3/LIvxZMGeVb0Mi6Vso=";
|
||||
};
|
||||
gz-launch-vendor = lib.patchGzAmentVendorGit rosSuper.gz-launch-vendor { };
|
||||
|
||||
gz-math-vendor = lib.patchGzAmentVendorGit rosSuper.gz-math-vendor {
|
||||
version = "8.1.0";
|
||||
hash = "sha256-3jQk98HJ0ru2Q4fTqoiaPRaIHaWQKQlnqj+gN2PLxkE=";
|
||||
};
|
||||
gz-math-vendor = lib.patchGzAmentVendorGit rosSuper.gz-math-vendor { };
|
||||
|
||||
gz-msgs-vendor = lib.patchGzAmentVendorGit rosSuper.gz-msgs-vendor {
|
||||
version = "11.0.2";
|
||||
hash = "sha256-PUhFOmVPRiOVWfOjAU8z8dcxKPdcoTrgRwDGXP/vsUs=";
|
||||
};
|
||||
gz-msgs-vendor = lib.patchGzAmentVendorGit rosSuper.gz-msgs-vendor { };
|
||||
|
||||
gz-ogre-next-vendor = (lib.patchAmentVendorGit rosSuper.gz-ogre-next-vendor {
|
||||
url = "https://github.com/OGRECave/ogre-next.git";
|
||||
rev = "v2.3.3";
|
||||
fetchgitArgs.hash = "sha256-elSj35LwsLzj1ssDPsk9NW/KSXfiOGYmw9hQSAWdpFM=";
|
||||
}).overrideAttrs({ ... }: {
|
||||
gz-ogre-next-vendor = (lib.patchAmentVendorGit rosSuper.gz-ogre-next-vendor { }).overrideAttrs({ ... }: {
|
||||
dontFixCmake = true;
|
||||
});
|
||||
|
||||
gz-physics-vendor = lib.patchGzAmentVendorGit rosSuper.gz-physics-vendor {
|
||||
version = "8.0.0";
|
||||
hash = "sha256-PjwrJG3xvRYrkHDTaBUgoaW8NglEYDPuJrk4QjJjTHU=";
|
||||
};
|
||||
gz-physics-vendor = lib.patchGzAmentVendorGit rosSuper.gz-physics-vendor { };
|
||||
|
||||
gz-plugin-vendor = lib.patchGzAmentVendorGit rosSuper.gz-plugin-vendor {
|
||||
version = "3.0.0";
|
||||
hash = "sha256-h2Dx0KcFmJlS67q0v1zbd9nQkTCKgHkxt5KKTT5v+fw=";
|
||||
};
|
||||
gz-plugin-vendor = lib.patchGzAmentVendorGit rosSuper.gz-plugin-vendor { };
|
||||
|
||||
gz-rendering-vendor = lib.patchGzAmentVendorGit rosSuper.gz-rendering-vendor {
|
||||
version = "9.0.0";
|
||||
hash = "sha256-e3OPLeqV6OgjnQrbpwRj59e7Z0BqN2wOee/gAaMHfqU=";
|
||||
};
|
||||
gz-rendering-vendor = lib.patchGzAmentVendorGit rosSuper.gz-rendering-vendor { };
|
||||
|
||||
gz-sensors-vendor = lib.patchGzAmentVendorGit rosSuper.gz-sensors-vendor {
|
||||
version = "9.0.0";
|
||||
hash = "sha256-8Ato7/YRL7JebbVPASD6VF9lf/Uyq26MIg2l+jQ4GDk=";
|
||||
};
|
||||
gz-sensors-vendor = lib.patchGzAmentVendorGit rosSuper.gz-sensors-vendor { };
|
||||
|
||||
gz-sim-vendor = lib.patchGzAmentVendorGit rosSuper.gz-sim-vendor {
|
||||
version = "9.0.0";
|
||||
hash = "sha256-gsWKknqcTiJc4YHIkmg1YGItwHG1As2OUnpPBQIwqj8=";
|
||||
};
|
||||
gz-sim-vendor = lib.patchGzAmentVendorGit rosSuper.gz-sim-vendor { };
|
||||
|
||||
gz-tools-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-tools-vendor {
|
||||
version = "2.0.2";
|
||||
hash = "sha256-CY+W1jWIkszKwKuLgKmJpZMXHn0RnueMHFSDhOXIzLg=";
|
||||
}).overrideAttrs({
|
||||
gz-tools-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-tools-vendor { }).overrideAttrs({
|
||||
nativeBuildInputs ? [],
|
||||
propagatedNativeBuildInputs ? [],
|
||||
qtWrapperArgs ? [],
|
||||
|
@ -154,19 +107,13 @@ in {
|
|||
'';
|
||||
});
|
||||
|
||||
gz-transport-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-transport-vendor {
|
||||
version = "14.0.0";
|
||||
hash = "sha256-zoGphy2cpmqJsnyS1LNVm4eGtHCWkAwIblga4RdVj4k=";
|
||||
}).overrideAttrs({
|
||||
gz-transport-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-transport-vendor { }).overrideAttrs({
|
||||
buildInputs ? [], ...
|
||||
}: {
|
||||
buildInputs = buildInputs ++ [ self.libsodium ];
|
||||
});
|
||||
|
||||
gz-utils-vendor = lib.patchGzAmentVendorGit rosSuper.gz-utils-vendor {
|
||||
version = "3.1.0";
|
||||
hash = "sha256-pbbFO/4h3Tos+uigPC8XHWzv+Yuyd6EdzLWQPdmXaN8=";
|
||||
};
|
||||
gz-utils-vendor = lib.patchGzAmentVendorGit rosSuper.gz-utils-vendor { };
|
||||
|
||||
iceoryx-hoofs = rosSuper.iceoryx-hoofs.overrideAttrs ({
|
||||
patches ? [], ...
|
||||
|
@ -229,9 +176,6 @@ in {
|
|||
};
|
||||
|
||||
rviz-ogre-vendor = lib.patchAmentVendorGit rosSuper.rviz-ogre-vendor {
|
||||
url = "https://github.com/OGRECave/ogre.git";
|
||||
rev = "v1.12.10";
|
||||
fetchgitArgs.hash = "sha256-Z0ixdSmkV93coBBVZ5R3lPLfVMXRfWsFz/RsSyqPWFY=";
|
||||
tarSourceArgs.hook = let
|
||||
version = "1.79";
|
||||
imgui = self.fetchFromGitHub rec {
|
||||
|
@ -257,10 +201,7 @@ in {
|
|||
'';
|
||||
});
|
||||
|
||||
sdformat-vendor = lib.patchGzAmentVendorGit rosSuper.sdformat-vendor {
|
||||
version = "15.1.1";
|
||||
hash = "sha256-4/0pVaev++v0+wHQiGeTl8XtTDzh2li32dND0EjfjwA=";
|
||||
};
|
||||
sdformat-vendor = lib.patchGzAmentVendorGit rosSuper.sdformat-vendor { };
|
||||
|
||||
shared-queues-vendor = lib.patchVendorUrl rosSuper.shared-queues-vendor {
|
||||
url = "https://github.com/cameron314/readerwriterqueue/archive/ef7dfbf553288064347d51b8ac335f1ca489032a.zip";
|
||||
|
|
32
lib/ament_cmake_vendor_packageConfig.cmake
Normal file
32
lib/ament_cmake_vendor_packageConfig.cmake
Normal file
|
@ -0,0 +1,32 @@
|
|||
# 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()
|
|
@ -81,51 +81,80 @@
|
|||
# Patch a vendored download that uses ament_vendor() with a Git repo as the
|
||||
# source.
|
||||
patchAmentVendorGit = pkg: {
|
||||
url,
|
||||
originalUrl ? url,
|
||||
rev, # Must correspond to the VCS_VERSION argument
|
||||
file ? "CMakeLists.txt",
|
||||
fetchgitArgs ? {},
|
||||
tarSourceArgs ? {}
|
||||
}: pkg.overrideAttrs ({
|
||||
nativeBuildInputs ? [],
|
||||
passthru ? {},
|
||||
postPatch ? "", ...
|
||||
}: let
|
||||
vendoredSourceJson = "${dirOf pkg.meta.position}/vendored-source.json";
|
||||
inherit (builtins) stringLength substring pathExists;
|
||||
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);
|
||||
# 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 (self.fetchgit (fetchgitArgs // {
|
||||
name = rev;
|
||||
inherit url rev;
|
||||
}));
|
||||
vendor = lib.tarSource tarSourceArgs (
|
||||
self.fetchgit (sourceInfo // fetchgitArgs // {
|
||||
name = sourceInfo.rev;
|
||||
}));
|
||||
in {
|
||||
# CMake ExternalProject patches are applied with git apply
|
||||
nativeBuildInputs = nativeBuildInputs ++ [ self.git ];
|
||||
postPatch = ''
|
||||
sed -i '\|VCS_URL\s*${originalUrl}|c\
|
||||
postPatch = (if pathExists vendoredSourceJson then ''
|
||||
sed -i '\|VCS_URL\s*|c\
|
||||
VCS_URL "file://${vendor}"\
|
||||
VCS_TYPE tar' \
|
||||
${lib.escapeShellArg file}
|
||||
'' + postPatch;
|
||||
'' else ''
|
||||
echo >&2 ${lib.escapeShellArg errMsg}
|
||||
exit 1
|
||||
'') + postPatch;
|
||||
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}
|
||||
phases="''${prePhases[*]:-} unpackPhase patchPhase ''${preConfigurePhases[*]:-} configurePhase ''${preBuildPhases[*]:-}" \
|
||||
genericBuild
|
||||
# Copy the resulting data to package source directory
|
||||
cp -v vendored-source.json ${dirOf pkg.meta.position}
|
||||
'';
|
||||
in self.writeShellScript "update-${pkg.pname}" ''
|
||||
set -eo pipefail
|
||||
echo ============== Updating ${pkg.pname} ==============
|
||||
NIX_BUILD_SHELL=${self.runtimeShell} nix-shell --pure ${sourceDrvPath} --run ${updateScript}
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
# patchAmentVendorGit specialized for gz-*-vendor packages. In
|
||||
# addition to patching ament_vendor() calls, it adds a check to
|
||||
# CMakeLists.txt to detect upstream updates of the vendored package
|
||||
# version.
|
||||
# addition to patching ament_vendor() calls, it patches other things
|
||||
# in CMakeLists.txt.
|
||||
patchGzAmentVendorGit = pkg: {
|
||||
version,
|
||||
hash,
|
||||
tarSourceArgs ? {}
|
||||
}: let
|
||||
stem = lib.strings.removeSuffix "-vendor"
|
||||
(lib.strings.removePrefix "ros-${pkg.rosDistro}-" pkg.pname); # e.g. gz-cmake
|
||||
majorNum = lib.versions.major version;
|
||||
patchedPkg = lib.patchAmentVendorGit pkg {
|
||||
url = "https://github.com/gazebosim/${stem}.git";
|
||||
originalUrl = "https://github.com/gazebosim/\${GITHUB_NAME}.git";
|
||||
rev = "${stem}${majorNum}_${version}"; # e.g. "gz-cmake3_3.5.3"
|
||||
fetchgitArgs.hash = hash;
|
||||
inherit tarSourceArgs;
|
||||
};
|
||||
in patchedPkg.overrideAttrs ({
|
||||
|
@ -137,12 +166,6 @@
|
|||
--replace-fail 'opt/''${PROJECT_NAME}/extra_cmake' 'share/extra_cmake'
|
||||
substituteInPlace *-extras.cmake.in \
|
||||
--replace-fail 'opt/@PROJECT_NAME@/extra_cmake' 'share/extra_cmake'
|
||||
|
||||
cat >> CMakeLists.txt <<'EOF'
|
||||
if(NOT ''${LIB_VER} VERSION_EQUAL "${version}")
|
||||
message(FATAL_ERROR "Mismatch in ${pname} version (Nix: ${version}, upstream: ''${LIB_VER}). Fix this in overrides.nix.")
|
||||
endif()
|
||||
EOF
|
||||
'';
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue