mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
Make koch friendlier to offline environments (#24713)
(cherry picked from commit d94e535145)
This commit is contained in:
committed by
narimiran
parent
fc587256c3
commit
3a9c88239b
2
koch.nim
2
koch.nim
@@ -171,7 +171,7 @@ proc bundleAtlasExe(latest: bool, args: string) =
|
||||
cloneDependency(distDir, "https://github.com/nim-lang/atlas.git",
|
||||
commit = commit, allowBundled = true)
|
||||
cloneDependency(distDir / "atlas" / distDir, "https://github.com/nim-lang/sat.git",
|
||||
commit = SatStableCommit, allowBundled = true)
|
||||
commit = SatStableCommit, allowBundled = true)
|
||||
# installer.ini expects it under $nim/bin
|
||||
nimCompile("dist/atlas/src/atlas.nim",
|
||||
options = "-d:release --noNimblePath -d:nimAtlasBootstrap " & args)
|
||||
|
||||
@@ -4,10 +4,12 @@ import std/private/gitutils
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
proc exec(cmd: string) =
|
||||
proc tryexec(cmd: string): int =
|
||||
echo "deps.cmd: " & cmd
|
||||
let status = execShellCmd(cmd)
|
||||
doAssert status == 0, cmd
|
||||
execShellCmd(cmd)
|
||||
|
||||
proc exec(cmd: string) =
|
||||
doAssert tryexec(cmd) == 0, cmd
|
||||
|
||||
proc execRetry(cmd: string) =
|
||||
let ok = retryCall(call = block:
|
||||
@@ -34,8 +36,10 @@ proc cloneDependency*(destDirBase: string, url: string, commit = commitHead,
|
||||
let oldDir = getCurrentDir()
|
||||
setCurrentDir(destDir)
|
||||
try:
|
||||
execRetry "git fetch -q"
|
||||
exec fmt"git checkout -q {commit}"
|
||||
let checkoutCmd = fmt"git checkout -q {commit}"
|
||||
if tryexec(checkoutCmd) != 0:
|
||||
execRetry "git fetch -q"
|
||||
exec checkoutCmd
|
||||
finally:
|
||||
setCurrentDir(oldDir)
|
||||
elif allowBundled:
|
||||
|
||||
Reference in New Issue
Block a user