Merge pull request #153035 from cherryblossom000/elvish-reproducible
elvish: properly set buildinfo via `ldflags`
This commit is contained in:
commit
0fbaa4132f
1 changed files with 22 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ lib, buildGoModule, fetchFromGitHub }:
|
{ lib, buildGoModule, fetchFromGitHub, runCommand }:
|
||||||
|
|
||||||
buildGoModule rec {
|
buildGoModule rec {
|
||||||
pname = "elvish";
|
pname = "elvish";
|
||||||
|
@ -6,7 +6,7 @@ buildGoModule rec {
|
||||||
|
|
||||||
subPackages = [ "cmd/elvish" ];
|
subPackages = [ "cmd/elvish" ];
|
||||||
|
|
||||||
ldflags = [ "-s" "-w" "-X github.com/elves/elvish/pkg/buildinfo.Version==${version}" "-X github.com/elves/elvish/pkg/buildinfo.Reproducible=true" ];
|
ldflags = [ "-s" "-w" "-X src.elv.sh/pkg/buildinfo.Version==${version}" "-X src.elv.sh/pkg/buildinfo.Reproducible=true" ];
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "elves";
|
owner = "elves";
|
||||||
|
@ -19,6 +19,25 @@ buildGoModule rec {
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
|
doInstallCheck = true;
|
||||||
|
installCheckPhase = ''
|
||||||
|
runHook preInstallCheck
|
||||||
|
|
||||||
|
$out${passthru.shellPath} -c "
|
||||||
|
fn expect {|key expected|
|
||||||
|
var actual = \$buildinfo[\$key]
|
||||||
|
if (not-eq \$actual \$expected) {
|
||||||
|
fail '\$buildinfo['\$key']: expected '(to-string \$expected)', got '(to-string \$actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
expect version ${version}
|
||||||
|
expect reproducible \$true
|
||||||
|
"
|
||||||
|
|
||||||
|
runHook postInstallCheck
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "A friendly and expressive command shell";
|
description = "A friendly and expressive command shell";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
|
@ -31,7 +50,5 @@ buildGoModule rec {
|
||||||
maintainers = with maintainers; [ vrthra AndersonTorres ];
|
maintainers = with maintainers; [ vrthra AndersonTorres ];
|
||||||
};
|
};
|
||||||
|
|
||||||
passthru = {
|
passthru.shellPath = "/bin/elvish";
|
||||||
shellPath = "/bin/elvish";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue