From 210058ec401946f0faa654fdacf6f04fea31a272 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 ++-- koch.nim | 2 +- tools/niminst/deinstall.nimf | 6 +++--- tools/niminst/install.nimf | 6 +++--- tools/niminst/niminst.nim | 3 ++- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/compiler/commands.nim b/compiler/commands.nim index 9b7e357913a23..4a2298e835682 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 a16b669c45910..46a861bd5b199 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 9cd2941ba46f8..17b4e0de1b91a 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 3b964d124e243..2d50515ab6f6c 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/koch.nim b/koch.nim index 8dd897028f281..3516004ddeb96 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/tools/niminst/deinstall.nimf b/tools/niminst/deinstall.nimf index 0dcfda75e717f..34424b3bdad41 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 c2fc96e94d431..60b4858b70037 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 d81b98be9f3d2..ef83ace62f26f 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] = [