Merge pull request #291813 from kampka/crowdsec-versioning-flags

crowdsec: fix versioning flags in build
This commit is contained in:
Aleksana 2024-04-06 23:38:11 +08:00 committed by GitHub
commit 9912512eda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,9 +23,9 @@ buildGoModule rec {
ldflags = [ ldflags = [
"-s" "-s"
"-w" "-w"
"-X github.com/crowdsecurity/go-cs-lib/pkg/version.Version=v${version}" "-X github.com/crowdsecurity/go-cs-lib/version.Version=v${version}"
"-X github.com/crowdsecurity/go-cs-lib/pkg/version.BuildDate=1970-01-01_00:00:00" "-X github.com/crowdsecurity/go-cs-lib/version.BuildDate=1970-01-01_00:00:00"
"-X github.com/crowdsecurity/go-cs-lib/pkg/version.Tag=${src.rev}" "-X github.com/crowdsecurity/go-cs-lib/version.Tag=${src.rev}"
"-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=alphaga" "-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=alphaga"
"-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=/etc/crowdsec" "-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=/etc/crowdsec"
"-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=/var/lib/crowdsec/data" "-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=/var/lib/crowdsec/data"
@ -43,6 +43,11 @@ buildGoModule rec {
--zsh <($out/bin/cscli completion zsh) --zsh <($out/bin/cscli completion zsh)
''; '';
# It's important that the version is correctly set as it also determines feature capabilities
checkPhase = ''
$GOPATH/bin/cscli version 2>&1 | grep -q "version: v${version}"
'';
meta = with lib; { meta = with lib; {
homepage = "https://crowdsec.net/"; homepage = "https://crowdsec.net/";
changelog = "https://github.com/crowdsecurity/crowdsec/releases/tag/v${version}"; changelog = "https://github.com/crowdsecurity/crowdsec/releases/tag/v${version}";