Commit 8e0ec0e9 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Stop fmakunbound'ing defgeneric's past the upgrade trigger

If we fmakunbound a defgeneric, we lose any user-defined method on the function
and must therefore reload any and every system that might have defined methods
on it. We must therefore not fmakunbound past the forward compatibility upgrade
trigger, only before. Adjust our code accordingly. Conservative bounds are used
in *oldest-forward-compatible-asdf-version* and redefined-functions that should
probably be refined after some inspection of old versions.

This is a response to https://bugs.launchpad.net/asdf/+bug/1631771
parent b14722e0
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ Use it in FORMAT control strings as ~/asdf-action:format-action/"

;;;; Dependencies
(with-upgradability ()
  (defgeneric* (component-depends-on) (operation component) ;; ASDF4: rename to component-dependencies
  (defgeneric component-depends-on (operation component) ;; ASDF4: rename to component-dependencies
    (:documentation
     "Returns a list of dependencies needed by the component to perform
    the operation.  A dependency has one of the following forms:
@@ -270,7 +270,7 @@ The class needs to be updated for ASDF 3.1 and specify appropriate propagation m

;;;; Inputs, Outputs, and invisible dependencies
(with-upgradability ()
  (defgeneric* (output-files) (operation component)
  (defgeneric output-files (operation component)
    (:documentation "Methods for this function return two values: a list of output files
corresponding to this action, and a boolean indicating if they have already been subjected
to relevant output translations and should not be further translated.
@@ -278,13 +278,13 @@ to relevant output translations and should not be further translated.
Methods on PERFORM *must* call this function to determine where their outputs are to be located.
They may rely on the order of the files to discriminate between outputs.
"))
  (defgeneric* (input-files) (operation component)
  (defgeneric input-files (operation component)
    (:documentation "A list of input files corresponding to this action.

Methods on PERFORM *must* call this function to determine where their inputs are located.
They may rely on the order of the files to discriminate between inputs.
"))
  (defgeneric* (operation-done-p) (operation component)
  (defgeneric operation-done-p (operation component)
    (:documentation "Returns a boolean which is NIL if the action must be performed (again)."))
  (define-convenience-action-methods output-files (operation component))
  (define-convenience-action-methods input-files (operation component))
@@ -294,8 +294,7 @@ They may rely on the order of the files to discriminate between inputs.
    t)

  ;; Translate output files, unless asked not to. Memoize the result.
  (defmethod output-files :around (operation component)
    operation component ;; hush genera, not convinced by declare ignorable(!)
  (defmethod output-files :around ((operation t) (component t))
    (do-asdf-cache `(output-files ,operation ,component)
      (values
       (multiple-value-bind (pathnames fixedp) (call-next-method)
@@ -397,7 +396,7 @@ in some previous image, or T if it needs to be done.")

;;;; Perform
(with-upgradability ()
  (defgeneric* (perform) (operation component)
  (defgeneric perform (operation component)
    (:documentation "PERFORM an action, consuming its input-files and building its output-files"))
  (define-convenience-action-methods perform (operation component))

@@ -418,7 +417,7 @@ in some previous image, or T if it needs to be done.")
  ;; The restarts of the perform-with-restarts variant matter in an interactive context.
  ;; The retry strategies of p-w-r itself, and/or the background workers of a multiprocess build
  ;; may call perform directly rather than call p-w-r.
  (defgeneric* (perform-with-restarts) (operation component)
  (defgeneric perform-with-restarts (operation component)
    (:documentation "PERFORM an action in a context where suitable restarts are in place."))
  (defmethod perform-with-restarts (operation component)
    (perform operation component))
+2 −2
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ if that's whay you mean." ;;)

  ;; TRAVERSE is the function used to compute a plan in ASDF 1 and 2.
  ;; It was never officially exposed but some people still used it.
  (defgeneric* (traverse) (operation component &key &allow-other-keys)
  (defgeneric traverse (operation component &key &allow-other-keys)
    (:documentation
     "Generate and return a plan for performing OPERATION on COMPONENT.

@@ -189,7 +189,7 @@ Please use UIOP:RUN-PROGRAM instead."

;;; This method survives from ASDF 1, but really it is superseded by action-description.
(with-upgradability ()
  (defgeneric* (explain) (operation component)
  (defgeneric explain (operation component)
    (:documentation "Display a message describing an action.
DEPRECATED. Use ASDF:ACTION-DESCRIPTION and/or ASDF::FORMAT-ACTION instead."))
  (defmethod explain ((o operation) (c component))
+1 −1
Original line number Diff line number Diff line
@@ -303,7 +303,7 @@ or of opaque libraries shipped along the source code."))
             :force :force-not :plan-class) ;; TODO: refactor so we don't mix plan and operation arguments
           (operation-original-initargs instance))))

  (defgeneric* (trivial-system-p) (component))
  (defgeneric trivial-system-p (component))

  (defun user-system-p (s)
    (and (typep s 'system)
+3 −3
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@
    (:documentation "Top-level system containing the COMPONENT"))
  (defgeneric component-pathname (component)
    (:documentation "Pathname of the COMPONENT if any, or NIL."))
  (defgeneric* (component-relative-pathname) (component)
  (defgeneric component-relative-pathname (component)
    ;; in ASDF4, rename that to component-specified-pathname ?
    (:documentation "Specified pathname of the COMPONENT,
intended to be merged with the pathname of that component's parent if any, using merged-pathnames*.
@@ -78,7 +78,7 @@ or NIL for top-level components (a.k.a. systems)"))

  ;; Deprecated: Backward compatible way of computing the FILE-TYPE of a component.
  ;; TODO: find users, have them stop using that, remove it for ASDF4.
  (defgeneric* (source-file-type) (component system)
  (defgeneric source-file-type (component system)
    (:documentation "DEPRECATED. Use the FILE-TYPE of a COMPONENT instead."))

  (define-condition system-definition-error (error) ()
@@ -232,7 +232,7 @@ typically but not necessarily representing the files in a subdirectory of the bu

;;;; component pathnames
(with-upgradability ()
  (defgeneric* (component-parent-pathname) (component)
  (defgeneric component-parent-pathname (component)
    (:documentation "The pathname of the COMPONENT's parent, if any, or NIL"))
  (defmethod component-parent-pathname (component)
    (component-pathname (component-parent component)))
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@
;;;; Finding components

(with-upgradability ()
  (defgeneric* (find-component) (base path &key registered)
  (defgeneric find-component (base path &key registered)
    (:documentation "Find a component by resolving the PATH starting from BASE parent.
If REGISTERED is true, only search currently registered systems."))
  (defgeneric resolve-dependency-combination (component combinator arguments)
Loading