patchExternalProjectGit: fail if URL or rev doesn't match

This catches when packages update their vendored version but we haven't
updated on our end. Try to fix all usages of patchExternalProjectGit so
they are correct now.
This commit is contained in:
Ben Wolsieffer 2024-07-23 22:22:37 -04:00
parent c7e6f7c7dd
commit 80b46d5263
8 changed files with 94 additions and 78 deletions

View file

@ -134,16 +134,6 @@ let
''; '';
}); });
novatel-oem7-driver = (patchExternalProjectGit rosSuper.novatel-oem7-driver {
url = "https://github.com/novatel/novatel_edie";
fetchgitArgs = {
rev = "d02ccc2dfe531d642c1e2ca8a8c0f8205c856f23";
hash = "sha256-ZQ7z9vQ8quI+SoNhB93tTw5LQe07UAKdbJJpaMj1C6I=";
};
}).overrideAttrs ({ ... }: {
dontFixCmake = true;
});
ompl = rosSuper.ompl.overrideAttrs ({ ompl = rosSuper.ompl.overrideAttrs ({
patches ? [], ... patches ? [], ...
}: { }: {
@ -381,11 +371,6 @@ let
''; '';
}); });
uncrustify-vendor = patchVendorUrl rosSuper.uncrustify-vendor {
url = "https://github.com/uncrustify/uncrustify/archive/uncrustify-0.68.1.tar.gz";
sha256 = "04ndwhcn9iv3cy4p5wgh5z0vx2sywqlydyympn9m3h5458w1aijh";
};
urdf = patchBoostPython rosSuper.urdf; urdf = patchBoostPython rosSuper.urdf;
}; };

View file

