From d1aa67f2c5fc2ee7a74037f38c6b79ca339cc2e4 Mon Sep 17 00:00:00 2001 From: kitsunyan Date: Mon, 19 Mar 2018 00:54:00 +0300 Subject: Allow to specify keyserver using "--keyserver" option --- src/pacman.nim | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src/pacman.nim') 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, -- cgit v1.2.3-70-g09d2