Changeset 14470
- Timestamp:
- Dec 7, 2010, 10:17:22 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/source/tools/asdf.lisp (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/tools/asdf.lisp
r14380 r14470 50 50 (cl:in-package :cl-user) 51 51 52 #+gcl (defpackage :asdf (:use :cl)) ;; GCL treats defpackage magically and needs this 53 52 54 (eval-when (:compile-toplevel :load-toplevel :execute) 53 55 ;;; make package if it doesn't exist yet. … … 67 69 ;;;; Create packages in a way that is compatible with hot-upgrade. 68 70 ;;;; See https://bugs.launchpad.net/asdf/+bug/485687 69 ;;;; See more atthe end of the file.71 ;;;; See more near the end of the file. 70 72 71 73 (eval-when (:load-toplevel :compile-toplevel :execute) 72 74 (defvar *asdf-version* nil) 73 75 (defvar *upgraded-p* nil) 74 (let* ((asdf-version "2.010") ;; same as 2.146 76 (let* (;; For bug reporting sanity, please always bump this version when you modify this file. 77 ;; "2.345" would be an official release 78 ;; "2.345.6" would be a development version in the official upstream 79 ;; "2.345.0.7" would be your local modification of an official release 80 ;; "2.345.6.7" would be your local modification of a development version 81 (asdf-version "2.011") 75 82 (existing-asdf (fboundp 'find-system)) 76 83 (existing-version *asdf-version*) … … 78 85 (unless (and existing-asdf already-there) 79 86 (when existing-asdf 80 (format * error-output*81 "~&Upgrading ASDF package ~@[from version ~A ~]to version ~A~%"82 existing-version asdf-version))87 (format *trace-output* 88 "~&~@<; ~@;Upgrading ASDF package ~@[from version ~A ~]to version ~A~@:>~%" 89 existing-version asdf-version)) 83 90 (labels 84 91 ((unlink-package (package) … … 181 188 :unintern 182 189 (#:*asdf-revision* #:around #:asdf-method-combination 183 #:split #:make-collector) 190 #:split #:make-collector 191 #:output-files-for-system-and-operation) ; obsolete ASDF-BINARY-LOCATION function 184 192 :fmakunbound 185 193 (#:system-source-file … … 235 243 #:map-systems 236 244 245 #:operation-description 237 246 #:operation-on-warnings 238 247 #:operation-on-failure … … 287 296 ;; Utilities 288 297 #:absolute-pathname-p 289 ;; #:aif #:it298 ;; #:aif #:it 290 299 ;; #:appendf 291 300 #:coerce-name … … 296 305 ;; #:get-uid 297 306 ;; #:length=n-p 307 ;; #:find-symbol* 298 308 #:merge-pathnames* 299 309 #:pathname-directory-pathname 300 310 #:read-file-forms 301 ;; #:remove-keys302 ;; #:remove-keyword311 ;; #:remove-keys 312 ;; #:remove-keyword 303 313 #:resolve-symlinks 304 314 #:split-string … … 313 323 *upgraded-p*)))))) 314 324 315 ;; More cleanups in case of hot-upgrade. See https://bugs.launchpad.net/asdf/+bug/485687316 (when *upgraded-p*317 #+ecl318 (when (find-class 'compile-op nil)319 (defmethod update-instance-for-redefined-class :after320 ((c compile-op) added deleted plist &key)321 (declare (ignore added deleted))322 (let ((system-p (getf plist 'system-p)))323 (when system-p (setf (getf (slot-value c 'flags) :system-p) system-p)))))324 (when (find-class 'module nil)325 (eval326 '(progn327 (defmethod update-instance-for-redefined-class :after328 ((m module) added deleted plist &key)329 (declare (ignorable deleted plist))330 (when *asdf-verbose* (format *trace-output* "Updating ~A~%" m))331 (when (member 'components-by-name added)332 (compute-module-components-by-name m)))333 (defmethod update-instance-for-redefined-class :after334 ((s system) added deleted plist &key)335 (declare (ignorable deleted plist))336 (when *asdf-verbose* (format *trace-output* "Updating ~A~%" s))337 (when (member 'source-file added)338 (%set-system-source-file (probe-asd (component-name s) (component-pathname s)) s)))))))339 340 325 ;;;; ------------------------------------------------------------------------- 341 326 ;;;; User-visible parameters … … 379 364 380 365 ;;;; ------------------------------------------------------------------------- 381 ;;;; ASDF Interface, in terms of generic functions. 366 ;;;; General Purpose Utilities 367 382 368 (macrolet 383 369 ((defdef (def* def) … … 390 376 (defdef defgeneric* defgeneric) 391 377 (defdef defun* defun)) 392 393 (defgeneric* find-system (system &optional error-p))394 (defgeneric* perform-with-restarts (operation component))395 (defgeneric* perform (operation component))396 (defgeneric* operation-done-p (operation component))397 (defgeneric* explain (operation component))398 (defgeneric* output-files (operation component))399 (defgeneric* input-files (operation component))400 (defgeneric* component-operation-time (operation component))401 (defgeneric* operation-description (operation component)402 (:documentation "returns a phrase that describes performing this operation403 on this component, e.g. \"loading /a/b/c\".404 You can put together sentences using this phrase."))405 406 (defgeneric* system-source-file (system)407 (:documentation "Return the source file in which system is defined."))408 409 (defgeneric* component-system (component)410 (:documentation "Find the top-level system containing COMPONENT"))411 412 (defgeneric* component-pathname (component)413 (:documentation "Extracts the pathname applicable for a particular component."))414 415 (defgeneric* component-relative-pathname (component)416 (:documentation "Returns a pathname for the component argument intended to be417 interpreted relative to the pathname of that component's parent.418 Despite the function's name, the return value may be an absolute419 pathname, because an absolute pathname may be interpreted relative to420 another pathname in a degenerate way."))421 422 (defgeneric* component-property (component property))423 424 (defgeneric* (setf component-property) (new-value component property))425 426 (defgeneric* version-satisfies (component version))427 428 (defgeneric* find-component (base path)429 (:documentation "Finds the component with PATH starting from BASE module;430 if BASE is nil, then the component is assumed to be a system."))431 432 (defgeneric* source-file-type (component system))433 434 (defgeneric* operation-ancestor (operation)435 (:documentation436 "Recursively chase the operation's parent pointer until we get to437 the head of the tree"))438 439 (defgeneric* component-visited-p (operation component)440 (:documentation "Returns the value stored by a call to441 VISIT-COMPONENT, if that has been called, otherwise NIL.442 This value stored will be a cons cell, the first element443 of which is a computed key, so not interesting. The444 CDR wil be the DATA value stored by VISIT-COMPONENT; recover445 it as (cdr (component-visited-p op c)).446 In the current form of ASDF, the DATA value retrieved is447 effectively a boolean, indicating whether some operations are448 to be performed in order to do OPERATION X COMPONENT. If the449 data value is NIL, the combination had been explored, but no450 operations needed to be performed."))451 452 (defgeneric* visit-component (operation component data)453 (:documentation "Record DATA as being associated with OPERATION454 and COMPONENT. This is a side-effecting function: the association455 will be recorded on the ROOT OPERATION \(OPERATION-ANCESTOR of the456 OPERATION\).457 No evidence that DATA is ever interesting, beyond just being458 non-NIL. Using the data field is probably very risky; if there is459 already a record for OPERATION X COMPONENT, DATA will be quietly460 discarded instead of recorded.461 Starting with 2.006, TRAVERSE will store an integer in data,462 so that nodes can be sorted in decreasing order of traversal."))463 464 465 (defgeneric* (setf visiting-component) (new-value operation component))466 467 (defgeneric* component-visiting-p (operation component))468 469 (defgeneric* component-depends-on (operation component)470 (:documentation471 "Returns a list of dependencies needed by the component to perform472 the operation. A dependency has one of the following forms:473 474 (<operation> <component>*), where <operation> is a class475 designator and each <component> is a component476 designator, which means that the component depends on477 <operation> having been performed on each <component>; or478 479 (FEATURE <feature>), which means that the component depends480 on <feature>'s presence in *FEATURES*.481 482 Methods specialized on subclasses of existing component types483 should usually append the results of CALL-NEXT-METHOD to the484 list."))485 486 (defgeneric* component-self-dependencies (operation component))487 488 (defgeneric* traverse (operation component)489 (:documentation490 "Generate and return a plan for performing OPERATION on COMPONENT.491 492 The plan returned is a list of dotted-pairs. Each pair is the CONS493 of ASDF operation object and a COMPONENT object. The pairs will be494 processed in order by OPERATE."))495 496 497 ;;;; -------------------------------------------------------------------------498 ;;;; General Purpose Utilities499 378 500 379 (defmacro while-collecting ((&rest collectors) &body body) … … 536 415 (directory 537 416 (cond 538 #-(or sbcl cmu )417 #-(or sbcl cmu scl) 539 418 ((stringp directory) `(:absolute ,directory) directory) 540 419 #+gcl 541 ((and (consp directory) ( stringp (first directory)))542 `(: absolute ,@directory))420 ((and (consp directory) (not (member (first directory) '(:absolute :relative)))) 421 `(:relative ,@directory)) 543 422 ((or (null directory) 544 423 (and (consp directory) (member (first directory) '(:absolute :relative)))) … … 676 555 677 556 (defun* getenv (x) 678 (#+ abclext:getenv557 (#+(or abcl clisp) ext:getenv 679 558 #+allegro sys:getenv 680 #+clisp ext:getenv681 559 #+clozure ccl:getenv 682 560 #+(or cmu scl) (lambda (x) (cdr (assoc x ext:*environment-list* :test #'string=))) … … 724 602 725 603 (defun* absolute-pathname-p (pathspec) 726 (and pathspec (eq :absolute (car (pathname-directory (pathname pathspec)))))) 604 (and (typep pathspec '(or pathname string)) 605 (eq :absolute (car (pathname-directory (pathname pathspec)))))) 727 606 728 607 (defun* length=n-p (x n) ;is it that (= (length x) n) ? … … 756 635 #+allegro (excl.osi:getuid) 757 636 #+clisp (loop :for s :in '("posix:uid" "LINUX:getuid") 758 :for f = (ignore-errors (read-from-string s))637 :for f = (ignore-errors (read-from-string s)) 759 638 :when f :return (funcall f)) 760 639 #+(or cmu scl) (unix:unix-getuid) … … 778 657 :name nil :type nil :version nil)) 779 658 659 (defun* find-symbol* (s p) 660 (find-symbol (string s) p)) 661 780 662 (defun* probe-file* (p) 781 663 "when given a pathname P, probes the filesystem for a file or directory … … 786 668 (pathname (unless (wild-pathname-p p) 787 669 #.(or #+(or allegro clozure cmu ecl sbcl scl) '(probe-file p) 788 #+clisp (aif (find-symbol (string :probe-pathname) :ext) `(ignore-errors (,it p)))789 '(ignore-errors (truename p)))))))670 #+clisp (aif (find-symbol (string '#:probe-pathname) :ext) `(ignore-errors (,it p))) 671 '(ignore-errors (truename p))))))) 790 672 791 673 (defun* truenamize (p) … … 858 740 :directory `(:absolute ,@path)))) 859 741 (translate-pathname absolute-pathname wild-root (wilden new-base)))))) 742 743 ;;;; ------------------------------------------------------------------------- 744 ;;;; ASDF Interface, in terms of generic functions. 745 (defgeneric* find-system (system &optional error-p)) 746 (defgeneric* perform-with-restarts (operation component)) 747 (defgeneric* perform (operation component)) 748 (defgeneric* operation-done-p (operation component)) 749 (defgeneric* explain (operation component)) 750 (defgeneric* output-files (operation component)) 751 (defgeneric* input-files (operation component)) 752 (defgeneric* component-operation-time (operation component)) 753 (defgeneric* operation-description (operation component) 754 (:documentation "returns a phrase that describes performing this operation 755 on this component, e.g. \"loading /a/b/c\". 756 You can put together sentences using this phrase.")) 757 758 (defgeneric* system-source-file (system) 759 (:documentation "Return the source file in which system is defined.")) 760 761 (defgeneric* component-system (component) 762 (:documentation "Find the top-level system containing COMPONENT")) 763 764 (defgeneric* component-pathname (component) 765 (:documentation "Extracts the pathname applicable for a particular component.")) 766 767 (defgeneric* component-relative-pathname (component) 768 (:documentation "Returns a pathname for the component argument intended to be 769 interpreted relative to the pathname of that component's parent. 770 Despite the function's name, the return value may be an absolute 771 pathname, because an absolute pathname may be interpreted relative to 772 another pathname in a degenerate way.")) 773 774 (defgeneric* component-property (component property)) 775 776 (defgeneric* (setf component-property) (new-value component property)) 777 778 (defgeneric* version-satisfies (component version)) 779 780 (defgeneric* find-component (base path) 781 (:documentation "Finds the component with PATH starting from BASE module; 782 if BASE is nil, then the component is assumed to be a system.")) 783 784 (defgeneric* source-file-type (component system)) 785 786 (defgeneric* operation-ancestor (operation) 787 (:documentation 788 "Recursively chase the operation's parent pointer until we get to 789 the head of the tree")) 790 791 (defgeneric* component-visited-p (operation component) 792 (:documentation "Returns the value stored by a call to 793 VISIT-COMPONENT, if that has been called, otherwise NIL. 794 This value stored will be a cons cell, the first element 795 of which is a computed key, so not interesting. The 796 CDR wil be the DATA value stored by VISIT-COMPONENT; recover 797 it as (cdr (component-visited-p op c)). 798 In the current form of ASDF, the DATA value retrieved is 799 effectively a boolean, indicating whether some operations are 800 to be performed in order to do OPERATION X COMPONENT. If the 801 data value is NIL, the combination had been explored, but no 802 operations needed to be performed.")) 803 804 (defgeneric* visit-component (operation component data) 805 (:documentation "Record DATA as being associated with OPERATION 806 and COMPONENT. This is a side-effecting function: the association 807 will be recorded on the ROOT OPERATION \(OPERATION-ANCESTOR of the 808 OPERATION\). 809 No evidence that DATA is ever interesting, beyond just being 810 non-NIL. Using the data field is probably very risky; if there is 811 already a record for OPERATION X COMPONENT, DATA will be quietly 812 discarded instead of recorded. 813 Starting with 2.006, TRAVERSE will store an integer in data, 814 so that nodes can be sorted in decreasing order of traversal.")) 815 816 817 (defgeneric* (setf visiting-component) (new-value operation component)) 818 819 (defgeneric* component-visiting-p (operation component)) 820 821 (defgeneric* component-depends-on (operation component) 822 (:documentation 823 "Returns a list of dependencies needed by the component to perform 824 the operation. A dependency has one of the following forms: 825 826 (<operation> <component>*), where <operation> is a class 827 designator and each <component> is a component 828 designator, which means that the component depends on 829 <operation> having been performed on each <component>; or 830 831 (FEATURE <feature>), which means that the component depends 832 on <feature>'s presence in *FEATURES*. 833 834 Methods specialized on subclasses of existing component types 835 should usually append the results of CALL-NEXT-METHOD to the 836 list.")) 837 838 (defgeneric* component-self-dependencies (operation component)) 839 840 (defgeneric* traverse (operation component) 841 (:documentation 842 "Generate and return a plan for performing OPERATION on COMPONENT. 843 844 The plan returned is a list of dotted-pairs. Each pair is the CONS 845 of ASDF operation object and a COMPONENT object. The pairs will be 846 processed in order by OPERATE.")) 847 848 849 ;;;; ------------------------------------------------------------------------- 850 ;;; Methods in case of hot-upgrade. See https://bugs.launchpad.net/asdf/+bug/485687 851 (when *upgraded-p* 852 #+ecl 853 (when (find-class 'compile-op nil) 854 (defmethod update-instance-for-redefined-class :after 855 ((c compile-op) added deleted plist &key) 856 (declare (ignore added deleted)) 857 (let ((system-p (getf plist 'system-p))) 858 (when system-p (setf (getf (slot-value c 'flags) :system-p) system-p))))) 859 (when (find-class 'module nil) 860 (eval 861 `(defmethod update-instance-for-redefined-class :after 862 ((m module) added deleted plist &key) 863 (declare (ignorable deleted plist)) 864 (when (or *asdf-verbose* *load-verbose*) 865 (asdf-message "~&~@<; ~@; Updating ~A for ASDF ~A~@:>~%" m ,(asdf-version))) 866 (when (member 'components-by-name added) 867 (compute-module-components-by-name m)) 868 (when (and (typep m 'system) (member 'source-file added)) 869 (%set-system-source-file (probe-asd (component-name m) (component-pathname m)) m)))))) 860 870 861 871 ;;;; ------------------------------------------------------------------------- … … 1001 1011 (missing-requires c) 1002 1012 (when (missing-parent c) 1003 (co mponent-name (missing-parent c)))))1013 (coerce-name (missing-parent c))))) 1004 1014 1005 1015 (defmethod print-object ((c missing-component-of-version) s) … … 1296 1306 (let ((*package* package)) 1297 1307 (asdf-message 1298 "~&~@<; ~@; loading system definition from ~A into ~A~@:>~%"1308 "~&~@<; ~@;Loading system definition from ~A into ~A~@:>~%" 1299 1309 on-disk *package*) 1300 1310 (load on-disk))) … … 1310 1320 1311 1321 (defun* register-system (name system) 1312 (asdf-message "~&~@<; ~@; registering ~A as ~A~@:>~%" system name)1322 (asdf-message "~&~@<; ~@;Registering ~A as ~A~@:>~%" system name) 1313 1323 (setf (gethash (coerce-name name) *defined-systems*) 1314 1324 (cons (get-universal-time) system))) … … 1316 1326 (defun* find-system-fallback (requested fallback &rest keys &key source-file &allow-other-keys) 1317 1327 (setf fallback (coerce-name fallback) 1318 source-file (or source-file *compile-file-truename* *load-truename*) 1328 source-file (or source-file 1329 (if *resolve-symlinks* 1330 (or *compile-file-truename* *load-truename*) 1331 (or *compile-file-pathname* *load-pathname*))) 1319 1332 requested (coerce-name requested)) 1320 1333 (when (equal requested fallback) … … 1322 1335 (system (or registered 1323 1336 (apply 'make-instance 'system 1324 :name fallback :source-file source-file keys))))1337 :name fallback :source-file source-file keys)))) 1325 1338 (unless registered 1326 1339 (register-system fallback system)) … … 2202 2215 (defun* class-for-type (parent type) 2203 2216 (or (loop :for symbol :in (list 2204 (unless (keywordp type) type)2205 (find-symbol (symbol-name type)*package*)2206 (find-symbol (symbol-name type):asdf))2217 type 2218 (find-symbol* type *package*) 2219 (find-symbol* type :asdf)) 2207 2220 :for class = (and symbol (find-class symbol nil)) 2208 2221 :when (and class (subtypep class 'component)) … … 2391 2404 :input nil :whole nil 2392 2405 #+mswindows :show-window #+mswindows :hide) 2393 ( format *verbose-out*"~{~&; ~a~%~}~%" stderr)2394 ( format *verbose-out*"~{~&; ~a~%~}~%" stdout)2406 (asdf-message "~{~&; ~a~%~}~%" stderr) 2407 (asdf-message "~{~&; ~a~%~}~%" stdout) 2395 2408 exit-code) 2396 2409 … … 3121 3134 ;;;; ----------------------------------------------------------------- 3122 3135 ;;;; Compatibility mode for ASDF-Binary-Locations 3136 3137 (defmethod operate :before (operation-class system &rest args &key &allow-other-keys) 3138 (declare (ignorable operation-class system args)) 3139 (when (find-symbol* '#:output-files-for-system-and-operation :asdf) 3140 (error "ASDF 2 is not compatible with ASDF-BINARY-LOCATIONS, which you are using. 3141 ASDF 2 now achieves the same purpose with its builtin ASDF-OUTPUT-TRANSLATIONS, 3142 which should be easier to configure. Please stop using ASDF-BINARY-LOCATIONS, 3143 and instead use ASDF-OUTPUT-TRANSLATIONS. See the ASDF manual for details. 3144 In case you insist on preserving your previous A-B-L configuration, but 3145 do not know how to achieve the same effect with A-O-T, you may use function 3146 ASDF:ENABLE-ASDF-BINARY-LOCATIONS-COMPATIBILITY as documented in the manual; 3147 call that function where you would otherwise have loaded and configured A-B-L."))) 3123 3148 3124 3149 (defun* enable-asdf-binary-locations-compatibility … … 3549 3574 3550 3575 ;;;; ----------------------------------------------------------------- 3551 ;;;; Hook into REQUIRE for ABCL, C lozureCL, CMUCL, ECL and SBCL3576 ;;;; Hook into REQUIRE for ABCL, CLISP, ClozureCL, CMUCL, ECL and SBCL 3552 3577 ;;;; 3553 3578 (defun* module-provide-asdf (name) … … 3565 3590 3566 3591 #+(or abcl clisp clozure cmu ecl sbcl) 3567 (let ((x (and #+clisp (find-symbol "*MODULE-PROVIDER-FUNCTIONS*":custom))))3592 (let ((x (and #+clisp (find-symbol* '#:*module-provider-functions* :custom)))) 3568 3593 (when x 3569 3594 (eval `(pushnew 'module-provide-asdf
Note:
See TracChangeset
for help on using the changeset viewer.
