From 548d0c9ad4e90bb6a8edf9a60cdb7ddd21364f85 Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <tunes@google.com>
Date: Sun, 13 Jan 2013 18:33:10 -0500
Subject: [PATCH] 2.26.87: use read-from-string, not eval-input, for
 ensure-function, as in the good/bad old days.

Also, improve the bump-version script.
---
 Makefile          |  5 ++++-
 asdf.asd          |  2 +-
 bin/bump-version  | 44 ++++++++++++++++++++++++++++----------------
 header.lisp       |  2 +-
 image.lisp        | 17 ++++++++++-------
 plan.lisp         |  2 ++
 stream.lisp       |  3 ++-
 upgrade.lisp      |  2 +-
 utility.lisp      |  2 +-
 version.lisp-expr |  2 +-
 10 files changed, 51 insertions(+), 30 deletions(-)

diff --git a/Makefile b/Makefile
index 8b903c05..e03ea608 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,10 @@ build/asdf.lisp: $(wildcard *.lisp)
 	cat $(driver_lisp) $(asdf_lisp) > $@
 
 wc:
-	wc $(driver_lisp) $(asdf_lisp) | sort -n
+	@wc $(driver_lisp) | sort -n ; echo ; \
+	wc $(asdf_lisp) | sort -n ; \
+	echo ; \
+	wc $(driver_lisp) $(asdf_lisp) | tail -n 1
 
 wc-driver:
 	wc $(driver_lisp)
diff --git a/asdf.asd b/asdf.asd
index 3de1d4a4..9dc13d08 100644
--- a/asdf.asd
+++ b/asdf.asd
@@ -15,7 +15,7 @@
   :licence "MIT"
   :description "Another System Definition Facility"
   :long-description "ASDF builds Common Lisp software organized into defined systems."
