~ chicken-core (chicken-5) a0eee6e938af40532996398223123b9ae9f549b8


commit a0eee6e938af40532996398223123b9ae9f549b8
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Fri Nov 8 06:28:27 2013 +1300
Commit:     Peter Bex <peter.bex@xs4all.nl>
CommitDate: Fri Nov 8 15:51:26 2013 +0100

    Warn and exit when the user declines an egg upgrade during chicken-install
    
    This avoids an error when the user declines an egg upgrade, since that
    extension doesn't go into eggs+dirs+vers but the installation carries on
    regardless (and its dependency associates to #f where an e+d+v is
    expected).
    
    Signed-off-by: Peter Bex <peter.bex@xs4all.nl>

diff --git a/chicken-install.scm b/chicken-install.scm
index 8df88658..6f2dafe5 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -576,7 +576,13 @@
     (unless *retrieve-only*
       (let* ((dag (reverse (topological-sort *dependencies* string=?)))
 	     (num (length dag))
-	     (depinstall-ok *force*))
+	     (depinstall-ok *force*)
+	     (eggs+dirs+vers (map (cut assoc <> *eggs+dirs+vers*) dag)))
+	(and-let* ((ibad (list-index not eggs+dirs+vers)))
+	  ;; A dependency was left unretrieved, most likely because the user declined an upgrade.
+	  (fprintf (current-error-port) "\nUnresolved dependency: ~a\n\n" (list-ref dag ibad))
+	  (cleanup)
+	  (exit 1))
 	(print "install order:")
 	(pp dag)
 	(for-each
@@ -646,7 +652,7 @@
 		   (print "installing for target ...")
 		   (fluid-let ((*host-extension* #f))
 		     (setup tmpcopy)))))))
-	 (map (cut assoc <> *eggs+dirs+vers*) dag)
+	 eggs+dirs+vers
 	 (iota num num -1)))))
 
   (define (delete-stale-binaries)
Trap