1 ;; Copyright (C) 2016 g10 Code GmbH
3 ;; This file is part of GnuPG.
5 ;; GnuPG is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3 of the License, or
8 ;; (at your option) any later version.
10 ;; GnuPG is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
18 (if (string=? "" (getenv "srcdir"))
19 (error "not called from make"))
21 (let ((verbose (string->number (getenv "verbose"))))
23 (*set-verbose!* verbose)))
25 (define (qualify executable)
26 (string-append executable (getenv "EXEEXT")))
28 ;; We may not use a relative name for gpg-agent.
29 (define GPG-AGENT (path-join (getenv "objdir") "agent" (qualify "gpg-agent")))
30 (define GPG `(,(path-join (getenv "objdir") "g10" (qualify "gpg"))
31 --no-permission-warning --no-greeting
32 --no-secmem-warning --batch
33 ,(string-append "--agent-program=" GPG-AGENT
34 "|--debug-quick-random")))
36 (filter (lambda (arg) (not (equal? arg '--batch))) GPG))
38 (define GPGTAR (path-join (getenv "objdir") "tools" (qualify "gpgtar")))
40 (define (untar-armored source-name)
42 (pipe:open source-name (logior O_RDONLY O_BINARY))
43 (pipe:spawn `(,@GPG --dearmor))
44 (pipe:spawn `(,GPGTAR --extract --directory=. -))))
46 (define (run-test message src-tarball test)
47 (catch (skip "gpgtar not built")
48 (call-check `(,GPGTAR --help)))
50 (with-temporary-working-directory
52 (untar-armored src-tarball)
53 (setenv "GNUPGHOME" (getcwd) #t)