diff options
author | Mathieu Othacehe <m.othacehe@gmail.com> | 2019-04-21 12:06:25 +0200 |
---|---|---|
committer | Mathieu Othacehe <m.othacehe@gmail.com> | 2019-04-21 12:12:11 +0200 |
commit | 33023baac8ec548fe64ce8e4eb48840b5411ee4c (patch) | |
tree | bf3afd7446da16a0059c68790ba151c5b84fdfc7 | |
parent | 9729b6ea2fe89d5b8cfd180ef2dfca367c7417e5 (diff) | |
download | patches-33023baac8ec548fe64ce8e4eb48840b5411ee4c.tar patches-33023baac8ec548fe64ce8e4eb48840b5411ee4c.tar.gz |
installer: Fix skip-to-step issue.
When trying to jump to the first step, DONE-STEPS ends-up being null, which
fails the matching condition.
* gnu/installer/steps.scm (skip-to-step): Split matching conditions to handle
the empty DONE-STEPS case properly.
-rw-r--r-- | gnu/installer/steps.scm | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/gnu/installer/steps.scm b/gnu/installer/steps.scm index 1483cdc3db..039dd0ca10 100644 --- a/gnu/installer/steps.scm +++ b/gnu/installer/steps.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> +;;; Copyright © 2018, 2019 Mathieu Othacehe <m.othacehe@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -113,16 +113,24 @@ return the accumalated result so far." (define* (skip-to-step step result #:key todo-steps done-steps) - (match (list todo-steps done-steps) - (((todo . rest-todo) (prev-done ... last-done)) - (if (eq? (installer-step-id todo) - (installer-step-id step)) + (match todo-steps + ((todo . rest-todo) + (let ((found? (eq? (installer-step-id todo) + (installer-step-id step)))) + (cond + (found? (run result #:todo-steps todo-steps - #:done-steps done-steps) - (skip-to-step step (pop-result result) - #:todo-steps (cons last-done todo-steps) - #:done-steps prev-done))))) + #:done-steps done-steps)) + ((and (not found?) + (null? done-steps)) + (error (format #f "Step ~a not found" (installer-step-id step)))) + (else + (match done-steps + ((prev-done ... last-done) + (skip-to-step step (pop-result result) + #:todo-steps (cons last-done todo-steps) + #:done-steps prev-done))))))))) (define* (run result #:key todo-steps done-steps) (match todo-steps |