aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkitsunyan2018-03-18 21:54:00 +0000
committerkitsunyan2018-03-18 21:54:00 +0000
commitd1aa67f2c5fc2ee7a74037f38c6b79ca339cc2e4 (patch)
tree8f5f2c934507537ba45486424241f582c21c987e /src
parentf0f1a5cd5e0f32f464c9bbef18e0f28d7119964e (diff)
Allow to specify keyserver using "--keyserver" option
Diffstat (limited to 'src')
-rw-r--r--src/pacman.nim30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/pacman.nim b/src/pacman.nim
index 37dbd57..5315df1 100644
--- a/src/pacman.nim
+++ b/src/pacman.nim
@@ -140,6 +140,7 @@ const
o("w", "downloadonly"),
o("y", "refresh") + g(syncInstall, syncSearch, syncQuery),
$o("build") + g(syncInstall),
+ $(^o("keyserver")) + g(syncInstall),
$o("noaur") + g(syncInstall)
]
@@ -174,7 +175,8 @@ const
syncConflictingOptions*: seq[ConflictingOptions] = @[
("asdeps", @["asexplicit"]),
("build", @["nodeps", "assume-installed", "dbonly", "clean",
- "groups", "info", "list", "search", "sysupgrade", "downloadonly"])
+ "groups", "info", "list", "search", "sysupgrade", "downloadonly"]),
+ ("keyserver", @["clean", "groups", "info", "list", "search"])
]
allConflictingOptions = syncConflictingOptions
@@ -357,17 +359,21 @@ proc obtainPacmanConfig*(args: seq[Argument]): PacmanConfig =
let pgpKeyserver = if hasKeyserver:
none(string)
else: (block:
- var pgpKeyserver = none(string)
- var file: File
- if file.open(gpg.get(sysConfDir & "/pacman.d/gnupg") & "/gpg.conf"):
- try:
- while true:
- let line = file.readLine()
- if line.len > 10 and line[0 .. 9] == "keyserver ":
- pgpKeyserver = some(line[9 .. ^1].strip)
- except:
- discard
- pgpKeyserver)
+ let argPgpKeyserver = getAll((none(string), "keyserver")).optLast
+ if argPgpKeyserver.isSome:
+ argPgpKeyserver
+ else:
+ var pgpKeyserver = none(string)
+ var file: File
+ if file.open(gpg.get(sysConfDir & "/pacman.d/gnupg") & "/gpg.conf"):
+ try:
+ while true:
+ let line = file.readLine()
+ if line.len > 10 and line[0 .. 9] == "keyserver ":
+ pgpKeyserver = some(line[9 .. ^1].strip)
+ except:
+ discard
+ pgpKeyserver)
let config = PacmanConfig(rootOption: root, dbOption: db, gpgOption: gpg,
dbs: defaultConfig.dbs, arch: arch, colorMode: color, debug: debug,