summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
Diffstat (limited to 'guix')
-rw-r--r--guix/profiles.scm1
-rw-r--r--guix/read-print.scm38
-rw-r--r--guix/scripts/package.scm2
-rw-r--r--guix/scripts/pull.scm3
-rw-r--r--guix/scripts/system.scm6
-rw-r--r--guix/scripts/system/reconfigure.scm4
6 files changed, 47 insertions, 7 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 6aaaa4f6c0..226d316dad 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -129,6 +129,7 @@
packages->manifest
ca-certificate-bundle
%default-profile-hooks
+ %manifest-format-version
profile-derivation
profile-search-paths
load-profile
diff --git a/guix/read-print.scm b/guix/read-print.scm
index 63ff9ca5bd..00dde870f4 100644
--- a/guix/read-print.scm
+++ b/guix/read-print.scm
@@ -22,6 +22,7 @@
#:use-module (ice-9 rdelim)
#:use-module (ice-9 vlist)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (guix i18n)
@@ -426,6 +427,34 @@ each line except the first one (they're assumed to be already there)."
(display (make-string indent #\space) port)
(loop tail)))))
+(define %symbols-followed-by-octal-integers
+ ;; Symbols for which the following integer must be printed as octal.
+ '(chmod umask mkdir mkstemp))
+
+(define %symbols-followed-by-hexadecimal-integers
+ ;; Likewise, for hexadecimal integers.
+ '(logand logior logxor lognot))
+
+(define (integer->string integer context)
+ "Render INTEGER as a string using a base suitable based on CONTEXT."
+ (define base
+ (match context
+ ((head . tail)
+ (cond ((memq head %symbols-followed-by-octal-integers) 8)
+ ((memq head %symbols-followed-by-hexadecimal-integers)
+ (if (any (cut memq <> %symbols-followed-by-octal-integers)
+ tail)
+ 8
+ 16))
+ (else 10)))
+ (_ 10)))
+
+ (string-append (match base
+ (10 "")
+ (16 "#x")
+ (8 "#o"))
+ (number->string integer base)))
+
(define* (pretty-print-with-comments port obj
#:key
(format-comment
@@ -661,9 +690,12 @@ FORMAT-VERTICAL-SPACE; a useful value of 'canonicalize-vertical-space'."
(display ")" port)
(+ column 1)))))
(_
- (let* ((str (if (string? obj)
- (escaped-string obj)
- (object->string obj)))
+ (let* ((str (cond ((string? obj)
+ (escaped-string obj))
+ ((integer? obj)
+ (integer->string obj context))
+ (else
+ (object->string obj))))
(len (string-width str)))
(if (and (> (+ column 1 len) max-width)
(not delimited?))
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 404925cb5a..134337b13e 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -146,6 +146,7 @@ denote ranges as interpreted by 'matching-generations'."
dry-run?
(hooks %default-profile-hooks)
allow-collisions?
+ (format-version %manifest-format-version)
bootstrap?)
"Build a new generation of PROFILE, a file name, using the packages
specified in MANIFEST, a manifest object. When ALLOW-COLLISIONS? is true,
@@ -155,6 +156,7 @@ hooks\" run when building the profile."
(profile-derivation manifest
#:allow-collisions? allow-collisions?
#:hooks (if bootstrap? '() hooks)
+ #:format-version format-version
#:locales? (not bootstrap?))))
(prof (derivation->output-path prof-drv)))
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index b0cc459d63..19224cf70b 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -452,6 +452,9 @@ true, display what would be built without actually building it."
(mlet %store-monad ((manifest (channel-instances->manifest instances)))
(mbegin %store-monad
(update-profile profile manifest
+ ;; Create a version 3 profile so that it is readable by
+ ;; old instances of Guix.
+ #:format-version 3
#:hooks %channel-profile-hooks)
(return
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 443e9d3282..4bcf789703 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -41,6 +41,7 @@
#:use-module (guix grafts)
#:use-module (guix gexp)
#:use-module (guix derivations)
+ #:use-module (guix diagnostics)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (guix monads)
@@ -1257,7 +1258,10 @@ resulting from command-line parsing."
(size image-size)
(volatile-root? volatile?)
(shared-network? shared-network?))))
- (os (image-operating-system image))
+ (os (or (image-operating-system image)
+ (raise
+ (formatted-message
+ (G_ "image lacks an operating-system")))))
(target-file (match args
((first second) second)
(_ #f)))
diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm
index a173e011b4..f12bc2db88 100644
--- a/guix/scripts/system/reconfigure.scm
+++ b/guix/scripts/system/reconfigure.scm
@@ -35,7 +35,6 @@
#:use-module (guix monads)
#:use-module (guix store)
#:use-module ((guix self) #:select (make-config.scm))
- #:autoload (guix describe) (current-profile)
#:use-module (guix channels)
#:autoload (guix git) (update-cached-checkout)
#:use-module (guix i18n)
@@ -374,8 +373,7 @@ currently-deployed commit (from CURRENT-CHANNELS, which is as returned by
'guix system describe' by default) and the target commit (as returned by 'guix
describe')."
(define new
- (or (and=> (current-profile) profile-channels)
- '()))
+ ((@ (guix describe) current-channels)))
(when (null? current-channels)
(warning (G_ "cannot determine provenance for current system~%")))