fixes #24536; fixes nightlies regression caused by nimble update (#24542)

follow up #24537

Because `nimble` is a bundled repo so it is bundled in the tarballs

i.e.
82421fd705/.github/workflows/nightlies.yml (L264)
has bundled `dist/nimble`, but it only copies the data without `.git`.
So in this PR, we ignore bundled nimble repo.
This commit is contained in:
ringabout
2024-12-17 13:42:17 +08:00
committed by GitHub
parent 81d8c0fc17
commit 70b3232d3a
2 changed files with 13 additions and 8 deletions

View File

@@ -159,7 +159,7 @@ proc bundleNimbleExe(latest: bool, args: string) =
let commit = if latest: "HEAD" else: NimbleStableCommit
cloneDependency(distDir, "https://github.com/nim-lang/nimble.git",
commit = commit, allowBundled = true)
updateSubmodules(distDir / "nimble")
updateSubmodules(distDir / "nimble", allowBundled = true)
nimCompile("dist/nimble/src/nimble.nim",
options = "-d:release --noNimblePath " & args)

View File

@@ -43,10 +43,15 @@ proc cloneDependency*(destDirBase: string, url: string, commit = commitHead,
else:
quit "FAILURE: " & destdir & " already exists but is not a git repo"
proc updateSubmodules*(dir: string) =
let oldDir = getCurrentDir()
setCurrentDir(dir)
try:
exec "git submodule update --init"
finally:
setCurrentDir(oldDir)
proc updateSubmodules*(dir: string, allowBundled = false) =
if isGitRepo(dir):
let oldDir = getCurrentDir()
setCurrentDir(dir)
try:
exec "git submodule update --init"
finally:
setCurrentDir(oldDir)
elif allowBundled:
discard "this dependency was bundled with Nim, don't do anything"
else:
quit "FAILURE: " & dir & " already exists but is not a git repo"