[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
10/13: utils: Add 'switch-symlinks', moved from (guix ui).
From: |
Ludovic Courtès |
Subject: |
10/13: utils: Add 'switch-symlinks', moved from (guix ui). |
Date: |
Mon, 26 Oct 2015 23:02:28 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit 3bb168b0997d2ba2ef15e8eef2890582c8a6df9c
Author: Ludovic Courtès <address@hidden>
Date: Mon Oct 26 22:17:25 2015 +0100
utils: Add 'switch-symlinks', moved from (guix ui).
* guix/ui.scm (switch-symlinks): Move to...
* guix/utils.scm: ... here. New procedure.
* guix/scripts/pull.scm: Use it.
---
guix/scripts/pull.scm | 1 +
guix/ui.scm | 8 --------
guix/utils.scm | 8 ++++++++
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 56ee9ac..a4824e4 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -18,6 +18,7 @@
(define-module (guix scripts pull)
#:use-module (guix ui)
+ #:use-module (guix utils)
#:use-module (guix scripts)
#:use-module (guix store)
#:use-module (guix config)
diff --git a/guix/ui.scm b/guix/ui.scm
index c45c50f..b7ed5e7 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -73,7 +73,6 @@
read/eval
read/eval-package-expression
location->string
- switch-symlinks
config-directory
fill-paragraph
texi->plain-text
@@ -715,13 +714,6 @@ replacement if PORT is not Unicode-capable."
(($ <location> file line column)
(format #f "~a:~a:~a" file line column))))
-(define (switch-symlinks link target)
- "Atomically switch LINK, a symbolic link, to point to TARGET. Works
-both when LINK already exists and when it does not."
- (let ((pivot (string-append link ".new")))
- (symlink target pivot)
- (rename-file pivot link)))
-
(define (config-directory)
"Return the name of the configuration directory, after making sure that it
exists. Honor the XDG specs,
diff --git a/guix/utils.scm b/guix/utils.scm
index f1317ac..1542e86 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -74,6 +74,7 @@
arguments-from-environment-variable
file-extension
file-sans-extension
+ switch-symlinks
call-with-temporary-output-file
call-with-temporary-directory
with-atomic-file-output
@@ -557,6 +558,13 @@ minor version numbers from version-string."
(substring file 0 dot)
file)))
+(define (switch-symlinks link target)
+ "Atomically switch LINK, a symbolic link, to point to TARGET. Works
+both when LINK already exists and when it does not."
+ (let ((pivot (string-append link ".new")))
+ (symlink target pivot)
+ (rename-file pivot link)))
+
(define* (string-replace-substring str substr replacement
#:optional
(start 0)
- branch master updated (64a7192 -> 7e9b07b), Ludovic Courtès, 2015/10/26
- 02/13: gnu: Add python-file., Ludovic Courtès, 2015/10/26
- 01/13: gnu: Add RPM., Ludovic Courtès, 2015/10/26
- 03/13: doc: Add a REPL example., Ludovic Courtès, 2015/10/26
- 06/13: utils: Add 'readlink*'., Ludovic Courtès, 2015/10/26
- 05/13: guix system: Extract action processing., Ludovic Courtès, 2015/10/26
- 04/13: ui: Add 'matching-generations'., Ludovic Courtès, 2015/10/26
- 07/13: ui: Add procedures to display a profile generation., Ludovic Courtès, 2015/10/26
- 08/13: guix system: Factorize boot parameter parsing., Ludovic Courtès, 2015/10/26
- 10/13: utils: Add 'switch-symlinks', moved from (guix ui).,
Ludovic Courtès <=
- 09/13: guix system: Add the 'list-generations' command., Ludovic Courtès, 2015/10/26
- 11/13: profiles: Add generation manipulation procedures., Ludovic Courtès, 2015/10/26
- 12/13: gnu: Add xcompmgr., Ludovic Courtès, 2015/10/26
- 13/13: gnu: Add yapet., Ludovic Courtès, 2015/10/26