@ -26,10 +26,8 @@ rosSelf: rosSuper: with rosSelf.lib; {
mcap-vendor = patchExternalProjectGit (patchExternalProjectGit rosSuper.mcap-vendor { mcap-vendor = patchExternalProjectGit (patchExternalProjectGit rosSuper.mcap-vendor {
url = "https://github.com/foxglove/mcap.git"; url = "https://github.com/foxglove/mcap.git";
fetchgitArgs = { rev = "dc6561d9ba867901709e36526dcf7f7359861e9c";
rev = "dc6561d9ba867901709e36526dcf7f7359861e9c"; fetchgitArgs.hash = "sha256-cWBZgCgxssM3xZZPbZlU1yYlZUD7KJ/wiYSgPXNjwzU=";
hash = "sha256-cWBZgCgxssM3xZZPbZlU1yYlZUD7KJ/wiYSgPXNjwzU=";
};
}) { }) {
url = "https://github.com/lz4/lz4.git"; url = "https://github.com/lz4/lz4.git";
fetchgitArgs = { fetchgitArgs = {

View file

@ -17,14 +17,21 @@ in with lib; {
]; ];
}); });
# This is a newer version than the build system tries to download, but this
# version doesn't try to run host platform binaries on the build platform.
foonathan-memory-vendor = patchExternalProjectGit rosSuper.foonathan-memory-vendor {
url = "https://github.com/foonathan/memory.git";
originalRev = "v0.7-1";
rev = "v0.7-2";
fetchgitArgs.hash = "sha256-5nJNW0xwjSCc0Egq1zv0tIsGvAh1Xbnu8190A1ZP+VA=";
};
gazebo = self.gazebo_11; gazebo = self.gazebo_11;
google-benchmark-vendor = lib.patchExternalProjectGit rosSuper.google-benchmark-vendor { google-benchmark-vendor = lib.patchExternalProjectGit rosSuper.google-benchmark-vendor {
url = "https://github.com/google/benchmark.git"; url = "https://github.com/google/benchmark.git";
fetchgitArgs = { rev = "c05843a9f622db08ad59804c190f98879b76beba";
rev = "c05843a9f622db08ad59804c190f98879b76beba"; fetchgitArgs.hash = "sha256-h/e2vJacUp7PITez9HPzGc5+ofz7Oplso44VibECmsI=";
hash = "sha256-h/e2vJacUp7PITez9HPzGc5+ofz7Oplso44VibECmsI=";
};
}; };
iceoryx-hoofs = rosSuper.iceoryx-hoofs.overrideAttrs ({ iceoryx-hoofs = rosSuper.iceoryx-hoofs.overrideAttrs ({
@ -39,6 +46,15 @@ in with lib; {
]; ];
}); });
lely-core-libraries = lib.patchExternalProjectGit rosSuper.lely-core-libraries {
url = "https://gitlab.com/lely_industries/lely-core.git";
rev = "b63a0b6f79d3ea91dc221724b42dae49894449fc";
fetchgitArgs = {
hash = "sha256-x9JCU2Ryssq424n90IzVOxixnvsoYTukyCOL3zNbwt4=";
leaveDotGit = true;
};
};
libphidget22 = patchVendorUrl rosSuper.libphidget22 { libphidget22 = patchVendorUrl rosSuper.libphidget22 {
url = "https://www.phidgets.com/downloads/phidget22/libraries/linux/libphidget22/libphidget22-1.19.20240304.tar.gz"; url = "https://www.phidgets.com/downloads/phidget22/libraries/linux/libphidget22/libphidget22-1.19.20240304.tar.gz";
hash = "sha256-GpzGMpQ02s/X/XEcGoozzMjigrbqvAu81bcb7QG+36E="; hash = "sha256-GpzGMpQ02s/X/XEcGoozzMjigrbqvAu81bcb7QG+36E=";
@ -58,10 +74,8 @@ in with lib; {
libyaml-vendor = patchExternalProjectGit rosSuper.libyaml-vendor { libyaml-vendor = patchExternalProjectGit rosSuper.libyaml-vendor {
url = "https://github.com/yaml/libyaml.git"; url = "https://github.com/yaml/libyaml.git";
fetchgitArgs = { rev = "2c891fc7a770e8ba2fec34fc6b545c672beb37e6";
rev = "2c891fc7a770e8ba2fec34fc6b545c672beb37e6"; fetchgitArgs.hash = "sha256-S7PnooyfyAsIiRAlEPGYkgkVACGaBaCItuqOwrq2+qM=";
hash = "sha256-S7PnooyfyAsIiRAlEPGYkgkVACGaBaCItuqOwrq2+qM=";
};
}; };
mcap-vendor = patchExternalProjectGit (patchVendorUrl rosSuper.mcap-vendor { mcap-vendor = patchExternalProjectGit (patchVendorUrl rosSuper.mcap-vendor {
@ -69,10 +83,8 @@ in with lib; {
sha256 = "sha256-KDP3I0QwjqWGOfOzY6DPF2aVgK56tDX0PzsQTP9u9Ug="; sha256 = "sha256-KDP3I0QwjqWGOfOzY6DPF2aVgK56tDX0PzsQTP9u9Ug=";
}) { }) {
url = "https://github.com/lz4/lz4.git"; url = "https://github.com/lz4/lz4.git";
fetchgitArgs = { rev = "d44371841a2f1728a3f36839fd4b7e872d0927d3";
rev = "d44371841a2f1728a3f36839fd4b7e872d0927d3"; fetchgitArgs.hash = "sha256-f7GZgOzUrkAfw1mqwlIKQQqDvkvIahGlHvq6AL+aAvA=";
hash = "sha256-f7GZgOzUrkAfw1mqwlIKQQqDvkvIahGlHvq6AL+aAvA=";
};
}; };
moveit-kinematics = rosSuper.moveit-kinematics.overrideAttrs ({ moveit-kinematics = rosSuper.moveit-kinematics.overrideAttrs ({
@ -83,6 +95,14 @@ in with lib; {
propagatedBuildInputs = propagatedBuildInputs ++ [ rosSelf.moveit-ros-planning ]; propagatedBuildInputs = propagatedBuildInputs ++ [ rosSelf.moveit-ros-planning ];
}); });
novatel-oem7-driver = (patchExternalProjectGit rosSuper.novatel-oem7-driver {
url = "https://github.com/novatel/novatel_edie";
rev = "d02ccc2dfe531d642c1e2ca8a8c0f8205c856f23";
fetchgitArgs.hash = "sha256-ZQ7z9vQ8quI+SoNhB93tTw5LQe07UAKdbJJpaMj1C6I=";
}).overrideAttrs ({ ... }: {
dontFixCmake = true;
});
plotjuggler-ros = rosSuper.plotjuggler-ros.overrideAttrs ({ plotjuggler-ros = rosSuper.plotjuggler-ros.overrideAttrs ({
patches ? [], nativeBuildInputs ? [], ... patches ? [], nativeBuildInputs ? [], ...
}: { }: {

View file

@ -17,14 +17,18 @@ in with lib; {
]; ];
}); });
foonathan-memory-vendor = patchExternalProjectGit rosSuper.foonathan-memory-vendor {
url = "https://github.com/foonathan/memory.git";
rev = "v0.7-3";
fetchgitArgs.hash = "sha256-nLBnxPbPKiLCFF2TJgD/eJKJJfzktVBW3SRW2m3WK/s=";
};
gazebo = self.gazebo_11; gazebo = self.gazebo_11;
google-benchmark-vendor = lib.patchExternalProjectGit rosSuper.google-benchmark-vendor { google-benchmark-vendor = lib.patchExternalProjectGit rosSuper.google-benchmark-vendor {
url = "https://github.com/google/benchmark.git"; url = "https://github.com/google/benchmark.git";
fetchgitArgs = { rev = "0d98dba29d66e93259db7daa53a9327df767a415";
rev = "0d98dba29d66e93259db7daa53a9327df767a415"; fetchgitArgs.hash = "sha256-yUiFxi80FWBmTZgqmqTMf9oqcBeg3o4I4vKd4djyRWY=";
hash = "sha256-yUiFxi80FWBmTZgqmqTMf9oqcBeg3o4I4vKd4djyRWY=";
};
}; };
iceoryx-hoofs = rosSuper.iceoryx-hoofs.overrideAttrs ({ iceoryx-hoofs = rosSuper.iceoryx-hoofs.overrideAttrs ({
@ -46,10 +50,8 @@ in with lib; {
libyaml-vendor = patchExternalProjectGit rosSuper.libyaml-vendor { libyaml-vendor = patchExternalProjectGit rosSuper.libyaml-vendor {
url = "https://github.com/yaml/libyaml.git"; url = "https://github.com/yaml/libyaml.git";
fetchgitArgs = { rev = "2c891fc7a770e8ba2fec34fc6b545c672beb37e6";
rev = "2c891fc7a770e8ba2fec34fc6b545c672beb37e6"; fetchgitArgs.hash = "sha256-S7PnooyfyAsIiRAlEPGYkgkVACGaBaCItuqOwrq2+qM=";
hash = "sha256-S7PnooyfyAsIiRAlEPGYkgkVACGaBaCItuqOwrq2+qM=";
};
}; };
mcap-vendor = patchExternalProjectGit (patchVendorUrl rosSuper.mcap-vendor { mcap-vendor = patchExternalProjectGit (patchVendorUrl rosSuper.mcap-vendor {
@ -57,10 +59,8 @@ in with lib; {
sha256 = "sha256-KDP3I0QwjqWGOfOzY6DPF2aVgK56tDX0PzsQTP9u9Ug="; sha256 = "sha256-KDP3I0QwjqWGOfOzY6DPF2aVgK56tDX0PzsQTP9u9Ug=";
}) { }) {
url = "https://github.com/lz4/lz4.git"; url = "https://github.com/lz4/lz4.git";
fetchgitArgs = { rev = "d44371841a2f1728a3f36839fd4b7e872d0927d3";
rev = "d44371841a2f1728a3f36839fd4b7e872d0927d3"; fetchgitArgs.hash = "sha256-f7GZgOzUrkAfw1mqwlIKQQqDvkvIahGlHvq6AL+aAvA=";
hash = "sha256-f7GZgOzUrkAfw1mqwlIKQQqDvkvIahGlHvq6AL+aAvA=";
};
}; };
rviz-ogre-vendor = rosSuper.rviz-ogre-vendor.overrideAttrs ({ rviz-ogre-vendor = rosSuper.rviz-ogre-vendor.overrideAttrs ({

View file

@ -17,14 +17,18 @@ in {
]; ];
}); });
foonathan-memory-vendor = lib.patchExternalProjectGit rosSuper.foonathan-memory-vendor {
url = "https://github.com/foonathan/memory.git";
rev = "v0.7-3";
fetchgitArgs.hash = "sha256-nLBnxPbPKiLCFF2TJgD/eJKJJfzktVBW3SRW2m3WK/s=";
};
gazebo = self.gazebo_11; gazebo = self.gazebo_11;
google-benchmark-vendor = lib.patchExternalProjectGit rosSuper.google-benchmark-vendor { google-benchmark-vendor = lib.patchExternalProjectGit rosSuper.google-benchmark-vendor {
url = "https://github.com/google/benchmark.git"; url = "https://github.com/google/benchmark.git";
fetchgitArgs = { rev = "344117638c8ff7e239044fd0fa7085839fc03021";
rev = "344117638c8ff7e239044fd0fa7085839fc03021"; fetchgitArgs.hash = "sha256-gztnxui9Fe/FTieMjdvfJjWHjkImtlsHn6fM1FruyME=";
hash = "sha256-gztnxui9Fe/FTieMjdvfJjWHjkImtlsHn6fM1FruyME=";
};
}; };
iceoryx-hoofs = rosSuper.iceoryx-hoofs.overrideAttrs ({ iceoryx-hoofs = rosSuper.iceoryx-hoofs.overrideAttrs ({
@ -41,9 +45,9 @@ in {
lely-core-libraries = lib.patchExternalProjectGit rosSuper.lely-core-libraries { lely-core-libraries = lib.patchExternalProjectGit rosSuper.lely-core-libraries {
url = "https://gitlab.com/lely_industries/lely-core.git"; url = "https://gitlab.com/lely_industries/lely-core.git";
rev = "b63a0b6f79d3ea91dc221724b42dae49894449fc";
fetchgitArgs = { fetchgitArgs = {
rev = "7824cbb2ac08d091c4fa2fb397669b938de9e3f5"; hash = "sha256-x9JCU2Ryssq424n90IzVOxixnvsoYTukyCOL3zNbwt4=";
sha256 = "sha256-Ykmnz/zlEXmkyRO9AHMprML7uKbNer2zu4i9PDHfgxw=";
leaveDotGit = true; leaveDotGit = true;
}; };
}; };

View file

@ -17,14 +17,18 @@ in {
]; ];
}); });
foonathan-memory-vendor = lib.patchExternalProjectGit rosSuper.foonathan-memory-vendor {
url = "https://github.com/foonathan/memory.git";
rev = "v0.7-3";
fetchgitArgs.hash = "sha256-nLBnxPbPKiLCFF2TJgD/eJKJJfzktVBW3SRW2m3WK/s=";
};
gazebo = self.gazebo_11; gazebo = self.gazebo_11;
google-benchmark-vendor = lib.patchExternalProjectGit rosSuper.google-benchmark-vendor { google-benchmark-vendor = lib.patchExternalProjectGit rosSuper.google-benchmark-vendor {
url = "https://github.com/google/benchmark.git"; url = "https://github.com/google/benchmark.git";
fetchgitArgs = { rev = "344117638c8ff7e239044fd0fa7085839fc03021";
rev = "344117638c8ff7e239044fd0fa7085839fc03021"; fetchgitArgs.hash = "sha256-gztnxui9Fe/FTieMjdvfJjWHjkImtlsHn6fM1FruyME=";
hash = "sha256-gztnxui9Fe/FTieMjdvfJjWHjkImtlsHn6fM1FruyME=";
};
}; };
iceoryx-hoofs = rosSuper.iceoryx-hoofs.overrideAttrs ({ iceoryx-hoofs = rosSuper.iceoryx-hoofs.overrideAttrs ({
@ -41,9 +45,9 @@ in {
lely-core-libraries = lib.patchExternalProjectGit rosSuper.lely-core-libraries { lely-core-libraries = lib.patchExternalProjectGit rosSuper.lely-core-libraries {
url = "https://gitlab.com/lely_industries/lely-core.git"; url = "https://gitlab.com/lely_industries/lely-core.git";
rev = "b63a0b6f79d3ea91dc221724b42dae49894449fc";
fetchgitArgs = { fetchgitArgs = {
rev = "7824cbb2ac08d091c4fa2fb397669b938de9e3f5"; hash = "sha256-x9JCU2Ryssq424n90IzVOxixnvsoYTukyCOL3zNbwt4=";
sha256 = "sha256-Ykmnz/zlEXmkyRO9AHMprML7uKbNer2zu4i9PDHfgxw=";
leaveDotGit = true; leaveDotGit = true;
}; };
}; };
@ -54,8 +58,8 @@ in {
}; };
mcap-vendor = lib.patchVendorUrl rosSuper.mcap-vendor { mcap-vendor = lib.patchVendorUrl rosSuper.mcap-vendor {
url = "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v1.3.0.tar.gz"; url = "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v1.1.0.tar.gz";
hash = "sha256-Qaz26F11VWxkQH8HfgVJLTHbHwmeByQu8ENkuyk5rPE="; hash = "sha256-HLKuny6RDusuk7OrcidE0YBbnaRXZOT9iHA7ZpQTNQ0=";
}; };
rviz-ogre-vendor = lib.patchAmentVendorGit rosSuper.rviz-ogre-vendor { rviz-ogre-vendor = lib.patchAmentVendorGit rosSuper.rviz-ogre-vendor {

View file

@ -35,20 +35,10 @@ rosSelf: rosSuper: with rosSelf.lib; {
fmilibrary-vendor = patchExternalProjectGit rosSuper.fmilibrary-vendor { fmilibrary-vendor = patchExternalProjectGit rosSuper.fmilibrary-vendor {
url = "https://github.com/modelon-community/fmi-library.git"; url = "https://github.com/modelon-community/fmi-library.git";
fetchgitArgs = { # Uses ${fmilibrary_version}, so can't match
rev = "2.1"; originalRev = "";
sha256 = "177rlw1ba1y0ahi8qfpg0sflh8mjdl6fmffwjg2a5vxyxwdwrjvh"; rev = "2.2.3";
}; fetchgitArgs.hash = "sha256-i8EtjPMg39S/3RyoUaXm5A8Nu/NbgAwjxRCdyh2elyU=";
};
# This is a newer version than the build system tries to download, but this
# version doesn't try to run host platform binaries on the build platform.
foonathan-memory-vendor = patchExternalProjectGit rosSuper.foonathan-memory-vendor {
url = "https://github.com/foonathan/memory.git";
fetchgitArgs = {
rev = "v0.7-2";
sha256 = "sha256-5nJNW0xwjSCc0Egq1zv0tIsGvAh1Xbnu8190A1ZP+VA=";
};
}; };
gmock-vendor = rosSuper.gmock-vendor.overrideAttrs ({ gmock-vendor = rosSuper.gmock-vendor.overrideAttrs ({
@ -117,10 +107,8 @@ rosSelf: rosSuper: with rosSelf.lib; {
rig-reconfigure = patchExternalProjectGit rosSuper.rig-reconfigure { rig-reconfigure = patchExternalProjectGit rosSuper.rig-reconfigure {
url = "https://github.com/ocornut/imgui.git"; url = "https://github.com/ocornut/imgui.git";
fetchgitArgs = { rev = "v1.89.8-docking";
rev = "3ea0fad204e994d669f79ed29dcaf61cd5cb571d"; fetchgitArgs.hash = "sha256-eY8lRsonPfDRTMCPhInT9rQ6lSaJPsXpkh428OKpTnA=";
sha256 = "sha256-v9FP9zJvul+2zRGaIugNDBCR9xZqCY8U90Dfe6fXpJM=";
};
}; };
rmw-implementation = rosSuper.rmw-implementation.overrideAttrs ({ rmw-implementation = rosSuper.rmw-implementation.overrideAttrs ({

View file

@ -45,15 +45,32 @@
patchExternalProjectGit = pkg: { patchExternalProjectGit = pkg: {
url, url,
rev,
originalRev ? rev,
originalUrl ? url, originalUrl ? url,
file ? "CMakeLists.txt", file ? "CMakeLists.txt",
fetchgitArgs ? {} fetchgitArgs ? {}
}: pkg.overrideAttrs ({ }: pkg.overrideAttrs ({
postPatch ? "", ... postPatch ? "", ...
}: { }: {
postPatch = '' postPatch = let
sed -i '\|GIT_REPOSITORY\s.*${originalUrl}|c\ script = ''
URL "${self.fetchgit ({ inherit url; } // fetchgitArgs)}"' \ $0 ~ "GIT_REPOSITORY[[:blank:]]+" originalUrl \
{ print "URL \"" path "\""; foundUrl=1; next } \
{ print }
$0 ~ "GIT_TAG[[:blank:]]+" originalRev { print; foundRev=1 }
END {
if (!foundUrl) print "patchExternalProjectGit: did not find URL: " originalUrl > "/dev/stderr"
if (!foundRev) print "patchExternalProjectGit: did not find revision: " originalRev > "/dev/stderr"
exit !(foundUrl && foundRev)
}
'';
in ''
awk -i inplace \
-v originalUrl=${lib.escapeShellArg originalUrl} \
-v originalRev=${lib.escapeShellArg originalRev} \
-v path=${lib.escapeShellArg (self.fetchgit ({ inherit url rev; } // fetchgitArgs))} \
${lib.escapeShellArg script} \
${lib.escapeShellArg file} ${lib.escapeShellArg file}
'' + postPatch; '' + postPatch;
}); });