1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

tests: Improve support for gpgconf.

* tests/openpgp/defs.scm: Improve high-level inteface to gpgconf.
* tests/openpgp/gpgconf.scm: Adapt.
* tests/openpgp/tofu.scm: Use it to select the trust model.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-02-28 13:20:57 +01:00
parent ebeccd73eb
commit 41900175cf
No known key found for this signature in database
GPG key ID: DD1A52F9DA8C9020
3 changed files with 50 additions and 40 deletions

View file

@ -149,14 +149,33 @@
(define :gc:c:name car)
(define :gc:c:description cadr)
(define :gc:c:pgmname caddr)
(define (:gc:o:name x) (list-ref x 0))
(define (:gc:o:flags x) (string->number (list-ref x 1)))
(define (:gc:o:level x) (string->number (list-ref x 2)))
(define (:gc:o:description x) (list-ref x 3))
(define (:gc:o:type x) (string->number (list-ref x 4)))
(define (:gc:o:alternate-type x) (string->number (list-ref x 5)))
(define (:gc:o:argument-name x) (list-ref x 6))
(define (:gc:o:default-value x) (list-ref x 7))
(define (:gc:o:default-argument x) (list-ref x 8))
(define (:gc:o:value x) (if (< (length x) 10) "" (list-ref x 9)))
(define (gpg-config component key)
(package
(define (value)
(assoc key (gpg-conf '--list-options component)))
(let* ((conf (assoc key (gpg-conf '--list-options component)))
(type (:gc:o:type conf))
(value (:gc:o:value conf)))
(case type
((0 2 3) (string->number value))
((1 32) (substring value 1 (string-length value))))))
(define (update value)
(gpg-conf' (string-append key ":0:" (percent-encode value))
`(--change-options ,component)))
(let ((value' (cond
((string? value) (string-append "\"" value))
((number? value) (number->string value))
(else (throw "Unsupported value" value)))))
(gpg-conf' (string-append key ":0:" (percent-encode value'))
`(--change-options ,component))))
(define (clear)
(gpg-conf' (string-append key ":16:")
`(--change-options ,component)))))