Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgomez committed Nov 20, 2024
1 parent 74062c2 commit 89a2d6d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/nimblepkg/nimblesat.nim
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,11 @@ proc getSolvedPackages*(pkgVersionTable: Table[string, PackageVersions], output:
for ver in p.versions.items:
for dep, q in items graph.reqs[ver.req].deps:
if dep notin graph.packageToDependency:
#debug print. show all packacges in the graph
for k, v in pkgVersionTable:
output.add &"Package {k} \n"
for v in v.versions:
output.add &"\t \t Version {v.version} requires: {v.requires} \n"
output.add &"Dependency {dep} not found in the graph \n"
return newSeq[SolvedPackage]()

Expand Down Expand Up @@ -446,7 +451,7 @@ proc getPackageMinimalVersionsFromRepo*(repoDir, pkgName: string, downloadMethod
let tags = getTagsList(repoDir, downloadMethod).getVersionList()
var checkedTags = 0
for (ver, tag) in tags.pairs:
if checkedTags >= options.maxTaggedVersions:
if options.maxTaggedVersions > 0 and checkedTags >= options.maxTaggedVersions:
# echo &"Tag limit reached for {pkgName}"
break
inc checkedTags
Expand All @@ -463,7 +468,8 @@ proc getPackageMinimalVersionsFromRepo*(repoDir, pkgName: string, downloadMethod
proc downloadMinimalPackage*(pv: PkgTuple, options: Options): seq[PackageMinimalInfo] =
if pv.name == "": return newSeq[PackageMinimalInfo]()
if pv.isNim and not options.disableNimBinaries: return getAllNimReleases(options)

if pv.ver.kind == verSpecial:
return @[downloadPkInfoForPv(pv, options).getMinimalInfo(options)]
let (downloadRes, downloadMeth) = downloadPkgFromUrl(pv, options)
getPackageMinimalVersionsFromRepo(downloadRes.dir, pv.name, downloadMeth, options)

Expand Down
2 changes: 1 addition & 1 deletion src/nimblepkg/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ proc initOptions*(): Options =
noColor: not isatty(stdout),
startDir: getCurrentDir(),
nimBinariesDir: getHomeDir() / ".nimble" / "nimbinaries",
maxTaggedVersions: 2 #TODO increase once we have a cache
maxTaggedVersions: 0 #TODO increase once we have a cache
)

proc handleUnknownFlags(options: var Options) =
Expand Down
9 changes: 7 additions & 2 deletions tests/tsat.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import unittest, os
import testscommon
# from nimblepkg/common import cd Used in the commented tests
import std/[tables, sequtils, json, jsonutils, strutils, times, options, strformat]
import nimblepkg/[version, nimblesat, options, config, download, packageparser, packageinfotypes, tools, packageinfo, cli]
import nimblepkg/[version, nimblesat, options, config, download, packageinfotypes, packageinfo]
from nimblepkg/common import cd

proc initFromJson*(dst: var PkgTuple, jsonNode: JsonNode, jsonPath: var string) =
Expand Down Expand Up @@ -364,4 +364,9 @@ suite "SAT solver":
cd "wronglytaggednim":
removeDir("nimbledeps")
let (_, exitCode) = execNimble("install", "-l")
check exitCode == QuitSuccess
check exitCode == QuitSuccess


#[
- TODO make sure all collected version requires are enumerated (they need to be taken into account in collectAllVersions after the getPackageMinimalVersionsFromRepo call)
]#

0 comments on commit 89a2d6d

Please sign in to comment.