mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-29 02:23:58 +03:00
buildPackage: do not add jq
to nativeBuildInputs (#685)
Doing so ends up resulting in PKG_CONFIG_PATH changing which may result in various `*-sys` crates needing to be rebuilt
This commit is contained in:
parent
3f50200286
commit
af693bf608
@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* **Breaking** (technically): `buildPackage` no longer adds `jq` to
|
||||||
|
`nativeBuildInputs` as doing so can result in rebuilding any `*-sys` crates
|
||||||
|
which rely on `PKG_CONFIG_PATH` remaining stable
|
||||||
|
* `installFromCargoBuildLogHook` no longer assumes or requires that `jq` is
|
||||||
|
available on `$PATH` and will instead directly reference `pkgs.jq`
|
||||||
|
|
||||||
## [0.18.1] - 2024-08-22
|
## [0.18.1] - 2024-08-22
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -233,7 +233,6 @@ environment variables during the build, you can bring them back via
|
|||||||
#### Native build dependencies and included hooks
|
#### Native build dependencies and included hooks
|
||||||
The following hooks are automatically added as native build inputs:
|
The following hooks are automatically added as native build inputs:
|
||||||
* `installFromCargoBuildLogHook`
|
* `installFromCargoBuildLogHook`
|
||||||
* `jq`
|
|
||||||
* `removeReferencesToVendoredSourcesHook`
|
* `removeReferencesToVendoredSourcesHook`
|
||||||
|
|
||||||
### `craneLib.buildTrunkPackage`
|
### `craneLib.buildTrunkPackage`
|
||||||
@ -1703,7 +1702,7 @@ takes two positional arguments:
|
|||||||
|
|
||||||
**Automatic behavior:** none
|
**Automatic behavior:** none
|
||||||
|
|
||||||
**Required nativeBuildInputs**: assumes `cargo` and `jq` are available on the `$PATH`
|
**Required nativeBuildInputs**: assumes `cargo` is available on the `$PATH`
|
||||||
|
|
||||||
### `craneLib.removeReferencesToVendoredSourcesHook`
|
### `craneLib.removeReferencesToVendoredSourcesHook`
|
||||||
|
|
||||||
|
@ -77,8 +77,9 @@ mkCargoDerivation (cleanedArgs // memoizedArgs // {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
|
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
|
||||||
|
# NB: avoid adding any non-hook packages here. Doing so will end up
|
||||||
|
# changing PKG_CONFIG_PATH and cause rebuilds of `*-sys` crates.
|
||||||
installFromCargoBuildLogHook
|
installFromCargoBuildLogHook
|
||||||
jq
|
|
||||||
removeReferencesToVendoredSourcesHook
|
removeReferencesToVendoredSourcesHook
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
{ makeSetupHook
|
{ makeSetupHook
|
||||||
|
, pkgsBuildBuild
|
||||||
}:
|
}:
|
||||||
|
|
||||||
makeSetupHook
|
makeSetupHook
|
||||||
{
|
{
|
||||||
name = "installFromCargoBuildLogHook";
|
name = "installFromCargoBuildLogHook";
|
||||||
|
substitutions = {
|
||||||
|
jq = "${pkgsBuildBuild.jq}/bin/jq";
|
||||||
|
};
|
||||||
} ./installFromCargoBuildLogHook.sh
|
} ./installFromCargoBuildLogHook.sh
|
||||||
|
@ -10,7 +10,7 @@ function installFromCargoBuildLog() (
|
|||||||
echo searching for bins/libs to install from cargo build log at ${log}
|
echo searching for bins/libs to install from cargo build log at ${log}
|
||||||
|
|
||||||
local logs
|
local logs
|
||||||
logs=$(jq -R 'fromjson?' <"${log}")
|
logs=$(@jq@ -R 'fromjson?' <"${log}")
|
||||||
|
|
||||||
# We automatically ignore any bindeps artifacts as installation candidates.
|
# We automatically ignore any bindeps artifacts as installation candidates.
|
||||||
# Note that if the same binary is built both as a bindep artifact for something else and as a
|
# Note that if the same binary is built both as a bindep artifact for something else and as a
|
||||||
@ -19,7 +19,7 @@ function installFromCargoBuildLog() (
|
|||||||
local select_non_deps_artifact='select(contains("/deps/artifact/") | not)'
|
local select_non_deps_artifact='select(contains("/deps/artifact/") | not)'
|
||||||
|
|
||||||
# Only install binaries and libraries from the current workspace as a sanity check
|
# Only install binaries and libraries from the current workspace as a sanity check
|
||||||
local members="$(command cargo metadata --format-version 1 | jq -c '.workspace_members')"
|
local members="$(command cargo metadata --format-version 1 | @jq@ -c '.workspace_members')"
|
||||||
local select_non_test_members='select(.reason == "compiler-artifact" and .profile.test == false)
|
local select_non_test_members='select(.reason == "compiler-artifact" and .profile.test == false)
|
||||||
| select(.package_id as $pid
|
| select(.package_id as $pid
|
||||||
| '"${members}"'
|
| '"${members}"'
|
||||||
@ -49,8 +49,8 @@ function installFromCargoBuildLog() (
|
|||||||
rmdir --ignore-fail-on-non-empty "${loc}"
|
rmdir --ignore-fail-on-non-empty "${loc}"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "${logs}" | jq -r "${select_lib_files}" | installArtifacts "${dest}/lib"
|
echo "${logs}" | @jq@ -r "${select_lib_files}" | installArtifacts "${dest}/lib"
|
||||||
echo "${logs}" | jq -r "${select_bins}" | installArtifacts "${dest}/bin"
|
echo "${logs}" | @jq@ -r "${select_bins}" | installArtifacts "${dest}/bin"
|
||||||
|
|
||||||
echo searching for bins/libs complete
|
echo searching for bins/libs complete
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user