Skip to content

Commit

Permalink
allow Nix builds by skipping isGitRepo for Nimble
Browse files Browse the repository at this point in the history
Because `isGitRepo()` call requires `/bin/sh` it will always fail when
building Nim in a Nix build sandbox, and the check doesn't even make
sense if Nix already provides Nimble source code.

Since for Nimble `allowBundled` is set to `true` this effectlvely does
not change behavior for normal builds, but does avoid ugly hacks when
building in Nix.

Reference:
status-im/nimbus-eth2#6180 (comment)

Signed-off-by: Jakub Sokołowski <jakub@status.im>
  • Loading branch information
jakubgs committed Apr 18, 2024
1 parent 49e1ca0 commit 739175a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/deps.nim
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ proc cloneDependency*(destDirBase: string, url: string, commit = commitHead,
# note: old code used `destDir / .git` but that wouldn't prevent git clone
# from failing
execRetry fmt"git clone -q {url} {quotedDestDir}"
if isGitRepo(destDir):
if allowBundled:
discard "this dependency was bundled with Nim, don't do anything"
elif isGitRepo(destDir):
let oldDir = getCurrentDir()
setCurrentDir(destDir)
try:
execRetry "git fetch -q"
exec fmt"git checkout -q {commit}"
finally:
setCurrentDir(oldDir)
elif allowBundled:
discard "this dependency was bundled with Nim, don't do anything"
else:
quit "FAILURE: " & destdir & " already exists but is not a git repo"

0 comments on commit 739175a

Please sign in to comment.