Fix #60125 - buildRustCrate: Always set CARGO_PKG_VERSION_PRE and CARGO_PKG_HOMEPAGE

(as cargo does)
This commit is contained in:
Peter Kolloch 2019-04-23 23:40:29 +02:00
parent ca37c23f91
commit 61ac550082
2 changed files with 5 additions and 4 deletions

View File

@ -6,6 +6,7 @@
, completeDeps , completeDeps
, crateAuthors , crateAuthors
, crateDescription , crateDescription
, crateHomepage
, crateFeatures , crateFeatures
, crateName , crateName
, crateVersion , crateVersion
@ -91,12 +92,11 @@ in ''
export CARGO_PKG_VERSION_MAJOR=${builtins.elemAt version 0} export CARGO_PKG_VERSION_MAJOR=${builtins.elemAt version 0}
export CARGO_PKG_VERSION_MINOR=${builtins.elemAt version 1} export CARGO_PKG_VERSION_MINOR=${builtins.elemAt version 1}
export CARGO_PKG_VERSION_PATCH=${builtins.elemAt version 2} export CARGO_PKG_VERSION_PATCH=${builtins.elemAt version 2}
export CARGO_PKG_VERSION_PRE="${versionPre}"
export CARGO_PKG_HOMEPAGE="${crateHomepage}"
export NUM_JOBS=1 export NUM_JOBS=1
export RUSTC="rustc" export RUSTC="rustc"
export RUSTDOC="rustdoc" export RUSTDOC="rustdoc"
if [[ -n "${versionPre}" ]]; then
export CARGO_PKG_VERSION_PRE="${versionPre}"
fi
BUILD="" BUILD=""
if [[ ! -z "${build}" ]] ; then if [[ ! -z "${build}" ]] ; then

View File

@ -131,6 +131,7 @@ stdenv.mkDerivation (rec {
crateVersion = crate.version; crateVersion = crate.version;
crateDescription = crate.description or ""; crateDescription = crate.description or "";
crateAuthors = if crate ? authors && lib.isList crate.authors then crate.authors else []; crateAuthors = if crate ? authors && lib.isList crate.authors then crate.authors else [];
crateHomepage = crate.homepage or "";
crateType = crateType =
if lib.attrByPath ["procMacro"] false crate then ["proc-macro"] else if lib.attrByPath ["procMacro"] false crate then ["proc-macro"] else
if lib.attrByPath ["plugin"] false crate then ["dylib"] else if lib.attrByPath ["plugin"] false crate then ["dylib"] else
@ -144,7 +145,7 @@ stdenv.mkDerivation (rec {
inherit crateName buildDependencies completeDeps completeBuildDeps crateDescription inherit crateName buildDependencies completeDeps completeBuildDeps crateDescription
crateFeatures libName build workspace_member release libPath crateVersion crateFeatures libName build workspace_member release libPath crateVersion
extraLinkFlags extraRustcOpts extraLinkFlags extraRustcOpts
crateAuthors verbose colors target_os; crateAuthors crateHomepage verbose colors target_os;
}; };
buildPhase = buildCrate { buildPhase = buildCrate {
inherit crateName dependencies inherit crateName dependencies