-  :version "2.26.86" ;; to be automatically updated by bin/bump-revision
+  :version "2.26.87" ;; to be automatically updated by bin/bump-revision
   :depends-on ()
   :components ((:module "build" :components ((:file "asdf"))))
   :in-order-to (#+asdf2.27 (compile-op (monolithic-load-concatenated-source-op generate-asdf))))
diff --git a/bin/bump-version b/bin/bump-version
index d03238d0..c070e234 100755
--- a/bin/bump-version
+++ b/bin/bump-version
@@ -13,23 +13,34 @@
 
 (asdf-debug)
 
+(resume-image)
+
 (defun afile (x)
   (asdf:system-relative-pathname :asdf x))
 
 (defparameter *version-file*
   (afile "version.lisp-expr"))
 
-(defparameter *old-version*
-  (safe-read-first-file-form *version-file*))
-
-(defparameter *argv* (command-line-arguments))
+(defparameter *old-version* nil)
+(defparameter *new-version* nil)
 
 (defun next-version (v)
   (let ((pv (parse-version v)))
     (incf (third pv))
     (unparse-version pv)))
 
-(defparameter *new-version* (or (first *argv*) (next-version *old-version*)))
+(defun version-from-file ()
+  (safe-read-first-file-form *version-file*))
+
+(defun versions-from-argv (argv)
+  (ecase (length argv)
+    ((2) (values (second argv) (first argv)))
+    ((1) (values (version-from-file) (first argv)))
+    ((0) (let ((old (version-from-file)))
+           (values old (next-version old))))))
+
+(multiple-value-setq (*old-version* *new-version*)
+  (versions-from-argv *command-line-arguments*))
 
 (format t "Bumping ASDF version from ~A to ~A~%" *old-version* *new-version*)
 
@@ -37,18 +48,19 @@
 
 (defun maybe-replace-file (file transformer
                            &key (reader 'read-file-string)
-                             (writer nil) (comparator 'equal)
+                             (writer nil) (comparator 'equalp)
                              (external-format *utf-8-external-format*))
   (let* ((old-contents (funcall reader file))
          (new-contents (funcall transformer old-contents)))
-    (unless (funcall comparator old-contents new-contents)
-      (let ((written-contents
-              (if writer
-                  (with-output (s ())
-                    (funcall writer s new-contents))
-                  new-contents)))
-        (check-type written-contents (or string (byte-vector)))
-        (clobber-file-with-vector file written-contents :external-format external-format)))))
+    (if (funcall comparator old-contents new-contents)
+        (format t "No changes for file ~A~%" file)
+        (let ((written-contents
+                (if writer
+                    (with-output (s ())
+                      (funcall writer s new-contents))
+                    new-contents)))
+          (check-type written-contents (or string (byte-vector)))
+          (clobber-file-with-vector file written-contents :external-format external-format)))))
 
 (defun version-transform (text)
   (flet ((v1 (ver) (format nil "~S" ver))
@@ -56,10 +68,10 @@
          (f (fun text)
            (cl-ppcre:regex-replace-all
             (funcall fun *old-version*) text (funcall fun *new-version*))))
-    (f #'v1 (f #'v2 text))))
+    (f #'v2 (f #'v1 text))))
 
 (defparameter *versioned-files*
-  '("version.lisp-expr" "asdf.asd" "build/asdf.lisp" "upgrade.lisp"))
+  '("version.lisp-expr" "asdf.asd" "header.lisp" "build/asdf.lisp" "upgrade.lisp"))
 
 (defun transform-file (x)
   (format t "Transforming file ~A~%" x)
diff --git a/header.lisp b/header.lisp
index 0a62a800..f78c4e63 100644
--- a/header.lisp
+++ b/header.lisp
@@ -1,5 +1,5 @@
 ;; -*- mode: Common-Lisp; Base: 10 ; Syntax: ANSI-Common-Lisp ; coding: utf-8 -*-
-;;; This is ASDF 2.26.86: Another System Definition Facility.
+;;; This is ASDF 2.26.87: Another System Definition Facility.
 ;;;
 ;;; Feedback, bug reports, and patches are all welcome:
 ;;; please mail to <asdf-devel@common-lisp.net>.
diff --git a/image.lisp b/image.lisp
index cd51a6f2..e02fe2c8 100644
--- a/image.lisp
+++ b/image.lisp
@@ -13,7 +13,7 @@
    #:register-image-resume-hook #:register-image-dump-hook
    #:call-image-resume-hook #:call-image-dump-hook
    #:initialize-asdf-utilities
-   #:resume #:do-resume #:dump-image 
+   #:resume-image #:run-resumed-program #:dump-image 
 ))
 (in-package :asdf/image)
 
@@ -205,15 +205,18 @@ if we are not called from a directly executable image dumped by XCVB."
 (defun setup-command-line-arguments ()
   (setf *command-line-arguments* (command-line-arguments)))
 
-(defun* resume-program (&key (post-image-restart *post-image-restart*) (entry-point *entry-point*))
-  (call-image-resume-hook)
-  (with-safe-io-syntax ()
-    (let ((*read-eval* t))
-      (when post-image-restart (eval-input post-image-restart))))
+(defun* resume-image (&key (post-image-restart *post-image-restart*)
+                           (entry-point *entry-point*)
+                           (image-resume-hook *image-resume-hook*))
+  (call-functions image-resume-hook)
+  (when post-image-restart
+    (with-safe-io-syntax ()
+      (let ((*read-eval* t))
+        (eval-input post-image-restart))))
   (when entry-point
     (apply entry-point *command-line-arguments*)))
 
-(defun* resume ()
+(defun* run-resumed-program ()
   (with-coded-exit ()
     (let ((ret (resume-program)))
       (if (typep ret 'integer)
diff --git a/plan.lisp b/plan.lisp
index ad08a4fc..a4adc795 100644
--- a/plan.lisp
+++ b/plan.lisp
@@ -16,9 +16,11 @@
    #:planned-action-status #:plan-action-status #:action-already-done-p
    #:circular-dependency #:circular-dependency-actions
    #:node-for #:needed-in-image-p
+   #:action-index #:action-planned-p
    #:plan-record-dependency #:visiting-action-p
    #:normalize-forced-systems #:action-forced-p #:action-forced-not-p
    #:visit-dependencies #:compute-action-stamp #:traverse-action
+   #:circular-dependency #:circular-dependency-actions
    #:call-while-visiting-action #:while-visiting-action
    #:traverse-sequentially #:traverse
    #:perform-plan #:plan-operates-on-p))
diff --git a/stream.lisp b/stream.lisp
index 41e43f55..4a922630 100644
--- a/stream.lisp
+++ b/stream.lisp
@@ -129,7 +129,8 @@ Otherwise, signal an error."
 Useful for portably flushing I/O before user input or program exit."
   ;; CCL notably buffers its stream output by default.
   (dolist (s (append streams
-                     (list *stderr* *error-output* *standard-output* *trace-output* *debug-io*)))
+                     (list *stderr* *error-output* *standard-output* *trace-output*
+                           *debug-io* *terminal-io* *debug-io* *query-io*)))
     (ignore-errors (finish-output s)))
   (values))
 
diff --git a/upgrade.lisp b/upgrade.lisp
index 738f71b3..d8376e24 100644
--- a/upgrade.lisp
+++ b/upgrade.lisp
@@ -32,7 +32,7 @@
          ;; "2.345.6" would be a development version in the official upstream
          ;; "2.345.0.7" would be your seventh local modification of official release 2.345
          ;; "2.345.6.7" would be your seventh local modification of development version 2.345.6
-         (asdf-version "2.26.86")
+         (asdf-version "2.26.87")
          (existing-asdf (find-class (find-symbol* :component :asdf nil) nil))
          (existing-version *asdf-version*)
          (already-there (equal asdf-version existing-version)))
diff --git a/utility.lisp b/utility.lisp
index d88eaca8..9d03d59f 100644
--- a/utility.lisp
+++ b/utility.lisp
@@ -230,7 +230,7 @@ starting the separation from the end, e.g. when called with arguments
     (cons (eval `(function ,fun)))
     (string (eval `(function ,(with-standard-io-syntax
                                 (let ((*package* (find-package package)))
-                                  (eval-string fun))))))))
+                                  (read-from-string fun))))))))
 
 (defun* call-function (function-spec &rest arguments)
   (apply (ensure-function function-spec) arguments))
diff --git a/version.lisp-expr b/version.lisp-expr
index aa65cbbb..4f4299c8 100644
--- a/version.lisp-expr
+++ b/version.lisp-expr
@@ -1 +1 @@
-"2.26.86"
+"2.26.87"
-- 
GitLab