aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkitsunyan2018-03-18 21:54:00 +0000
committerkitsunyan2018-03-18 21:54:00 +0000
commitd1aa67f2c5fc2ee7a74037f38c6b79ca339cc2e4 (patch)
tree8f5f2c934507537ba45486424241f582c21c987e
parentf0f1a5cd5e0f32f464c9bbef18e0f28d7119964e (diff)
Allow to specify keyserver using "--keyserver" option
-rw-r--r--completion/bash.in4
-rw-r--r--doc/pakku.8.txt3
-rw-r--r--src/pacman.nim30
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* <name>::
+ 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,