From 002eb570f3d254667f9b51d896fbb46fddb66397 Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <tunes@google.com>
Date: Fri, 18 Jan 2013 01:49:20 -0500
Subject: [PATCH] 2.26.108: tweak locate-system after previous change. Fix some
 tests.

---
 asdf.asd                                      |  2 +-
 find-system.lisp                              | 12 +++-----
 header.lisp                                   |  2 +-
 pathname.lisp                                 |  2 +-
 test/test-asdf.asd                            | 15 ++++++++++
 test/test-xach-update-bug.script              | 28 ++++++++++++++-----
 test/test9.script                             | 21 ++++++--------
 ...{foo.asd => test-asdf-location-change.asd} |  2 +-
 ...{foo.asd => test-asdf-location-change.asd} |  2 +-
 upgrade.lisp                                  |  2 +-
 version.lisp-expr                             |  2 +-
 11 files changed, 55 insertions(+), 35 deletions(-)
 create mode 100644 test/test-asdf.asd
 rename test/xach-foo-1/{foo.asd => test-asdf-location-change.asd} (55%)
 rename test/xach-foo-2/{foo.asd => test-asdf-location-change.asd} (65%)

diff --git a/asdf.asd b/asdf.asd
index c0ebd2da4..d39e24eb6 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.107" ;; to be automatically updated by bin/bump-revision
+  :version "2.26.108" ;; 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/find-system.lisp b/find-system.lisp
index b07dddeb2..a543c8265 100644
--- a/find-system.lisp
+++ b/find-system.lisp
@@ -283,13 +283,9 @@ PREVIOUS-TIME when not null is the time at which the PREVIOUS system was loaded.
          (pathname (ensure-pathname (resolve-symlinks* pathname) :want-absolute t))
          (foundp (and (or found-system pathname previous) t)))
     (check-type found (or null pathname system))
