diff options
author | Maxime Devos <maximedevos@telenet.be> | 2021-01-26 12:48:36 +0100 |
---|---|---|
committer | Maxime Devos <maximedevos@telenet.be> | 2021-09-21 12:08:31 +0200 |
commit | 95303b4263d759a3f9635d631bad1088efc5b900 (patch) | |
tree | 4419b6ddbc3f89e7ac9333f58a00b318a5be49fc /gnu/gnunet/scripts/guix-stuff.scm | |
parent | 606563fe3063398a509fb8389093837830a79261 (diff) | |
download | gnunet-scheme-95303b4263d759a3f9635d631bad1088efc5b900.tar.gz gnunet-scheme-95303b4263d759a3f9635d631bad1088efc5b900.zip |
Add missing dependency ‘guix-stuff.scm’
Fragment extracted from Guix source code.
* gnu/gnunet/scripts/guix-stuff.scm
(call-with-temporary-output-file): copy procedure from upstream
Diffstat (limited to 'gnu/gnunet/scripts/guix-stuff.scm')
-rw-r--r-- | gnu/gnunet/scripts/guix-stuff.scm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gnu/gnunet/scripts/guix-stuff.scm b/gnu/gnunet/scripts/guix-stuff.scm new file mode 100644 index 0000000..37f0601 --- /dev/null +++ b/gnu/gnunet/scripts/guix-stuff.scm | |||
@@ -0,0 +1,38 @@ | |||
1 | ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> | ||
2 | ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org> | ||
3 | ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> | ||
4 | ;;; | ||
5 | ;;; This file is part of GNU Guix. | ||
6 | ;;; | ||
7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | ||
8 | ;;; under the terms of the GNU General Public License as published by | ||
9 | ;;; the Free Software Foundation; either version 3 of the License, or (at | ||
10 | ;;; your option) any later version. | ||
11 | ;;; | ||
12 | ;;; GNU Guix is distributed in the hope that it will be useful, but | ||
13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | ;;; GNU General Public License for more details. | ||
16 | ;;; | ||
17 | ;;; You should have received a copy of the GNU General Public License | ||
18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | ||
19 | |||
20 | (define-module (gnu gnunet scripts guix-stuff) | ||
21 | #:export (call-with-temporary-output-file)) | ||
22 | |||
23 | (define (call-with-temporary-output-file proc) | ||
24 | "Call PROC with a name of a temporary file and open output port to that | ||
25 | file; close the file and delete it when leaving the dynamic extent of this | ||
26 | call." | ||
27 | (let* ((directory (or (getenv "TMPDIR") "/tmp")) | ||
28 | (template (string-append directory "/guix-file.XXXXXX")) | ||
29 | (out (mkstemp! template))) | ||
30 | (dynamic-wind | ||
31 | (lambda () | ||
32 | #t) | ||
33 | (lambda () | ||
34 | (proc template out)) | ||
35 | (lambda () | ||
36 | (false-if-exception (close out)) | ||
37 | (false-if-exception (delete-file template)))))) | ||
38 | |||