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 --- completion/bash.in | 4 ++-- doc/pakku.8.txt | 3 +++ src/pacman.nim | 30 ++++++++++++++++++------------ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/completion/bash.in b/completion/bash.in index 86abb69..4663565 100644 --- a/completion/bash.in +++ b/completion/bash.in @@ -19,7 +19,7 @@ _pakku() { remove=('cascade dbonly nodeps assume-installed nosave print recursive unneeded' 'c n p s u') sync=('asdeps asexplicit clean dbonly downloadonly force groups ignore ignoregroup info list needed nodeps assume-installed print refresh recursive search sysupgrade - noaur build' + build keyserver noaur' 'c g i l p s u w y') upgrade=('asdeps asexplicit force needed nodeps assume-installed print recursive' 'p') common=('arch cachedir color config confirm dbpath debug gpgdir help hookdir logfile @@ -33,7 +33,7 @@ _pakku() { if [[ $? != 0 ]]; then _arch_ptr2comp core elif [[ ! $prev =~ ^-\w*[Vbhr] && - ! $prev = --@(cachedir|color|config|dbpath|help|hookdir|gpgdir|logfile|root|version) ]] + ! $prev = --@(cachedir|color|config|dbpath|help|hookdir|gpgdir|keyserver|logfile|root|version) ]] then [[ $cur = -* ]] && _arch_ptr2comp ${o#* } common || case ${o% *} in diff --git a/doc/pakku.8.txt b/doc/pakku.8.txt index 5f183db..7513ac2 100644 --- a/doc/pakku.8.txt +++ b/doc/pakku.8.txt @@ -31,6 +31,9 @@ Sync Options (apply to '-S')[[SO]] Build packages from source. Building is supported for directly specified packages only, so it will not work for package groups or virtual packages. +*\--keyserver* :: + Use name as keyserver to receive keys from. + *\--noaur*:: Disable AUR support. This option is assumed when you use non-standard root path, allow downgrading using twice specified '-u', skip dependency 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