guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: installer: Fix skip-to-step issue.


From: guix-commits
Subject: 01/01: installer: Fix skip-to-step issue.
Date: Sun, 21 Apr 2019 06:12:20 -0400 (EDT)

mothacehe pushed a commit to branch master
in repository guix.

commit 33023baac8ec548fe64ce8e4eb48840b5411ee4c
Author: Mathieu Othacehe <address@hidden>
Date:   Sun Apr 21 12:06:25 2019 +0200

    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.
---
 gnu/installer/steps.scm | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/gnu/installer/steps.scm b/gnu/installer/steps.scm
index 1483cdc..039dd0c 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 <address@hidden>
+;;; Copyright © 2018, 2019 Mathieu Othacehe <address@hidden>
 ;;;
 ;;; 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]