mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
common: Support locating components in the build tree.
* common/homedir.c (gnupg_build_directory): New variable. (gnupg_module_name_called): Likewise. (gnupg_set_builddir): New function. (gnupg_set_builddir_from_env): Likewise. (gnupg_module_name): Support locating components in the build tree. * common/util.h (gnupg_set_builddir): New prototype. * tests/openpgp/defs.scm (tools): Drop 'gpg and 'gpg-agent. (tool): Rename to 'tool-hardcoded. (gpg-conf): New function, with accessors for the results. (gpg-components): New variable. (tool): New function. * tools/gpgconf.c (enum cmd_and_opt_values): New key. (opts): New option '--build-prefix'. (main): Handle new option. -- This change makes sure that the components from the build tree are used, and not some older installed version in PATH. It also lets us make GPGME use components from the build tree, making it possible to execute GPGME's test suite with them. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
55dc81125a
commit
ca1e9749bf
4 changed files with 88 additions and 21 deletions
|
@ -56,9 +56,7 @@
|
|||
value)))
|
||||
|
||||
(define tools
|
||||
'((gpg "GPG" "g10/gpg")
|
||||
(gpgv "GPGV" "g10/gpgv")
|
||||
(gpg-agent "GPG_AGENT" "agent/gpg-agent")
|
||||
'((gpgv "GPGV" "g10/gpgv")
|
||||
(gpg-connect-agent "GPG_CONNECT_AGENT" "tools/gpg-connect-agent")
|
||||
(gpgconf "GPGCONF" "tools/gpgconf")
|
||||
(gpg-preset-passphrase "GPG_PRESET_PASSPHRASE"
|
||||
|
@ -67,7 +65,7 @@
|
|||
(gpg-zip "GPGZIP" "tools/gpg-zip")
|
||||
(pinentry "PINENTRY" "tests/openpgp/fake-pinentry")))
|
||||
|
||||
(define (tool which)
|
||||
(define (tool-hardcoded which)
|
||||
(let ((t (assoc which tools))
|
||||
(prefix (getenv "BIN_PREFIX")))
|
||||
(getenv' (cadr t)
|
||||
|
@ -75,6 +73,24 @@
|
|||
(string-append (getenv "objdir") "/" (caddr t))
|
||||
(string-append prefix "/" (basename (caddr t))))))))
|
||||
|
||||
(define (gpg-conf . args)
|
||||
(let ((s (call-popen `(,(tool-hardcoded 'gpgconf) ,@args) "")))
|
||||
(map (lambda (line) (string-split line #\:))
|
||||
(string-split-newlines s))))
|
||||
(define :gc:c:name car)
|
||||
(define :gc:c:description cadr)
|
||||
(define :gc:c:pgmname caddr)
|
||||
|
||||
(setenv "GNUPG_BUILDDIR" (getenv "objdir") #t)
|
||||
(define gpg-components (gpg-conf '--build-prefix (getenv "objdir")
|
||||
'--list-components))
|
||||
|
||||
(define (tool which)
|
||||
(case which
|
||||
((gpg gpg-agent scdaemon gpgsm dirmngr)
|
||||
(:gc:c:pgmname (assoc (symbol->string which) gpg-components)))
|
||||
(else
|
||||
(tool-hardcoded which))))
|
||||
|
||||
(define (gpg-has-option? option)
|
||||
(string-contains? (call-popen `(,(tool 'gpg) --dump-options) "")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue