mirror of
https://github.com/lopsided98/nix-ros-overlay.git
synced 2025-06-10 01:42:24 +03:00
Improve patchExternalProjectGit
Add basic support for checking the version if it is assigned to a variable.
This commit is contained in:
parent
5d3c82695b
commit
f556a34f39
4 changed files with 12 additions and 14 deletions
|
@ -168,20 +168,8 @@ let
|
|||
|
||||
osqp-vendor = pipe rosSuper.osqp-vendor [
|
||||
(pkg: pkg.overrideAttrs ({
|
||||
prePatch ? "",
|
||||
preInstall ? "", ...
|
||||
}: {
|
||||
# Make CMakeLists.txt amenable to automatic patching with
|
||||
# patchExternalProjectGit
|
||||
prePatch = prePatch + ''
|
||||
substituteInPlace CMakeLists.txt --replace-fail \
|
||||
'set(git_tag "v0.6.2")' \
|
||||
'set(git_tag "v0.6.2")' # fail when upstream version changes
|
||||
substituteInPlace CMakeLists.txt --replace-fail \
|
||||
'GIT_TAG ''${git_tag}' \
|
||||
'GIT_TAG v0.6.2'
|
||||
'';
|
||||
|
||||
# osqp installs into both lib/cmake/ and lib64/cmake/ which is
|
||||
# problematic because moveLib64 doesn't attempt to merge overlapping
|
||||
# directories but fails instead. Here we do the merge manually.
|
||||
|
@ -195,6 +183,7 @@ let
|
|||
(pkg: patchExternalProjectGit pkg {
|
||||
url = "https://github.com/osqp/osqp.git";
|
||||
rev = "v0.6.2";
|
||||
revVariable = "git_tag";
|
||||
fetchgitArgs = {
|
||||
hash = "sha256-0BbUe1J9qzvyKDBLTz+pAEmR3QpRL+hnxZ2re/3mEvs=";
|
||||
leaveDotGit = true;
|
||||
|
|
|
@ -184,6 +184,13 @@ in {
|
|||
hash = "sha256-ZP8+URGfN//Pr53uy9mHp8tNTZA110o/03czlaRw/aE=";
|
||||
};
|
||||
|
||||
nlohmann-json-schema-validator-vendor = lib.patchExternalProjectGit rosSuper.nlohmann-json-schema-validator-vendor {
|
||||
url = "https://github.com/pboettch/json-schema-validator.git";
|
||||
rev = "5ef4f903af055550e06955973a193e17efded896";
|
||||
revVariable = "nlohmann_json_schema_validator_version";
|
||||
fetchgitArgs.hash = "sha256-b02OFUx0BxUA6HN6IaacSg1t3RP4o7NND7X0U635W8U=";
|
||||
};
|
||||
|
||||
rviz-ogre-vendor = lib.patchAmentVendorGit rosSuper.rviz-ogre-vendor {
|
||||
url = "https://github.com/OGRECave/ogre.git";
|
||||
rev = "v1.12.10";
|
||||
|
|
|
@ -54,9 +54,8 @@ rosSelf: rosSuper: with rosSelf.lib; {
|
|||
|
||||
fmilibrary-vendor = patchExternalProjectGit rosSuper.fmilibrary-vendor {
|
||||
url = "https://github.com/modelon-community/fmi-library.git";
|
||||
# Uses ${fmilibrary_version}, so can't match
|
||||
originalRev = "";
|
||||
rev = "2.2.3";
|
||||
revVariable = "fmilibrary_version";
|
||||
fetchgitArgs.hash = "sha256-i8EtjPMg39S/3RyoUaXm5A8Nu/NbgAwjxRCdyh2elyU=";
|
||||
};
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
rev,
|
||||
originalRev ? rev,
|
||||
originalUrl ? url,
|
||||
revVariable ? "",
|
||||
file ? "CMakeLists.txt",
|
||||
fetchgitArgs ? {}
|
||||
}: pkg.overrideAttrs ({
|
||||
|
@ -59,6 +60,7 @@
|
|||
{ print "URL \"" path "\""; foundUrl=1; next } \
|
||||
{ print }
|
||||
$0 ~ "GIT_TAG[[:blank:]]+" originalRev { print; foundRev=1 }
|
||||
$0 ~ "set\\(" revVariable "[[: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"
|
||||
|
@ -69,6 +71,7 @@
|
|||
awk -i inplace \
|
||||
-v originalUrl=${lib.escapeShellArg originalUrl} \
|
||||
-v originalRev=${lib.escapeShellArg originalRev} \
|
||||
-v revVariable=${lib.escapeShellArg revVariable} \
|
||||
-v path=${lib.escapeShellArg (self.fetchgit ({ inherit url rev; } // fetchgitArgs))} \
|
||||
${lib.escapeShellArg script} \
|
||||
${lib.escapeShellArg file}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue