Skip to content

Commit

Permalink
kpkg: Fix removeInternal dependency check
Browse files Browse the repository at this point in the history
  • Loading branch information
kreatoo committed Sep 23, 2023
1 parent a510228 commit aac85d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions kpkg/modules/dephandler.nim
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,20 @@ proc checkVersions(root: string, dependency: string, repo: string, split = @[

proc dephandler*(pkgs: seq[string], ignoreDeps = @[" "], bdeps = false,
isBuild = false, root: string, prevPkgName = "",
forceInstallAll = false): seq[string] =
forceInstallAll = false, chkInstalledDirInstead = false): seq[string] =
## takes in a seq of packages and returns what to install.

var deps: seq[string]
let init = getInit(root)

for pkg in pkgs:
var repo = findPkgRepo(pkg)
var repo: string

if not chkInstalledDirInstead:
repo = findPkgRepo(pkg)
else:
repo = root&"/var/cache/kpkg/installed"

if repo == "":
err("Package "&pkg&" doesn't exist", false)

Expand Down
5 changes: 4 additions & 1 deletion kpkg/modules/removeInternal.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ proc dependencyCheck(package: string, installedDir: string, root: string, force:
## Checks if a package is a dependency on another package.
setCurrentDir(installedDir)
for i in toSeq(walkDirs("*")):
let d = dephandler(@[i], root = root)
let d = dephandler(@[i], root = root, forceInstallAll = true,
chkInstalledDirInstead = true)
for a in d:
if a == package:
if force:
Expand Down Expand Up @@ -45,6 +46,8 @@ proc removeInternal*(package: string, root = "",
pkg = parseRunfile(installedDir&"/"&actualPackage)

if depCheck:
debug "Dependency check starting"
debug package&" "&installedDir&" "&root
dependencyCheck(package, installedDir, root, force)

if not pkg.isGroup:
Expand Down

0 comments on commit aac85d5

Please sign in to comment.