Imported Upstream version 2.1.14
[platform/upstream/gpg2.git] / tests / migrations / common.scm
1 ;; Copyright (C) 2016 g10 Code GmbH
2 ;;
3 ;; This file is part of GnuPG.
4 ;;
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.
9 ;;
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.
14 ;;
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/>.
17
18 (if (string=? "" (getenv "srcdir"))
19     (error "not called from make"))
20
21 (setenv "GNUPGHOME" "" #t)
22
23 (define (qualify executable)
24   (string-append executable (getenv "EXEEXT")))
25
26 ;; We may not use a relative name for gpg-agent.
27 (define GPG-AGENT (qualify (string-append (getcwd) "/../../agent/gpg-agent")))
28 (define GPG `(,(qualify (string-append (getcwd) "/../../g10/gpg"))
29               --no-permission-warning --no-greeting
30               --no-secmem-warning --batch
31               ,(string-append "--agent-program=" GPG-AGENT
32                               "|--debug-quick-random")))
33 (define GPGTAR (qualify (string-append (getcwd) "/../../tools/gpgtar")))
34
35 (define (untar-armored source-name)
36   (pipe:do
37    (pipe:open source-name (logior O_RDONLY O_BINARY))
38    (pipe:spawn `(,@GPG --dearmor))
39    (pipe:spawn `(,GPGTAR --extract --directory=. -))))