From cfffaa1ba869f5383e875c0f6d0b6898284d2799 Mon Sep 17 00:00:00 2001 From: Ivan Bobev Date: Wed, 29 Sep 2021 18:40:14 +0300 Subject: [PATCH] Update Nim to search for Nimble packages in "pkg2" Related to nim-lang/nimble#127 --- compiler/commands.nim | 2 +- compiler/modulepaths.nim | 4 ++-- compiler/nimblecmd.nim | 4 ++-- config/nim.cfg | 4 ++-- doc/testament.rst | 2 +- koch.nim | 2 +- testament/specs.nim | 2 +- tests/cpp/tasync_cpp.nim | 2 +- tools/niminst/deinstall.nimf | 6 +++--- tools/niminst/install.nimf | 6 +++--- tools/niminst/niminst.nim | 3 ++- 11 files changed, 19 insertions(+), 18 deletions(-) diff --git a/compiler/commands.nim b/compiler/commands.nim index 9b7e357913a2..4a2298e83568 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -520,7 +520,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo; var path = processPath(conf, arg, info, notRelativeToProj=true) let nimbleDir = AbsoluteDir getEnv("NIMBLE_DIR") if not nimbleDir.isEmpty and pass == passPP: - path = nimbleDir / RelativeDir"pkgs" + path = nimbleDir / RelativeDir"pkgs2" nimblePath(conf, path, info) of "nonimblepath", "nobabelpath": if switch.normalize == "nobabelpath": deprecatedAlias(switch, "nonimblepath") diff --git a/compiler/modulepaths.nim b/compiler/modulepaths.nim index a16b669c4591..46a861bd5b19 100644 --- a/compiler/modulepaths.nim +++ b/compiler/modulepaths.nim @@ -84,10 +84,10 @@ when false: if not options.gNoNimblePath: var nimbleDir = getEnv("NIMBLE_DIR") if nimbleDir.len == 0: nimbleDir = getHomeDir() / ".nimble" - result = findInNimbleDir(pkg, subdir, nimbleDir / "pkgs") + result = findInNimbleDir(pkg, subdir, nimbleDir / "pkgs2") if result.len > 0: return result when not defined(windows): - result = findInNimbleDir(pkg, subdir, "/opt/nimble/pkgs") + result = findInNimbleDir(pkg, subdir, "/opt/nimble/pkgs2") if result.len > 0: return result proc scriptableImport(pkg, sub: string; info: TLineInfo): string = diff --git a/compiler/nimblecmd.nim b/compiler/nimblecmd.nim index 9cd2941ba46f..17b4e0de1b91 100644 --- a/compiler/nimblecmd.nim +++ b/compiler/nimblecmd.nim @@ -65,8 +65,8 @@ proc `<`*(ver: Version, ver2: Version): bool = proc getPathVersionChecksum*(p: string): tuple[name, version, checksum: string] = ## Splits path ``p`` in the format - ## ``/home/user/.nimble/pkgs/package-0.1-febadeaea2345e777f0f6f8433f7f0a52edd5d1b`` into - ## ``("/home/user/.nimble/pkgs/package", "0.1", "febadeaea2345e777f0f6f8433f7f0a52edd5d1b")`` + ## ``/home/user/.nimble/pkgs2/package-0.1-febadeaea2345e777f0f6f8433f7f0a52edd5d1b`` into + ## ``("/home/user/.nimble/pkgs2/package", "0.1", "febadeaea2345e777f0f6f8433f7f0a52edd5d1b")`` const checksumSeparator = '-' const versionSeparator = '-' diff --git a/config/nim.cfg b/config/nim.cfg index 3b964d124e24..2d50515ab6f6 100644 --- a/config/nim.cfg +++ b/config/nim.cfg @@ -44,11 +44,11 @@ path="$lib/core" path="$lib/pure" @if not windows: - nimblepath="/opt/nimble/pkgs/" + nimblepath="/opt/nimble/pkgs2/" @else: # TODO: @end -nimblepath="$home/.nimble/pkgs/" +nimblepath="$home/.nimble/pkgs2/" # Syncronize with compiler/commands.specialDefine @if danger or quick: diff --git a/doc/testament.rst b/doc/testament.rst index 5590cc6d79f6..eac508048088 100644 --- a/doc/testament.rst +++ b/doc/testament.rst @@ -153,7 +153,7 @@ Example "template" **to edit** and write a Testament unittest: # Command the test should use to run. If left out or an empty string is # provided, the command is taken to be: - # "nim $target --hints:on -d:testing --nimblePath:build/deps/pkgs $options $file" + # "nim $target --hints:on -d:testing --nimblePath:build/deps/pkgs2 $options $file" # You can use the $target, $options, and $file placeholders in your own # command, too. cmd: "nim c -r $file" diff --git a/koch.nim b/koch.nim index 8dd897028f28..3516004ddeb9 100644 --- a/koch.nim +++ b/koch.nim @@ -10,7 +10,7 @@ # const - NimbleStableCommit = "d13f3b8ce288b4dc8c34c219a4e050aaeaf43fc9" # master + NimbleStableCommit = "c866966161c2ea0cdf122d8cb22cef4cd3cc04ae" # master # examples of possible values: #head, #ea82b54, 1.2.3 FusionStableHash = "#372ee4313827ef9f2ea388840f7d6b46c2b1b014" HeadHash = "#head" diff --git a/testament/specs.nim b/testament/specs.nim index 6fd0ab22dc9d..1db3e6ac1ccf 100644 --- a/testament/specs.nim +++ b/testament/specs.nim @@ -103,7 +103,7 @@ type proc getCmd*(s: TSpec): string = if s.cmd.len == 0: - result = compilerPrefix & " $target --hints:on -d:testing --clearNimblePath --nimblePath:build/deps/pkgs $options $file" + result = compilerPrefix & " $target --hints:on -d:testing --clearNimblePath --nimblePath:build/deps/pkgs2 $options $file" else: result = s.cmd diff --git a/tests/cpp/tasync_cpp.nim b/tests/cpp/tasync_cpp.nim index 696274ec4763..3f4ec620840f 100644 --- a/tests/cpp/tasync_cpp.nim +++ b/tests/cpp/tasync_cpp.nim @@ -1,7 +1,7 @@ discard """ targets: "cpp" output: "hello" - cmd: "nim cpp --clearNimblePath --nimblePath:build/deps/pkgs $file" + cmd: "nim cpp --clearNimblePath --nimblePath:build/deps/pkgs2 $file" """ # bug #3299 diff --git a/tools/niminst/deinstall.nimf b/tools/niminst/deinstall.nimf index 0dcfda75e717..34424b3bdad4 100644 --- a/tools/niminst/deinstall.nimf +++ b/tools/niminst/deinstall.nimf @@ -21,7 +21,7 @@ if [ $# -eq 1 ] ; then libdir=/usr/lib/?proj docdir=/usr/share/?proj/doc datadir=/usr/share/?proj/data - nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version" + nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum" ;; "/usr/local/bin") bindir=/usr/local/bin @@ -29,7 +29,7 @@ if [ $# -eq 1 ] ; then libdir=/usr/local/lib/?proj docdir=/usr/local/share/?proj/doc datadir=/usr/local/share/?proj/data - nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version" + nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum" ;; "/opt") bindir="/opt/?proj/bin" @@ -37,7 +37,7 @@ if [ $# -eq 1 ] ; then libdir="/opt/?proj/lib" docdir="/opt/?proj/doc" datadir="/opt/?proj/data" - nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version" + nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum" ;; *) bindir="$1/?proj/bin" diff --git a/tools/niminst/install.nimf b/tools/niminst/install.nimf index c2fc96e94d43..60b4858b7003 100644 --- a/tools/niminst/install.nimf +++ b/tools/niminst/install.nimf @@ -34,7 +34,7 @@ if [ $# -eq 1 ] ; then libdir=/usr/lib/?proj docdir=/usr/share/?proj/doc datadir=/usr/share/?proj/data - nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version" + nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum" ;; "/usr/local/bin") bindir=/usr/local/bin @@ -42,7 +42,7 @@ if [ $# -eq 1 ] ; then libdir=/usr/local/lib/?proj docdir=/usr/local/share/?proj/doc datadir=/usr/local/share/?proj/data - nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version" + nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum" ;; "/opt") bindir="/opt/?proj/bin" @@ -50,7 +50,7 @@ if [ $# -eq 1 ] ; then libdir="/opt/?proj/lib" docdir="/opt/?proj/doc" datadir="/opt/?proj/data" - nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version" + nimbleDir="/opt/nimble/pkgs2/?c.nimblePkgName-?c.version-?c.checksum" mkdir -p /opt/?proj mkdir -p $bindir mkdir -p $configdir diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim index d81b98be9f3d..ef83ace62f26 100644 --- a/tools/niminst/niminst.nim +++ b/tools/niminst/niminst.nim @@ -45,7 +45,7 @@ type fcUnix, # files only for Unix; must be after ``fcWindows`` fcUnixBin, # binaries for Unix fcDocStart, # links to documentation for Windows installer - fcNimble # nimble package files to copy to /opt/nimble/pkgs/pkg-ver + fcNimble # nimble package files to copy to /opt/nimble/pkgs2/pkg-ver-checksum ConfigData = object of RootObj actions: set[Action] @@ -63,6 +63,7 @@ type nimArgs: string debOpts: TDebOptions nimblePkgName: string + checksum: string const unixDirVars: array[fcConfig..fcLib, string] = [