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

Make upgrade smarter:

* only frob symbols when upgrading from before *oldest-forward-compatible-asdf-version*
* allow individual when-upgrade to override which version they apply to.
* tell SBCL to unintern bundle-op on old versions, because the redefinition
 causes an interim circularity with a not-yet-redefined subclass,
 for which SBCL preemptively raises an error.
parent 42cb5d4b
Loading
Loading
Loading
Loading
+16 −10
Original line number Original line Diff line number Diff line
@@ -48,9 +48,11 @@ You can compare this string with e.g.: (ASDF:VERSION-SATISFIES (ASDF:ASDF-VERSIO
    (when *verbose-out* (apply 'format *verbose-out* format-string format-args)))
    (when *verbose-out* (apply 'format *verbose-out* format-string format-args)))
  (defvar *post-upgrade-cleanup-hook* ())
  (defvar *post-upgrade-cleanup-hook* ())
  (defvar *post-upgrade-restart-hook* ())
  (defvar *post-upgrade-restart-hook* ())
  (defun upgrading-p ()
  (defun upgrading-p (&optional (oldest-compatible-version *oldest-forward-compatible-asdf-version*))
    (and *previous-asdf-versions* (not (equal *asdf-version* (first *previous-asdf-versions*)))))
    (and *previous-asdf-versions*
  (defmacro when-upgrading ((&key (upgrading-p '(upgrading-p)) when) &body body)
         (version< (first *previous-asdf-versions*) oldest-compatible-version)))
  (defmacro when-upgrading ((&key (version *oldest-forward-compatible-asdf-version*)
                               (upgrading-p `(upgrading-p ,version)) when) &body body)
    "A wrapper macro for code that should only be run when upgrading a
    "A wrapper macro for code that should only be run when upgrading a
previously-loaded version of ASDF."
previously-loaded version of ASDF."
    `(with-upgradability ()
    `(with-upgradability ()
@@ -94,6 +96,10 @@ previously-loaded version of ASDF."
             #:trivial-system-p ;; bundle
             #:trivial-system-p ;; bundle
             ;; NB: it's too late to do anything about uiop functions!
             ;; NB: it's too late to do anything about uiop functions!
             ))
             ))
        #+sbcl
        (redefined-classes
          ;; redefining causes interim circularities with the old ASDF during upgrade, and SBCL borks
          '(#:bundle-op))
        (uninterned-symbols
        (uninterned-symbols
          '(#:*asdf-revision* #:around #:asdf-method-combination
          '(#:*asdf-revision* #:around #:asdf-method-combination
            #:split #:make-collector #:do-dep #:do-one-dep
            #:split #:make-collector #:do-dep #:do-one-dep
@@ -106,7 +112,7 @@ previously-loaded version of ASDF."
              ;; On CLISP we seem to be unable to fmakunbound and define a function in the same fasl. Sigh.
              ;; On CLISP we seem to be unable to fmakunbound and define a function in the same fasl. Sigh.
              #-clisp (fmakunbound sym)))
              #-clisp (fmakunbound sym)))
    (loop :with asdf = (find-package :asdf)
    (loop :with asdf = (find-package :asdf)
          :for name :in uninterned-symbols
          :for name :in (append #+sbcl redefined-classes uninterned-symbols)
          :for sym = (find-symbol* name :asdf nil)
          :for sym = (find-symbol* name :asdf nil)
          :for base-pkg = (and sym (symbol-package sym)) :do
          :for base-pkg = (and sym (symbol-package sym)) :do
            (when sym
            (when sym