2024-02-18 01:16:49 +00:00
|
|
|
# beacon_chain
|
2024-01-06 14:26:56 +00:00
|
|
|
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
2021-03-26 06:52:01 +00:00
|
|
|
# Licensed and distributed under either of
|
|
|
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
|
|
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
|
|
|
2024-02-18 01:16:49 +00:00
|
|
|
{.push raises: [].}
|
|
|
|
|
2022-11-30 10:47:11 +00:00
|
|
|
## This module implements the version tagging details of all binaries included
|
|
|
|
## in the Nimbus release process (i.e. beacon_node, validator_client, etc)
|
|
|
|
|
2023-03-30 16:59:36 +00:00
|
|
|
import std/[strutils, compilesettings]
|
2020-06-30 12:23:52 +00:00
|
|
|
|
2020-04-15 22:20:27 +00:00
|
|
|
const
|
2023-05-13 04:30:49 +00:00
|
|
|
compileYear = CompileDate[0 ..< 4] # YYYY-MM-DD (UTC)
|
|
|
|
copyrights* =
|
|
|
|
"Copyright (c) 2019-" & compileYear & " Status Research & Development GmbH"
|
|
|
|
|
2024-01-03 23:24:00 +00:00
|
|
|
versionMajor* = 24
|
2024-11-29 11:18:07 +00:00
|
|
|
versionMinor* = 11
|
2024-06-24 07:24:14 +00:00
|
|
|
versionBuild* = 0
|
2020-11-20 20:31:03 +00:00
|
|
|
|
2022-01-05 15:42:29 +00:00
|
|
|
versionBlob* = "stateofus" # Single word - ends up in the default graffiti
|
2019-03-05 22:54:08 +00:00
|
|
|
|
2023-03-30 16:59:36 +00:00
|
|
|
## You can override this if you are building the
|
|
|
|
## sources outside the git tree of Nimbus:
|
|
|
|
git_revision_override* {.strdefine.} =
|
|
|
|
when querySetting(SingleValueSetting.command) == "check":
|
|
|
|
# The staticExec call below returns an empty string
|
|
|
|
# when `nim check` is used and this leads to a faux
|
|
|
|
# compile-time error.
|
|
|
|
# We work-around the problem with this override and
|
|
|
|
# save some time in executing the external command.
|
|
|
|
"123456"
|
|
|
|
else:
|
|
|
|
""
|
|
|
|
|
|
|
|
gitRevisionLong* = when git_revision_override.len == 0:
|
|
|
|
staticExec "git rev-parse --short HEAD"
|
|
|
|
else:
|
|
|
|
git_revision_override
|
|
|
|
|
|
|
|
gitRevision* = strip(gitRevisionLong)[0..5]
|
2019-11-08 10:33:16 +00:00
|
|
|
|
2022-09-20 15:52:24 +00:00
|
|
|
nimFullBanner* = staticExec("nim --version")
|
2021-07-09 05:41:44 +00:00
|
|
|
nimBanner* = staticExec("nim --version | grep Version")
|
2020-04-15 22:20:27 +00:00
|
|
|
|
2019-11-12 00:05:35 +00:00
|
|
|
versionAsStr* =
|
|
|
|
$versionMajor & "." & $versionMinor & "." & $versionBuild
|
2019-03-05 22:54:08 +00:00
|
|
|
|
2020-11-25 01:13:35 +00:00
|
|
|
fullVersionStr* = "v" & versionAsStr & "-" & gitRevision & "-" & versionBlob
|
2020-06-30 12:23:52 +00:00
|
|
|
|
2024-07-15 02:27:23 +00:00
|
|
|
nimbusAgentStr* = "Nimbus/" & fullVersionStr
|
|
|
|
|
2022-09-20 15:52:24 +00:00
|
|
|
func getNimGitHash*(): string =
|
2020-06-30 12:23:52 +00:00
|
|
|
const gitPrefix = "git hash: "
|
2022-09-20 15:52:24 +00:00
|
|
|
let tmp = splitLines(nimFullBanner)
|
2020-06-30 12:23:52 +00:00
|
|
|
if tmp.len == 0:
|
|
|
|
return
|
|
|
|
for line in tmp:
|
|
|
|
if line.startsWith(gitPrefix) and line.len > 8 + gitPrefix.len:
|
2022-09-20 15:52:24 +00:00
|
|
|
result = line[gitPrefix.len..<gitPrefix.len + 8]
|
2020-06-30 12:23:52 +00:00
|
|
|
|
2022-09-20 15:52:24 +00:00
|
|
|
func shortNimBanner*(): string =
|
|
|
|
let gitHash = getNimGitHash()
|
|
|
|
let tmp = splitLines(nimFullBanner)
|
2020-06-30 12:23:52 +00:00
|
|
|
if gitHash.len > 0:
|
|
|
|
tmp[0] & " (" & gitHash & ")"
|
|
|
|
else:
|
|
|
|
tmp[0]
|