summaryrefslogtreecommitdiff
path: root/guix/ui.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-05-12 22:39:33 +0200
committerLudovic Courtès <ludo@gnu.org>2017-05-13 00:03:46 +0200
commite06ca952ed150c50109b1a29cd0e3645a80023a2 (patch)
tree03e0d146be46cdc249c1d04a5a2d16c194112819 /guix/ui.scm
parent0be9b4a9c18502ddd9fc56612e076121958be2ef (diff)
scripts: Do not create the config directory.
This fixes runs of 'guix package' and 'guix system' tests in environments where $HOME is read-only. * guix/ui.scm (config-directory): Add #:ensure? parameter and honor it. * guix/scripts.scm (warn-about-old-distro): Pass #:ensure? #f to 'config-directory'.
Diffstat (limited to 'guix/ui.scm')
-rw-r--r--guix/ui.scm7
1 files changed, 4 insertions, 3 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index e7cb40927b..edd04daa81 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -775,9 +775,9 @@ replacement if PORT is not Unicode-capable."
(($ <location> file line column)
(format #f "~a:~a:~a" file line column))))
-(define (config-directory)
+(define* (config-directory #:key (ensure? #t))
"Return the name of the configuration directory, after making sure that it
-exists. Honor the XDG specs,
+exists if ENSURE? is true. Honor the XDG specs,
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>."
(let ((dir (and=> (or (getenv "XDG_CONFIG_HOME")
(and=> (getenv "HOME")
@@ -785,7 +785,8 @@ exists. Honor the XDG specs,
(cut string-append <> "/guix"))))
(catch 'system-error
(lambda ()
- (mkdir-p dir)
+ (when ensure?
+ (mkdir-p dir))
dir)
(lambda args
(let ((err (system-error-errno args)))