From 3eb14df9811583e4c4034f76604895cf79f311f1 Mon Sep 17 00:00:00 2001 From: j-james Date: Fri, 6 Nov 2020 12:11:37 -0800 Subject: Fix warnings introduced in Nim 1.4 --- .gitignore | 9 +++++++++ src/common.nim | 12 ++++++------ src/config.nim | 4 ++-- src/feature/syncclean.nim | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4aa33f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +nimcache +completion/bash +completion/zsh +lib/tools +src/pakku +doc/pakku.8 +doc/pakku.8.in +doc/pakku.conf.5 +doc/pakku.conf.5.in diff --git a/src/common.nim b/src/common.nim index 3f9013c..618ea42 100644 --- a/src/common.nim +++ b/src/common.nim @@ -233,10 +233,10 @@ proc queryUnrequired*(handle: ptr AlpmHandle, withOptional: bool, withoutOptiona installed.add(pkg.toPackageReference) if pkg.reason == AlpmReason.explicit: explicit &= $pkg.name - dependsTable.add($pkg.name, - depends.map(x => (x, false)) + optional.map(x => (x, true))) + dependsTable[$pkg.name] = + depends.map(x => (x, false)) + optional.map(x => (x, true)) if provides.len > 0: - alternatives.add($pkg.name, provides) + alternatives[$pkg.name] = provides (installed, explicit.toHashSet + assumeExplicit, dependsTable, alternatives) @@ -484,7 +484,7 @@ proc cloneBareRepo(config: Config, bareKind: BareKind, bareName: string, if forkWait(() => (block: if not dropPrivileges or dropPrivileges(): - if existsDir(repoPath): + if dirExists(repoPath): let branch = branchOption.get("master") execResult(gitCmd, "-C", repoPath, "fetch", "-q", "--no-tags", "origin", branch & ":" & branch) @@ -665,7 +665,7 @@ proc cloneAurRepo*(config: Config, base: string, gitUrl: string, if message.isSome: (1, message) - elif repoPath.existsDir(): + elif repoPath.dirExists(): (0, none(string)) else: let fullName = bareFullName(BareKind.pkg, base) @@ -674,7 +674,7 @@ proc cloneAurRepo*(config: Config, base: string, gitUrl: string, let cloneBareCode = forkWait(() => (block: if not dropPrivileges or dropPrivileges(): - if existsDir(bareRepoPath): + if dirExists(bareRepoPath): execResult(gitCmd, "-C", bareRepoPath, "fetch", "-q", "--no-tags", "origin", "master:master") else: diff --git a/src/config.nim b/src/config.nim index e8be1fc..e54b7b9 100644 --- a/src/config.nim +++ b/src/config.nim @@ -81,9 +81,9 @@ proc readConfigFile*(configFile: string): table[currentCategory] = category elif currentCategory.len > 0: if line.match(re"(\w+)\ *=\ *(.*)", matches): - category[].add(matches[0], matches[1]) + category[matches[0]] = matches[1] else: - category[].add(line, "") + category[line] = "" false except EOFError: diff --git a/src/feature/syncclean.nim b/src/feature/syncclean.nim index 6b1f853..ad0c255 100644 --- a/src/feature/syncclean.nim +++ b/src/feature/syncclean.nim @@ -31,7 +31,7 @@ proc handleSyncClean*(args: seq[Argument], config: Config): int = else: echo(tr"removing all package repositories...") - if existsDir(reposCacheDir): + if dirExists(reposCacheDir): withAlpmConfig(config, false, handle, dbs, errors): for e in errors: printError(config.color, e) -- cgit v1.2.3-70-g09d2