pmmiranda 411a3cadfa
Renamed 'nimbus' directory and its references to 'execution_chain' (#3052)
* renamed nimbus folder to execution_chain

* Renamed "nimbus" references to "execution_chain"

* fixed wrongly changed http reference

* delete snap types file given that it was deleted before this PR merge

* missing 'execution_chain' replacement

---------

Co-authored-by: pmmiranda <pedro.miranda@nimbus.team>
2025-02-11 22:28:42 +00:00

67 lines
2.2 KiB
Nim

# Copyright (c) 2018-2024 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
# at your option.
# This file may not be copied, modified, or distributed except according to
# those terms.
import
std/[strformat, strutils, os, sequtils],
stew/byteutils, ./compile_info
const
sourcePath = currentSourcePath.rsplit({DirSep, AltSep}, 1)[0]
nimbusRevision {.strdefine.} = "00000000"
static:
doAssert(nimbusRevision.len == 8, "nimbusRevision must consist of 8 characters")
doAssert(nimbusRevision.allIt(it in HexDigits), "nimbusRevision should contains only hex chars")
proc gitFolderExists(path: string): bool {.compileTime.} =
# walk up parent folder to find `.git` folder
var currPath = sourcePath
while true:
if dirExists(currPath & "/.git"):
return true
let parts = splitPath(currPath)
if parts.tail.len == 0: break
currPath = parts.head
false
const
NimbusName* = "nimbus-eth1"
## project name string
NimbusMajor*: int = 0
## is the major number of Nimbus' version.
NimbusMinor*: int = 1
## is the minor number of Nimbus' version.
NimbusPatch*: int = 0
## is the patch number of Nimbus' version.
NimbusVersion* = $NimbusMajor & "." & $NimbusMinor & "." & $NimbusPatch
## is the version of Nimbus as a string.
# strip: remove spaces
# --short=8: ensure we get 8 chars of commit hash
# -C sourcePath: get the correct git hash no matter where the current dir is.
GitRevision* = if gitFolderExists(sourcePath):
# only using git if the parent dir is a git repo.
strip(staticExec("git -C " & strutils.escape(sourcePath) &
" rev-parse --short=8 HEAD"))
else:
# otherwise we use revision number given by build system.
# e.g. user download from release tarball, or Github zip download.
nimbusRevision
GitRevisionBytes* = hexToByteArray[4](GitRevision)
FullVersionStr* = "v" & NimbusVersion & "-" & GitRevision
ClientId* = &"{NimbusName}/{FullVersionStr}/{hostOS}-{hostCPU}/Nim-{NimVersion}/{VmName}"
ShortClientId* = NimbusName & "/" & FullVersionStr