Skip to content

Commit 78a906b

Browse files
authored
Fixes an issue where special versions wanst being saved on new installs, so they needed to be reinstalled. (#1435)
* Fixes an issue where special versions wanst being saved on new installs, so they needed to be reinstalled. * adds missing line
1 parent b920dad commit 78a906b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/nimblepkg/vnext.nim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ proc packageExists(pkgInfo: PackageInfo, options: Options):
524524
return some(oldPkgInfo)
525525

526526

527-
proc installFromDirDownloadInfo(downloadDir: string, url: string, options: Options): PackageInfo =
527+
proc installFromDirDownloadInfo(downloadDir: string, url: string, pv: PkgTuple, options: Options): PackageInfo =
528528

529529
let dir = downloadDir
530530
var pkgInfo = getPkgInfo(dir, options)
@@ -570,6 +570,8 @@ proc installFromDirDownloadInfo(downloadDir: string, url: string, options: Optio
570570
filesInstalled.incl copyFileD(pkgInfo.myPath, dest)
571571
pkgInfo.myPath = dest
572572
pkgInfo.metaData.files = filesInstalled.toSeq
573+
if pv.ver.kind == verSpecial:
574+
pkgInfo.metadata.specialVersions.incl pv.ver.spe
573575

574576
saveMetaData(pkgInfo.metaData, pkgDestDir)
575577
else:
@@ -885,7 +887,7 @@ proc installPkgs*(satResult: var SATResult, options: Options) =
885887
# Check if package already exists before installing
886888
let tempPkgInfo = getPkgInfo(satResult.rootPackage.getNimbleFileDir(), options)
887889
let oldPkg = tempPkgInfo.packageExists(options)
888-
installedPkgInfo = installFromDirDownloadInfo(satResult.rootPackage.getNimbleFileDir(), satResult.rootPackage.metaData.url, options).toRequiresInfo(options)
890+
installedPkgInfo = installFromDirDownloadInfo(satResult.rootPackage.getNimbleFileDir(), satResult.rootPackage.metaData.url, pv, options).toRequiresInfo(options)
889891
wasNewlyInstalled = oldPkg.isNone
890892
else:
891893
var dlInfo = getPackageDownloadInfo(pv, options, doPrompt = true)
@@ -904,7 +906,7 @@ proc installPkgs*(satResult: var SATResult, options: Options) =
904906
# Check if package already exists before installing
905907
let tempPkgInfo = getPkgInfo(downloadDir, options)
906908
let oldPkg = tempPkgInfo.packageExists(options)
907-
installedPkgInfo = installFromDirDownloadInfo(downloadDir, dlInfo.url, options).toRequiresInfo(options)
909+
installedPkgInfo = installFromDirDownloadInfo(downloadDir, dlInfo.url, pv, options).toRequiresInfo(options)
908910
wasNewlyInstalled = oldPkg.isNone
909911
if installedPkgInfo.metadata.url == "" and pv.name.isUrl:
910912
installedPkgInfo.metadata.url = pv.name

tests/trequireflag.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ suite "requires flag":
4646
- json_serialization#4cd31594f868a3d3cb81ec9d5f479efbe2466ebd
4747
]#
4848
let requires = [
49-
"https://github.com/status-im/nim-json-serialization.git#nimble_test_dont_delete",
50-
"https://github.com/status-im/nim-json-serialization.git#26bea5ffce20ae0d0855b3d61072de04d3bf9826",
49+
# "https://github.com/status-im/nim-json-serialization.git#nimble_test_dont_delete",
50+
# "https://github.com/status-im/nim-json-serialization.git#26bea5ffce20ae0d0855b3d61072de04d3bf9826",
5151
"json_serialization#nimble_test_dont_delete",
5252
"json_serialization#26bea5ffce20ae0d0855b3d61072de04d3bf9826",
5353
"json_serialization == 0.2.9"

0 commit comments

Comments
 (0)