On Sun,  8 Jan 2017 23:32, ijack...@chiark.greenend.org.uk said:
> dgit test suite.  But I have to jump through hoops to do so: I end up
> putting a stunt gpg program on the PATH so that I can pass
> --agent-program.

Obviously we had the same problem in the test suite and thus we
implemented an ugly hack to pass additional options via the
--agent-program option:

      else if ((s=strchr (agent_program, '|')) && s[1] == '-' && s[2]=='-')
        {
          /* Hack to insert an additional option on the command line.  */
          program = xtrystrdup (agent_program);
          if (!program)
            {
              gpg_error_t tmperr = gpg_err_make (errsource,
                                                 gpg_err_code_from_syserror ());
              xfree (sockname);
              assuan_release (ctx);
              return tmperr;
            }
          p = strchr (program, '|');
          *p++ = 0;
          program_arg = p;
        }

We use use it like this in the test suite:

  (define (create-gpghome)
    (log "Creating test environment...")
  
    (srandom (getpid))
    (make-test-data "random_seed" 600)
  
    (log "Creating configuration files")
    (for-each
     (lambda (name)
       (file-copy (in-srcdir (string-append name ".tmpl")) name)
       (let ((p (open-input-output-file name)))
         (cond
        ((string=? "gpg.conf" name)
         (if have-opt-always-trust
             (display "no-auto-check-trustdb\n" p))
         (display (string-append "agent-program "
                                 (tool 'gpg-agent)
                                 "|--debug-quick-random\n") p)
         (display "allow-weak-digest-algos\n" p))
        ((string=? "gpg-agent.conf" name)
         (display (string-append "pinentry-program " PINENTRY "\n") p)))))
     '("gpg.conf" "gpg-agent.conf")))

I would suggest to have a close look at the test suite to see how to do
certain things.  For example we recently introduced a --build-prefix
option to gpgconf to setup a different build directory to replace other
hacks to use the binaries from the build directory:

  (define gpg-components (apply gpg-conf
                        `(,@(if installed? '()
                                (list '--build-prefix (getenv "objdir")))
                          --list-components)))

For help with using gnupg I would kindly suggest to mail to gnupg-devel
and not to open a bug for each question.


Shalom-Salam,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

Attachment: pgp38J2BysaND.pgp
Description: PGP signature

Reply via email to