koch.nim: critical fix for the tar.xz installations

This commit is contained in:
Andreas Rumpf 2017-01-07 10:39:00 +01:00
commit 5ce414141e

View file

@ -188,21 +188,25 @@ proc buildNimble(latest: bool) =
# here so that it cannot cause problems (nimble bug #306): # here so that it cannot cause problems (nimble bug #306):
if dirExists("bin/nimblepkg"): if dirExists("bin/nimblepkg"):
removeDir("bin/nimblepkg") removeDir("bin/nimblepkg")
# if koch is used for a tar.xz, build the dist/nimble we shipped
# with the tarball:
var installDir = "dist/nimble" var installDir = "dist/nimble"
if not dirExists("dist/nimble/.git"): if not latest and dirExists(installDir) and not dirExists("dist/nimble/.git"):
# if dist/nimble exist, but is not a git repo, don't mess with it: discard "don't do the git dance"
if dirExists(installDir): else:
var id = 0 if not dirExists("dist/nimble/.git"):
while dirExists("dist/nimble" & $id): if dirExists(installDir):
inc id var id = 0
installDir = "dist/nimble" & $id while dirExists("dist/nimble" & $id):
exec("git clone https://github.com/nim-lang/nimble.git " & installDir) inc id
withDir(installDir): installDir = "dist/nimble" & $id
if latest: exec("git clone https://github.com/nim-lang/nimble.git " & installDir)
exec("git checkout -f master") withDir(installDir):
else: if latest:
exec("git checkout -f stable") exec("git checkout -f master")
exec("git pull") else:
exec("git checkout -f stable")
exec("git pull")
nimexec("c --noNimblePath -p:compiler " & installDir / "src/nimble.nim") nimexec("c --noNimblePath -p:compiler " & installDir / "src/nimble.nim")
copyExe(installDir / "src/nimble".exe, "bin/nimble".exe) copyExe(installDir / "src/nimble".exe, "bin/nimble".exe)