[change] add patchAmentVendorGitZenoh function for patching zenoh CmakeLists.txt with multiple amend_vendor's

This commit is contained in:
Bernd Müller 2025-04-15 15:53:49 +02:00
parent 8ba64dc57b
commit 62dafbd09d
No known key found for this signature in database
GPG key ID: 93D117F0550F25C5
4 changed files with 35 additions and 3 deletions

View file

@ -255,7 +255,7 @@ in with lib; {
zenoh-cpp-url = "https://github.com/eclipse-zenoh/zenoh-cpp";
zenoh-cpp-rev = "bd4d741c6c4fa6509d8d745e22c3c50b4306bd65";
zenoh-cpp-hash = "sha256-OLNlew4pOLl1PRWrJTTfDv7LGYHGX0A7A4RW9jwCOsE=";
in (lib.patchAmentVendorGit (lib.patchAmentVendorGit rosSuper.zenoh-cpp-vendor {
in (lib.patchAmentVendorGitZenoh (lib.patchAmentVendorGitZenoh rosSuper.zenoh-cpp-vendor {
url = zenoh-cpp-url;
rev = zenoh-cpp-rev;
fetchgitArgs.hash = zenoh-cpp-hash;

View file

@ -258,7 +258,7 @@ in {
zenoh-cpp-url = "https://github.com/eclipse-zenoh/zenoh-cpp";
zenoh-cpp-rev = "8ad67f6c7a9031acd437c8739bbc8ddab0ca8173";
zenoh-cpp-hash = "sha256-0iRhmMtrhDdM7X0ByiICT4s7lDFcGLSR1dEImzT1mWs=";
in (lib.patchAmentVendorGit (lib.patchAmentVendorGit rosSuper.zenoh-cpp-vendor {
in (lib.patchAmentVendorGitZenoh (lib.patchAmentVendorGitZenoh rosSuper.zenoh-cpp-vendor {
url = zenoh-cpp-url;
rev = zenoh-cpp-rev;
fetchgitArgs.hash = zenoh-cpp-hash;

View file

@ -241,7 +241,7 @@ in {
zenoh-cpp-url = "https://github.com/eclipse-zenoh/zenoh-cpp";
zenoh-cpp-rev = "8ad67f6c7a9031acd437c8739bbc8ddab0ca8173";
zenoh-cpp-hash = "sha256-0iRhmMtrhDdM7X0ByiICT4s7lDFcGLSR1dEImzT1mWs=";
in (lib.patchAmentVendorGit (lib.patchAmentVendorGit rosSuper.zenoh-cpp-vendor {
in (lib.patchAmentVendorGitZenoh (lib.patchAmentVendorGitZenoh rosSuper.zenoh-cpp-vendor {
url = zenoh-cpp-url;
rev = zenoh-cpp-rev;
fetchgitArgs.hash = zenoh-cpp-hash;

View file

@ -78,6 +78,38 @@
'' + postPatch;
});
# Patch a vendored download that uses ament_vendor() with a Git repo as the
# source.
# older version only for zenoh because of multiple ament_vendor calls
patchAmentVendorGitZenoh = pkg: {
url,
originalUrl ? url,
rev, # Must correspond to the VCS_VERSION argument
file ? "CMakeLists.txt",
fetchgitArgs ? {},
tarSourceArgs ? {}
}: pkg.overrideAttrs ({
nativeBuildInputs ? [],
postPatch ? "", ...
}: let
# 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;
}));
in {
# CMake ExternalProject patches are applied with git apply
nativeBuildInputs = nativeBuildInputs ++ [ self.git ];
postPatch = ''
sed -i '\|VCS_URL\s*${originalUrl}|c\
VCS_URL "file://${vendor}"\
VCS_TYPE tar' \
${lib.escapeShellArg file}
'' + postPatch;
});
# Patch a vendored download that uses ament_vendor() with a Git repo as the
# source.
patchAmentVendorGit = pkg: {