-    (when foundp
-      (when (and pathname found-system)
-        (setf (system-source-file found-system) pathname))
-      (when (and previous (not (pathname-equal (system-source-file previous) pathname)))
-        (setf (system-source-file previous) pathname)
-        (setf previous-time nil))
-      (values foundp found-system pathname previous previous-time))))
+    (values foundp found-system pathname previous previous-time)))
+
+(asdf-debug)
 
 (defmethod find-system ((name string) &optional (error-p t))
   (with-system-definitions ()
@@ -297,7 +293,7 @@ PREVIOUS-TIME when not null is the time at which the PREVIOUS system was loaded.
       (restart-case
           (multiple-value-bind (foundp found-system pathname previous previous-time)
               (locate-system name)
-            (declare (ignore foundp))
+            (assert (eq foundp (and (or found-system pathname) t)))
             (when (and found-system (not previous))
               (register-system found-system))
             (when (and pathname
diff --git a/header.lisp b/header.lisp
index 9b8ad4e61..852471477 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.107: Another System Definition Facility.
+;;; This is ASDF 2.26.108: Another System Definition Facility.
 ;;;
 ;;; Feedback, bug reports, and patches are all welcome:
 ;;; please mail to <asdf-devel@common-lisp.net>.
diff --git a/pathname.lisp b/pathname.lisp
index 51d180211..9ae0e2c6e 100644
--- a/pathname.lisp
+++ b/pathname.lisp
@@ -48,7 +48,7 @@
    #:add-pathname-suffix #:tmpize-pathname
    #:call-with-staging-pathname #:with-staging-pathname
    ;; physical pathnames
-   #:physical-pathname-p #:sane-physical-pathname #:root-pathname
+   #:logical-pathname-p #:physical-pathname-p #:sane-physical-pathname #:root-pathname
    ;; Windows shortcut support
    #:read-null-terminated-string #:read-little-endian
    #:parse-file-location-info #:parse-windows-shortcut
diff --git a/test/test-asdf.asd b/test/test-asdf.asd
new file mode 100644
index 000000000..6abd8e6c3
--- /dev/null
+++ b/test/test-asdf.asd
@@ -0,0 +1,15 @@
+(defpackage :test-asdf-system
+  (:use :cl :asdf :asdf/driver))
+(in-package :test-asdf-system)
+
+(defsystem :test-asdf/test9-1
+    :version "1.1"
+    :components ((:file "file2"))
+    :depends-on ((:version :test-asdf/test9-2 "2.0")))
+
+(defsystem :test-asdf/test9-2
+  :version "1.0"
+  :components ((:file "file1")))
+
+(defsystem :test-asdf/test9-3
+  :depends-on ((:version :test-asdf/test9-2 "1.0")))
diff --git a/test/test-xach-update-bug.script b/test/test-xach-update-bug.script
index 7bc7cffd6..380e57de3 100644
--- a/test/test-xach-update-bug.script
+++ b/test/test-xach-update-bug.script
@@ -4,10 +4,24 @@
 
 #+gcl (trace load compile-file asdf:perform asdf::perform-plan)
 (with-test ()
- (setf asdf:*central-registry* (list (asdf::subpathname *test-directory* "xach-foo-1/")))
- (asdf:load-system "foo")
- (assert (symbol-value (find-symbol (string :loaded) :first-version)))
- (setf asdf:*central-registry* (list (asdf::subpathname *test-directory* "xach-foo-2/")))
- (asdf:load-system "foo")
- (assert (symbol-value (find-symbol (string :loaded) :second-version)))
- (assert (eql 42 (funcall (find-symbol (string :wtf) :second-version)))))
+  (let ((foo :test-asdf-location-change))
+    (DBG "load foo. Should load from xach-foo-1/")
+    (setf *central-registry* (list (subpathname *test-directory* "xach-foo-1/")))
+    (load-system foo)
+    (let ((foo1 (find-system foo))
+          (loaded (find-symbol* :loaded :first-version)))
+      (assert-equal (symbol-value loaded) t)
+      (DBG "load foo again. Should not do anything -- already loaded")
+      (setf (symbol-value loaded) :test-that-we-dont-reload)
+      (load-system foo)
+      (assert-equal (symbol-value loaded) :test-that-we-dont-reload)
+
+      (assert (not (find-package :second-version)))
+      (DBG "Now, change registry so foo is found from xach-foo-2/")
+      (setf *central-registry* (list (subpathname *test-directory* "xach-foo-2/")))
+      (DBG "load foo yet again. It should see the pathname has changed and load it anew")
+      (load-system foo)
+      (let ((foo2 (find-system foo)))
+        (assert (eq foo1 foo2)) ;; the object should be the same
+        (assert (symbol-value (find-symbol* :loaded :second-version)))
+        (assert-equal 42 (symbol-call :second-version :wtf))))))
diff --git a/test/test9.script b/test/test9.script
index fb2e358fe..b09690d28 100644
--- a/test/test9.script
+++ b/test/test9.script
@@ -6,16 +6,11 @@
 (load-asdf)
 
 (with-test ()
- (setf asdf:*central-registry* nil)
- (load (merge-pathnames "test9-1.asd"))
- (load (merge-pathnames "test9-2.asd"))
- (handler-case
-     (asdf:oos 'asdf:load-op 'test9-1)
-   (asdf:missing-component-of-version (c)
-     (format t "got missing-component-of-version as expected: - ~%~A~%" c))
-   (:no-error (c)
-    (declare (ignore c))
-    (error "should have failed, oops"))))
-
-
-
+  (handler-case
+      (load-test-system :test-asdf/test9-1)
+    (asdf:missing-component-of-version (c)
+      (format t "got missing-component-of-version as expected: - ~%~A~%" c))
+    (:no-error (c)
+      (declare (ignore c))
+      (error "should have failed, oops")))
+  (load-test-system :test-asdf/test9-3)) ; positive case, to make sure.
diff --git a/test/xach-foo-1/foo.asd b/test/xach-foo-1/test-asdf-location-change.asd
similarity index 55%
rename from test/xach-foo-1/foo.asd
rename to test/xach-foo-1/test-asdf-location-change.asd
index 1fe842c4b..042c1ca2b 100644
--- a/test/xach-foo-1/foo.asd
+++ b/test/xach-foo-1/test-asdf-location-change.asd
@@ -1,5 +1,5 @@
 ;;;; foo.asd
 
-(asdf:defsystem #:foo
+(asdf:defsystem #:test-asdf-location-change
   :serial t
   :components ((:file "a")))
diff --git a/test/xach-foo-2/foo.asd b/test/xach-foo-2/test-asdf-location-change.asd
similarity index 65%
rename from test/xach-foo-2/foo.asd
rename to test/xach-foo-2/test-asdf-location-change.asd
index a96b4514d..1471f4c58 100644
--- a/test/xach-foo-2/foo.asd
+++ b/test/xach-foo-2/test-asdf-location-change.asd
@@ -1,6 +1,6 @@
 ;;;; foo.asd
 
-(asdf:defsystem #:foo
+(asdf:defsystem #:test-asdf-location-change
   :serial t
   :components ((:file "a")
                (:file "b")))
diff --git a/upgrade.lisp b/upgrade.lisp
index 49f4eeaf9..7c1da76eb 100644
--- a/upgrade.lisp
+++ b/upgrade.lisp
@@ -45,7 +45,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.107")
+         (asdf-version "2.26.108")
          (existing-asdf (find-class (find-symbol* :component :asdf nil) nil))
          (existing-version *asdf-version*)
          (already-there (equal asdf-version existing-version)))
diff --git a/version.lisp-expr b/version.lisp-expr
index dcb327564..99a188ff3 100644
--- a/version.lisp-expr
+++ b/version.lisp-expr
@@ -1 +1 @@
-"2.26.107"
+"2.26.108"
-- 
GitLab