Commit fcc68b59 authored by Robert P. Goldman's avatar Robert P. Goldman Committed by Robert P. Goldman
Browse files

Fix for launchpad bug 1247662.

Ensure that SYSTEM-DEFSYSTEM-DEPENDS-ON never gets SLOT-UNBOUND error.
Also cache DEPENDS-ON and WEAKLY-DEPENDS-ON info from DEFSYSTEM.
parent 89a87112
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -36,7 +36,9 @@
   #:name #:version #:description #:long-description #:author #:maintainer #:licence
   #:components-by-name #:components
   #:children #:children-by-name #:default-component-class
   #:author #:maintainer #:licence #:source-file #:defsystem-depends-on
   #:author #:maintainer #:licence #:source-file
   ;; the following retained for backward compatibility.
   #:defsystem-depends-on
   #:sideway-dependencies #:if-feature #:in-order-to #:inline-methods
   #:relative-pathname #:absolute-pathname #:operation-times #:around-compile
   #:%encoding #:properties #:component-properties #:parent))
+3 −0
Original line number Diff line number Diff line
@@ -94,6 +94,9 @@
   #:system-long-name
   #:system-source-control
   #:map-systems
   #:system-defsystem-depends-on
   #:system-depends-on
   #:system-weakly-depends-on

   #:*system-definition-search-functions*   ; variables
   #:*central-registry*
+5 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
   :asdf/component :asdf/system :asdf/cache
   :asdf/find-system :asdf/find-component :asdf/lisp-action :asdf/operate
   :asdf/backward-internals)
  (:import-from :asdf/system #:depends-on #:weakly-depends-on)
  (:export
   #:defsystem #:register-system-definition
   #:class-for-type #:*default-component-class*
@@ -169,6 +170,10 @@
            (apply 'reinitialize-instance component args)
            (setf component (apply 'make-instance class args)))
        (component-pathname component) ; eagerly compute the absolute pathname
        ;; cache information for introspection
        (when (typep component 'system)
          (setf (slot-value component 'depends-on) depends-on
                (slot-value component 'weakly-depends-on) weakly-depends-on))
        (let ((sysfile (system-source-file (component-system component)))) ;; requires the previous
          (when (and (typep component 'system) (not bspp))
            (setf (builtin-system-p component) (lisp-implementation-pathname-p sysfile)))
+7 −2
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
   #:reset-system
   #:system-description #:system-long-description
   #:system-author #:system-maintainer #:system-licence #:system-license
   #:system-defsystem-depends-on
   #:system-defsystem-depends-on #:system-depends-on #:system-weakly-depends-on
   #:component-build-pathname #:build-pathname
   #:component-entry-point #:entry-point
   #:homepage #:system-homepage
@@ -62,7 +62,12 @@
     (entry-point
      :initform nil :initarg :entry-point :accessor component-entry-point)
     (source-file :initform nil :initarg :source-file :accessor system-source-file)
     (defsystem-depends-on :reader system-defsystem-depends-on :initarg :defsystem-depends-on)))
     (defsystem-depends-on :reader system-defsystem-depends-on :initarg :defsystem-depends-on
                           :initform nil)
     ;; these two are specially set in parse-component-form, so have no :INITARGs.
     (depends-on :reader system-depends-on :initform nil)
     (weakly-depends-on :reader system-weakly-depends-on :initform nil)
     ))

  (defun reset-system (system &rest keys &key &allow-other-keys)
    (change-class (change-class system 'proto-system) 'system)
+39 −0
Original line number Diff line number Diff line
;;; -*- Lisp -*-

;;;---------------------------------------------------------------------------
;;; Test to see that we are correctly caching information about system
;;; definitions
;;;---------------------------------------------------------------------------
(def-test-system test-weakly-depends-on
  :weakly-depends-on (file3-only)
  :components ((:file "file1")))

(def-test-system test-no-weakly-depends-on
  :components ((:file "file1")))

(def-test-system :versioned-system-3
  :defsystem-depends-on ((:version :test-asdf/2 "2.1"))
  :pathname #.*test-directory*
  :version "1.2")

(def-test-system :test-concatenate-source
  :depends-on (:file3-only)
  :components
  ((:file "file2" :depends-on ("foo"))
   (:module "foo" :pathname ""
    :components ((:file "file1")
                 (:file "file4" :if-feature (:not :common-lisp))))))



(DBG "The weakly-depends-on information is properly cached")
(assert (equal '(file3-only) (system-weakly-depends-on (find-system "test-weakly-depends-on"))))
(assert (null (system-weakly-depends-on (find-system "test-no-weakly-depends-on"))))

(DBG "The depends-on information is properly cached")
(assert (null (system-depends-on (find-system "test-no-weakly-depends-on"))))
(assert (equalp '(:file3-only) (system-depends-on (find-system "test-concatenate-source"))))

(DBG "The defsystem-depends-on information is properly cached")
(assert (null (system-defsystem-depends-on (find-system "test-no-weakly-depends-on"))))
(assert (equalp '((:version :test-asdf/2 "2.1")) (system-defsystem-depends-on (find-system :versioned-system-3))))
 No newline at end of file
Loading