GNU bug report logs -
#75010
[PATCH 0/7] Roll back when deployment fails.
Previous Next
Full log
Message #32 received at 75010 <at> debbugs.gnu.org (full text, mbox):
Herman Rimm <herman <at> rimm.ee> skribis:
> * gnu/tests/deploy.scm: Add file.
>
> Change-Id: I348c8bf2e518ec6c00af126993eaca3fcd453901
Yay, nice!
Could you add it to ‘gnu/local.mk’?
> +(define (machines os)
> + (program-file "machines.scm"
> + #~(list (machine (configuration
This should be ‘scheme-file’ (with normal indentation).
> +(define* (deploy-program #:optional (os #~%simple-os))
> + (program-file "deploy.scm"
> + (with-extensions (list guile-gcrypt)
> + (with-imported-modules `(,@(source-module-closure
> + '((guix scripts deploy))
> + #:select? not-config?)
> + ((guix config) => ,(make-config.scm)))
> + #~(begin
> + (use-modules (guix scripts deploy))
> + (guix-deploy #$(machines os)))))))
We could use the ‘guix’ package here: it would be faster, but then we
would be testing an older snapshot and not the code at hand. Not great.
Still, maybe using ‘current-guix’ would be faster (fewer things to
build), as in:
#~(execl #$(file-append (current-guix) "/bin/guix")
"guix" "deploy“ #$(machines os))
> + (define (system-generations marionette)
> + (marionette-eval
> + '(begin
> + (use-modules (ice-9 ftw)
> + (srfi srfi-1))
> + (let* ((profile-dir "/var/guix/profiles/")
> + (entries (map first (cddr (file-system-tree profile-dir)))))
Please use ‘match’ rather than ‘first’ and ‘cddr’ (info "(guix) Data
Types and Pattern Matching").
Or maybe you could just as well use ‘scandir’?
> + (test-equal "script created new generation"
> + (length (system-generations marionette))
> + (1+ (length generations-prior)))
> +
> + (test-equal "script activated the new generation"
> + (string-append "/var/guix/profiles/system-"
> + (number->string (+ 1 (length generations-prior)))
> + "-link")
> + (marionette-eval '(readlink "/run/current-system")
> + marionette)))
We could also check other things, like the host name.
Ludo’.
This bug report was last modified 14 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.