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.
This commit is contained in:
Mathieu Othacehe 2019-04-21 12:06:25 +02:00
parent 9729b6ea2f
commit 33023baac8
No known key found for this signature in database
GPG key ID: 8354763531769CA6

View file

@ -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 @@ (define (first-step? steps step)
(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