diff --git a/kpkg/modules/dephandler.nim b/kpkg/modules/dephandler.nim index 3b2867df..4b64dfd2 100644 --- a/kpkg/modules/dephandler.nim +++ b/kpkg/modules/dephandler.nim @@ -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) diff --git a/kpkg/modules/removeInternal.nim b/kpkg/modules/removeInternal.nim index d6c0612f..1e1874d4 100644 --- a/kpkg/modules/removeInternal.nim +++ b/kpkg/modules/removeInternal.nim @@ -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: @@ -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: