Changeset 14252
- Timestamp:
- Sep 11, 2010, 8:14:46 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/source/tools/asdf.lisp (modified) (140 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/tools/asdf.lisp
r13959 r14252 49 49 50 50 (cl:in-package :cl) 51 (defpackage :asdf-bootstrap (:use :cl)) 52 (in-package :asdf-bootstrap) 53 54 ;; Implementation-dependent tweaks 51 55 52 (eval-when (:compile-toplevel :load-toplevel :execute) 53 ;;; make package if it doesn't exist yet. 54 ;;; DEFPACKAGE may cause errors on discrepancies, so we avoid it. 55 (unless (find-package :asdf) 56 (make-package :asdf :use '(:cl))) 57 ;;; Implementation-dependent tweaks 56 58 ;; (declaim (optimize (speed 2) (debug 2) (safety 3)) ; NO: rely on the implementation defaults. 57 59 #+allegro … … 59 61 (remove "asdf" excl::*autoload-package-name-alist* 60 62 :test 'equalp :key 'car)) 61 #+ecl (require :cmp) 62 #+gcl 63 (eval-when (:compile-toplevel :load-toplevel) 64 (defpackage :asdf-utilities (:use :cl)) 65 (defpackage :asdf (:use :cl :asdf-utilities)))) 63 #+ecl (require :cmp)) 64 65 (in-package :asdf) 66 66 67 67 ;;;; Create packages in a way that is compatible with hot-upgrade. … … 70 70 71 71 (eval-when (:load-toplevel :compile-toplevel :execute) 72 (defvar *asdf-version* nil) 73 (defvar *upgraded-p* nil) 72 74 (let* ((asdf-version ;; the 1+ helps the version bumping script discriminate 73 (subseq "VERSION:2.004" (1+ (length "VERSION")))) ; NB: same as 2.111. 74 (existing-asdf (find-package :asdf)) 75 (vername '#:*asdf-version*) 76 (versym (and existing-asdf 77 (find-symbol (string vername) existing-asdf))) 78 (existing-version (and versym (boundp versym) (symbol-value versym))) 75 (subseq "VERSION:2.008" (1+ (length "VERSION")))) ; same as 2.128 76 (existing-asdf (fboundp 'find-system)) 77 (existing-version *asdf-version*) 79 78 (already-there (equal asdf-version existing-version))) 80 79 (unless (and existing-asdf already-there) 81 #-gcl82 80 (when existing-asdf 83 81 (format *trace-output* … … 123 121 (when sym 124 122 (unexport sym package) 125 (unintern sym package)))) 123 (unintern sym package) 124 sym))) 126 125 (ensure-unintern (package symbols) 127 (dolist (sym symbols) (remove-symbol sym package))) 126 (loop :with packages = (list-all-packages) 127 :for sym :in symbols 128 :for removed = (remove-symbol sym package) 129 :when removed :do 130 (loop :for p :in packages :do 131 (when (eq removed (find-sym sym p)) 132 (unintern removed p))))) 128 133 (ensure-shadow (package symbols) 129 134 (shadow symbols package)) … … 139 144 :when sym :do (fmakunbound sym))) 140 145 (ensure-export (package export) 141 (let ((syms (loop :for x :in export :collect 142 (intern* x package)))) 143 (do-external-symbols (sym package) 144 (unless (member sym syms) 145 (remove-symbol sym package))) 146 (dolist (sym syms) 147 (export sym package)))) 146 (let ((formerly-exported-symbols nil) 147 (bothly-exported-symbols nil) 148 (newly-exported-symbols nil)) 149 (loop :for sym :being :each :external-symbol :in package :do 150 (if (member sym export :test 'string-equal) 151 (push sym bothly-exported-symbols) 152 (push sym formerly-exported-symbols))) 153 (loop :for sym :in export :do 154 (unless (member sym bothly-exported-symbols :test 'string-equal) 155 (push sym newly-exported-symbols))) 156 (loop :for user :in (package-used-by-list package) 157 :for shadowing = (package-shadowing-symbols user) :do 158 (loop :for new :in newly-exported-symbols 159 :for old = (find-sym new user) 160 :when (and old (not (member old shadowing))) 161 :do (unintern old user))) 162 (loop :for x :in newly-exported-symbols :do 163 (export (intern* x package))))) 148 164 (ensure-package (name &key nicknames use unintern fmakunbound shadow export) 149 (let ((p (ensure-exists name nicknames use)))165 (let* ((p (ensure-exists name nicknames use))) 150 166 (ensure-unintern p unintern) 151 167 (ensure-shadow p shadow) … … 161 177 :unintern ',(append #-(or gcl ecl) redefined-functions unintern) 162 178 :fmakunbound ',(append fmakunbound)))) 163 (pkgdcl 164 :asdf-utilities 165 :nicknames (#:asdf-extensions) 166 :use (#:common-lisp) 167 :unintern (#:split #:make-collector) 168 :export 169 (#:absolute-pathname-p 170 #:aif 171 #:appendf 172 #:asdf-message 173 #:coerce-name 174 #:directory-pathname-p 175 #:ends-with 176 #:ensure-directory-pathname 177 #:getenv 178 #:get-uid 179 #:length=n-p 180 #:merge-pathnames* 181 #:pathname-directory-pathname 182 #:read-file-forms 183 #:remove-keys 184 #:remove-keyword 185 #:resolve-symlinks 186 #:split-string 187 #:component-name-to-pathname-components 188 #:split-name-type 189 #:system-registered-p 190 #:truenamize 191 #:while-collecting)) 179 (let ((u (find-package :asdf-utilities))) 180 (when u 181 (ensure-unintern u (loop :for s :being :each :present-symbol :in u :collect s)))) 192 182 (pkgdcl 193 183 :asdf 194 :use (:common-lisp :asdf-utilities)184 :use (:common-lisp) 195 185 :redefined-functions 196 186 (#:perform #:explain #:output-files #:operation-done-p 197 187 #:perform-with-restarts #:component-relative-pathname 198 #:system-source-file #:operate #:find-component) 188 #:system-source-file #:operate #:find-component #:find-system 189 #:apply-output-translations #:translate-pathname*) 199 190 :unintern 200 191 (#:*asdf-revision* #:around #:asdf-method-combination … … 208 199 (#:defsystem #:oos #:operate #:find-system #:run-shell-command 209 200 #:system-definition-pathname #:find-component ; miscellaneous 210 #:compile-system #:load-system #:test-system 201 #:compile-system #:load-system #:test-system #:clear-system 211 202 #:compile-op #:load-op #:load-source-op 212 203 #:test-op … … 216 207 #:version-satisfies 217 208 218 #:input-files #:output-files #: perform ; operation methods209 #:input-files #:output-files #:output-file #:perform ; operation methods 219 210 #:operation-done-p #:explain 220 211 … … 255 246 #:operation-on-warnings 256 247 #:operation-on-failure 248 #:component-visited-p 257 249 ;;#:*component-parent-pathname* 258 250 #:*system-definition-search-functions* … … 284 276 #:remove-entry-from-registry 285 277 278 #:clear-configuration 286 279 #:initialize-output-translations 287 280 #:disable-output-translations … … 292 285 #:compile-file-pathname* 293 286 #:enable-asdf-binary-locations-compatibility 294 295 287 #:*default-source-registries* 296 288 #:initialize-source-registry … … 298 290 #:clear-source-registry 299 291 #:ensure-source-registry 300 #:process-source-registry))) 301 (let* ((version (intern* vername :asdf)) 302 (upvar (intern* '#:*upgraded-p* :asdf)) 303 (upval0 (and (boundp upvar) (symbol-value upvar))) 304 (upval1 (if existing-version (cons existing-version upval0) upval0))) 305 (eval `(progn 306 (defparameter ,version ,asdf-version) 307 (defparameter ,upvar ',upval1)))))))) 308 309 (in-package :asdf) 292 #:process-source-registry 293 #:system-registered-p 294 #:asdf-message 295 296 ;; Utilities 297 #:absolute-pathname-p 298 ;; #:aif #:it 299 ;; #:appendf 300 #:coerce-name 301 #:directory-pathname-p 302 ;; #:ends-with 303 #:ensure-directory-pathname 304 #:getenv 305 ;; #:get-uid 306 ;; #:length=n-p 307 #:merge-pathnames* 308 #:pathname-directory-pathname 309 #:read-file-forms 310 ;; #:remove-keys 311 ;; #:remove-keyword 312 #:resolve-symlinks 313 #:split-string 314 #:component-name-to-pathname-components 315 #:split-name-type 316 #:truenamize 317 #:while-collecting))) 318 (setf *asdf-version* asdf-version 319 *upgraded-p* (if existing-version 320 (cons existing-version *upgraded-p*) 321 *upgraded-p*)))))) 310 322 311 323 ;; More cleanups in case of hot-upgrade. See https://bugs.launchpad.net/asdf/+bug/485687 312 #+gcl313 (eval-when (:compile-toplevel :load-toplevel)314 (defvar *asdf-version* nil)315 (defvar *upgraded-p* nil))316 324 (when *upgraded-p* 317 325 #+ecl … … 343 351 "Determine whether or not ASDF resolves symlinks when defining systems. 344 352 345 Defaults to `t`.") 346 347 (defvar *compile-file-warnings-behaviour* :warn 348 "How should ASDF react if it encounters a warning when compiling a 349 file? Valid values are :error, :warn, and :ignore.") 350 351 (defvar *compile-file-failure-behaviour* #+sbcl :error #-sbcl :warn 352 "How should ASDF react if it encounters a failure \(per the 353 ANSI spec of COMPILE-FILE\) when compiling a file? Valid values are 354 :error, :warn, and :ignore. Note that ASDF ALWAYS raises an error 355 if it fails to create an output file when compiling.") 353 Defaults to T.") 354 355 (defvar *compile-file-warnings-behaviour* 356 (or #+clisp :ignore :warn) 357 "How should ASDF react if it encounters a warning when compiling a file? 358 Valid values are :error, :warn, and :ignore.") 359 360 (defvar *compile-file-failure-behaviour* 361 (or #+sbcl :error #+clisp :ignore :warn) 362 "How should ASDF react if it encounters a failure (per the ANSI spec of COMPILE-FILE) 363 when compiling a file? Valid values are :error, :warn, and :ignore. 364 Note that ASDF ALWAYS raises an error if it fails to create an output file when compiling.") 356 365 357 366 (defvar *verbose-out* nil) … … 372 381 ;;;; ------------------------------------------------------------------------- 373 382 ;;;; ASDF Interface, in terms of generic functions. 374 (defmacro defgeneric* (name formals &rest options) 375 `(progn 376 #+(or gcl ecl) (fmakunbound ',name) 377 (defgeneric ,name ,formals ,@options))) 378 383 (macrolet 384 ((defdef (def* def) 385 `(defmacro ,def* (name formals &rest rest) 386 `(progn 387 #+(or ecl gcl) (fmakunbound ',name) 388 ,(when (and #+ecl (symbolp name)) 389 `(declaim (notinline ,name))) ; fails for setf functions on ecl 390 (,',def ,name ,formals ,@rest))))) 391 (defdef defgeneric* defgeneric) 392 (defdef defun* defun)) 393 394 (defgeneric* find-system (system &optional error-p)) 379 395 (defgeneric* perform-with-restarts (operation component)) 380 396 (defgeneric* perform (operation component)) … … 383 399 (defgeneric* output-files (operation component)) 384 400 (defgeneric* input-files (operation component)) 385 (defgeneric component-operation-time (operation component)) 401 (defgeneric* component-operation-time (operation component)) 402 (defgeneric* operation-description (operation component) 403 (:documentation "returns a phrase that describes performing this operation 404 on this component, e.g. \"loading /a/b/c\". 405 You can put together sentences using this phrase.")) 386 406 387 407 (defgeneric* system-source-file (system) 388 408 (:documentation "Return the source file in which system is defined.")) 389 409 390 (defgeneric component-system (component)410 (defgeneric* component-system (component) 391 411 (:documentation "Find the top-level system containing COMPONENT")) 392 412 393 (defgeneric component-pathname (component)413 (defgeneric* component-pathname (component) 394 414 (:documentation "Extracts the pathname applicable for a particular component.")) 395 415 396 (defgeneric component-relative-pathname (component)416 (defgeneric* component-relative-pathname (component) 397 417 (:documentation "Returns a pathname for the component argument intended to be 398 418 interpreted relative to the pathname of that component's parent. … … 401 421 another pathname in a degenerate way.")) 402 422 403 (defgeneric component-property (component property))404 405 (defgeneric (setf component-property) (new-value component property))406 407 (defgeneric version-satisfies (component version))423 (defgeneric* component-property (component property)) 424 425 (defgeneric* (setf component-property) (new-value component property)) 426 427 (defgeneric* version-satisfies (component version)) 408 428 409 429 (defgeneric* find-component (base path) … … 411 431 if BASE is nil, then the component is assumed to be a system.")) 412 432 413 (defgeneric source-file-type (component system))414 415 (defgeneric operation-ancestor (operation)433 (defgeneric* source-file-type (component system)) 434 435 (defgeneric* operation-ancestor (operation) 416 436 (:documentation 417 437 "Recursively chase the operation's parent pointer until we get to 418 438 the head of the tree")) 419 439 420 (defgeneric component-visited-p (operation component)440 (defgeneric* component-visited-p (operation component) 421 441 (:documentation "Returns the value stored by a call to 422 442 VISIT-COMPONENT, if that has been called, otherwise NIL. … … 431 451 operations needed to be performed.")) 432 452 433 (defgeneric visit-component (operation component data)453 (defgeneric* visit-component (operation component data) 434 454 (:documentation "Record DATA as being associated with OPERATION 435 455 and COMPONENT. This is a side-effecting function: the association … … 439 459 non-NIL. Using the data field is probably very risky; if there is 440 460 already a record for OPERATION X COMPONENT, DATA will be quietly 441 discarded instead of recorded.")) 442 443 (defgeneric (setf visiting-component) (new-value operation component)) 444 445 (defgeneric component-visiting-p (operation component)) 446 447 (defgeneric component-depends-on (operation component) 461 discarded instead of recorded. 462 Starting with 2.006, TRAVERSE will store an integer in data, 463 so that nodes can be sorted in decreasing order of traversal.")) 464 465 466 (defgeneric* (setf visiting-component) (new-value operation component)) 467 468 (defgeneric* component-visiting-p (operation component)) 469 470 (defgeneric* component-depends-on (operation component) 448 471 (:documentation 449 472 "Returns a list of dependencies needed by the component to perform … … 462 485 list.")) 463 486 464 (defgeneric component-self-dependencies (operation component))465 466 (defgeneric traverse (operation component)487 (defgeneric* component-self-dependencies (operation component)) 488 489 (defgeneric* traverse (operation component) 467 490 (:documentation 468 491 "Generate and return a plan for performing OPERATION on COMPONENT. … … 497 520 `(let ((it ,test)) (if it ,then ,else))) 498 521 499 (defun pathname-directory-pathname (pathname)522 (defun* pathname-directory-pathname (pathname) 500 523 "Returns a new pathname with same HOST, DEVICE, DIRECTORY as PATHNAME, 501 524 and NIL NAME, TYPE and VERSION components" … … 503 526 (make-pathname :name nil :type nil :version nil :defaults pathname))) 504 527 505 (defun merge-pathnames* (specified &optional (defaults *default-pathname-defaults*))528 (defun* merge-pathnames* (specified &optional (defaults *default-pathname-defaults*)) 506 529 "MERGE-PATHNAMES* is like MERGE-PATHNAMES except that if the SPECIFIED pathname 507 530 does not have an absolute directory, then the HOST and DEVICE come from the DEFAULTS. … … 512 535 (defaults (pathname defaults)) 513 536 (directory (pathname-directory specified)) 514 #- sbcl(directory (if (stringp directory) `(:absolute ,directory) directory))537 #-(or sbcl cmu) (directory (if (stringp directory) `(:absolute ,directory) directory)) 515 538 (name (or (pathname-name specified) (pathname-name defaults))) 516 539 (type (or (pathname-type specified) (pathname-type defaults))) … … 557 580 or "or a flag") 558 581 559 (defun first-char (s)582 (defun* first-char (s) 560 583 (and (stringp s) (plusp (length s)) (char s 0))) 561 584 562 (defun last-char (s)585 (defun* last-char (s) 563 586 (and (stringp s) (plusp (length s)) (char s (1- (length s))))) 564 587 565 (defun asdf-message (format-string &rest format-args)588 (defun* asdf-message (format-string &rest format-args) 566 589 (declare (dynamic-extent format-args)) 567 590 (apply #'format *verbose-out* format-string format-args)) 568 591 569 (defun split-string (string &key max (separator '(#\Space #\Tab)))592 (defun* split-string (string &key max (separator '(#\Space #\Tab))) 570 593 "Split STRING into a list of components separated by 571 594 any of the characters in the sequence SEPARATOR. … … 587 610 (setf end start)))))) 588 611 589 (defun split-name-type (filename)612 (defun* split-name-type (filename) 590 613 (let ((unspecific 591 614 ;; Giving :unspecific as argument to make-pathname is not portable. … … 599 622 (values name type))))) 600 623 601 (defun component-name-to-pathname-components (s &optional force-directory)624 (defun* component-name-to-pathname-components (s &optional force-directory) 602 625 "Splits the path string S, returning three values: 603 626 A flag that is either :absolute or :relative, indicating … … 633 656 (values relative (butlast components) last-comp)))))) 634 657 635 (defun remove-keys (key-names args)658 (defun* remove-keys (key-names args) 636 659 (loop :for (name val) :on args :by #'cddr 637 660 :unless (member (symbol-name name) key-names … … 639 662 :append (list name val))) 640 663 641 (defun remove-keyword (key args)664 (defun* remove-keyword (key args) 642 665 (loop :for (k v) :on args :by #'cddr 643 666 :unless (eq k key) 644 667 :append (list k v))) 645 668 646 (defun getenv (x) 647 #+abcl 648 (ext:getenv x) 649 #+sbcl 650 (sb-ext:posix-getenv x) 651 #+clozure 652 (ccl:getenv x) 653 #+clisp 654 (ext:getenv x) 655 #+cmu 656 (cdr (assoc (intern x :keyword) ext:*environment-list*)) 657 #+lispworks 658 (lispworks:environment-variable x) 659 #+allegro 660 (sys:getenv x) 661 #+gcl 662 (system:getenv x) 663 #+ecl 664 (si:getenv x)) 665 666 (defun directory-pathname-p (pathname) 669 (defun* getenv (x) 670 (#+abcl ext:getenv 671 #+allegro sys:getenv 672 #+clisp ext:getenv 673 #+clozure ccl:getenv 674 #+(or cmu scl) (lambda (x) (cdr (assoc x ext:*environment-list* :test #'string=))) 675 #+ecl si:getenv 676 #+gcl system:getenv 677 #+lispworks lispworks:environment-variable 678 #+sbcl sb-ext:posix-getenv 679 x)) 680 681 (defun* directory-pathname-p (pathname) 667 682 "Does PATHNAME represent a directory? 668 683 … … 679 694 t))) 680 695 681 (defun ensure-directory-pathname (pathspec)696 (defun* ensure-directory-pathname (pathspec) 682 697 "Converts the non-wild pathname designator PATHSPEC to directory form." 683 698 (cond … … 697 712 :defaults pathspec)))) 698 713 699 (defun absolute-pathname-p (pathspec)700 ( eq :absolute (car (pathname-directory (pathname pathspec)))))701 702 (defun length=n-p (x n) ;is it that (= (length x) n) ?714 (defun* absolute-pathname-p (pathspec) 715 (and pathspec (eq :absolute (car (pathname-directory (pathname pathspec)))))) 716 717 (defun* length=n-p (x n) ;is it that (= (length x) n) ? 703 718 (check-type n (integer 0 *)) 704 719 (loop … … 709 724 ((not (consp l)) (return nil))))) 710 725 711 (defun ends-with (s suffix)726 (defun* ends-with (s suffix) 712 727 (check-type s string) 713 728 (check-type suffix string) … … 716 731 (string-equal s suffix :start1 start)))) 717 732 718 (defun read-file-forms (file)733 (defun* read-file-forms (file) 719 734 (with-open-file (in file) 720 735 (loop :with eof = (list nil) … … 725 740 #-(and (or win32 windows mswindows mingw32) (not cygwin)) 726 741 (progn 727 #+clisp (defun get-uid () (posix:uid)) 728 #+sbcl (defun get-uid () (sb-unix:unix-getuid)) 729 #+cmu (defun get-uid () (unix:unix-getuid)) 730 #+ecl #.(cl:and (cl:< ext:+ecl-version-number+ 100601) 731 '(ffi:clines "#include <sys/types.h>" "#include <unistd.h>")) 732 #+ecl (defun get-uid () 733 #.(cl:if (cl:< ext:+ecl-version-number+ 100601) 734 '(ffi:c-inline () () :int "getuid()" :one-liner t) 735 '(ext::getuid))) 736 #+allegro (defun get-uid () (excl.osi:getuid)) 737 #-(or cmu sbcl clisp allegro ecl) 738 (defun get-uid () 739 (let ((uid-string 740 (with-output-to-string (*verbose-out*) 741 (run-shell-command "id -ur")))) 742 (with-input-from-string (stream uid-string) 743 (read-line stream) 744 (handler-case (parse-integer (read-line stream)) 745 (error () (error "Unable to find out user ID"))))))) 746 747 (defun pathname-root (pathname) 742 #+ecl #.(cl:and (cl:< ext:+ecl-version-number+ 100601) 743 '(ffi:clines "#include <sys/types.h>" "#include <unistd.h>")) 744 (defun* get-uid () 745 #+allegro (excl.osi:getuid) 746 #+clisp (loop :for s :in '("posix:uid" "LINUX:getuid") 747 :for f = (ignore-errors (read-from-string s)) 748 :when f :return (funcall f)) 749 #+(or cmu scl) (unix:unix-getuid) 750 #+ecl #.(cl:if (cl:< ext:+ecl-version-number+ 100601) 751 '(ffi:c-inline () () :int "getuid()" :one-liner t) 752 '(ext::getuid)) 753 #+sbcl (sb-unix:unix-getuid) 754 #-(or allegro clisp cmu ecl sbcl scl) 755 (let ((uid-string 756 (with-output-to-string (*verbose-out*) 757 (run-shell-command "id -ur")))) 758 (with-input-from-string (stream uid-string) 759 (read-line stream) 760 (handler-case (parse-integer (read-line stream)) 761 (error () (error "Unable to find out user ID"))))))) 762 763 (defun* pathname-root (pathname) 748 764 (make-pathname :host (pathname-host pathname) 749 765 :device (pathname-device pathname) … … 751 767 :name nil :type nil :version nil)) 752 768 753 (defun truenamize (p) 769 (defun* probe-file* (p) 770 "when given a pathname P, probes the filesystem for a file or directory 771 with given pathname and if it exists return its truename." 772 (etypecase p 773 (null nil) 774 (string (probe-file* (parse-namestring p))) 775 (pathname (unless (wild-pathname-p p) 776 #.(or #+(or allegro clozure cmu ecl sbcl scl) '(probe-file p) 777 #+clisp (aif (find-symbol (string :probe-pathname) :ext) `(,it p)) 778 '(ignore-errors (truename p))))))) 779 780 (defun* truenamize (p) 754 781 "Resolve as much of a pathname as possible" 755 782 (block nil … … 758 785 (directory (pathname-directory p))) 759 786 (when (typep p 'logical-pathname) (return p)) 760 (ignore-errors (return (truename p))) 761 #-sbcl (when (stringp directory) (return p)) 787 (let ((found (probe-file* p))) 788 (when found (return found))) 789 #-(or sbcl cmu) (when (stringp directory) (return p)) 762 790 (when (not (eq :absolute (car directory))) (return p)) 763 (let ((sofar ( ignore-errors (truename (pathname-root p)))))791 (let ((sofar (probe-file* (pathname-root p)))) 764 792 (unless sofar (return p)) 765 793 (flet ((solution (directories) … … 773 801 (loop :for component :in (cdr directory) 774 802 :for rest :on (cdr directory) 775 :for more = (ignore-errors 776 (truename 777 (merge-pathnames* 778 (make-pathname :directory `(:relative ,component)) 779 sofar))) :do 803 :for more = (probe-file* 804 (merge-pathnames* 805 (make-pathname :directory `(:relative ,component)) 806 sofar)) :do 780 807 (if more 781 808 (setf sofar more) … … 784 811 (return (solution nil)))))))) 785 812 786 (defun resolve-symlinks (path)813 (defun* resolve-symlinks (path) 787 814 #-allegro (truenamize path) 788 815 #+allegro (excl:pathname-resolve-symbolic-links path)) 789 816 790 (defun default-directory ()817 (defun* default-directory () 791 818 (truenamize (pathname-directory-pathname *default-pathname-defaults*))) 792 819 793 (defun lispize-pathname (input-file)820 (defun* lispize-pathname (input-file) 794 821 (make-pathname :type "lisp" :defaults input-file)) 795 822 … … 798 825 :name :wild :type :wild :version :wild)) 799 826 800 (defun wilden (path)827 (defun* wilden (path) 801 828 (merge-pathnames* *wild-path* path)) 802 829 803 (defun directorize-pathname-host-device (pathname)830 (defun* directorize-pathname-host-device (pathname) 804 831 (let* ((root (pathname-root pathname)) 805 832 (wild-root (wilden root)) … … 838 865 duplicate-names-name 839 866 error-component error-operation 840 module-components module-components-by-name) 867 module-components module-components-by-name 868 circular-dependency-components) 841 869 (ftype (function (t t) t) (setf module-components-by-name))) 842 870 … … 857 885 858 886 (define-condition circular-dependency (system-definition-error) 859 ((components :initarg :components :reader circular-dependency-components))) 887 ((components :initarg :components :reader circular-dependency-components)) 888 (:report (lambda (c s) 889 (format s "~@<Circular dependency: ~S~@:>" (circular-dependency-components c))))) 860 890 861 891 (define-condition duplicate-names (system-definition-error) … … 896 926 :accessor component-in-order-to) 897 927 ;; This one is used by POIU. Maybe in the future by ASDF instead of in-order-to? 928 ;; POIU is a parallel (multi-process build) extension of ASDF. See 929 ;; http://www.cliki.net/poiu 898 930 (load-dependencies :accessor component-load-dependencies :initform nil) 899 931 ;; XXX crap name, but it's an official API name! … … 916 948 :initform nil))) 917 949 918 (defun component-find-path (component)950 (defun* component-find-path (component) 919 951 (reverse 920 952 (loop :for c = component :then (component-parent c) … … 932 964 (call-next-method c nil) (missing-required-by c))) 933 965 934 (defun sysdef-error (format &rest arguments)966 (defun* sysdef-error (format &rest arguments) 935 967 (error 'formatted-system-definition-error :format-control 936 968 format :format-arguments arguments)) … … 939 971 940 972 (defmethod print-object ((c missing-component) s) 941 (format s "~@<component ~S not found~973 (format s "~@<component ~S not found~ 942 974 ~@[ in ~A~]~@:>" 943 975 (missing-requires c) … … 948 980 (format s "~@<component ~S does not match version ~A~ 949 981 ~@[ in ~A~]~@:>" 950 (missing-requires c)951 (missing-version c)952 (when (missing-parent c)953 (component-name (missing-parent c)))))982 (missing-requires c) 983 (missing-version c) 984 (when (missing-parent c) 985 (component-name (missing-parent c))))) 954 986 955 987 (defmethod component-system ((component component)) … … 960 992 (defvar *default-component-class* 'cl-source-file) 961 993 962 (defun compute-module-components-by-name (module)994 (defun* compute-module-components-by-name (module) 963 995 (let ((hash (make-hash-table :test 'equal))) 964 996 (setf (module-components-by-name module) hash) … … 990 1022 :accessor module-default-component-class))) 991 1023 992 (defun component-parent-pathname (component)1024 (defun* component-parent-pathname (component) 993 1025 ;; No default anymore (in particular, no *default-pathname-defaults*). 994 1026 ;; If you force component to have a NULL pathname, you better arrange … … 1007 1039 (pathname-directory-pathname (component-parent-pathname component))))) 1008 1040 (unless (or (null pathname) (absolute-pathname-p pathname)) 1009 (error "Invalid relative pathname ~S for component ~S" pathname component)) 1041 (error "Invalid relative pathname ~S for component ~S" 1042 pathname (component-find-path component))) 1010 1043 (setf (slot-value component 'absolute-pathname) pathname) 1011 1044 pathname))) … … 1058 1091 ;;;; Finding systems 1059 1092 1060 (defun make-defined-systems-table ()1093 (defun* make-defined-systems-table () 1061 1094 (make-hash-table :test 'equal)) 1062 1095 … … 1068 1101 of which is a system object.") 1069 1102 1070 (defun coerce-name (name)1103 (defun* coerce-name (name) 1071 1104 (typecase name 1072 1105 (component (component-name name)) … … 1075 1108 (t (sysdef-error "~@<invalid component designator ~A~@:>" name)))) 1076 1109 1077 (defun system-registered-p (name)1110 (defun* system-registered-p (name) 1078 1111 (gethash (coerce-name name) *defined-systems*)) 1079 1112 1080 (defun clear-system (name)1113 (defun* clear-system (name) 1081 1114 "Clear the entry for a system in the database of systems previously loaded. 1082 1115 Note that this does NOT in any way cause the code of the system to be unloaded." … … 1089 1122 (setf (gethash (coerce-name name) *defined-systems*) nil)) 1090 1123 1091 (defun map-systems (fn)1124 (defun* map-systems (fn) 1092 1125 "Apply FN to each defined system. 1093 1126 … … 1107 1140 '(sysdef-central-registry-search sysdef-source-registry-search sysdef-find-asdf)) 1108 1141 1109 (defun system-definition-pathname (system)1142 (defun* system-definition-pathname (system) 1110 1143 (let ((system-name (coerce-name system))) 1111 1144 (or … … 1131 1164 ") 1132 1165 1133 (defun probe-asd (name defaults)1166 (defun* probe-asd (name defaults) 1134 1167 (block nil 1135 1168 (when (directory-pathname-p defaults) … … 1152 1185 (return (pathname target))))))))) 1153 1186 1154 (defun sysdef-central-registry-search (system)1187 (defun* sysdef-central-registry-search (system) 1155 1188 (let ((name (coerce-name system)) 1156 1189 (to-remove nil) … … 1194 1227 (subseq *central-registry* (1+ position)))))))))) 1195 1228 1196 (defun make-temporary-package ()1229 (defun* make-temporary-package () 1197 1230 (flet ((try (counter) 1198 1231 (ignore-errors … … 1203 1236 (package package)))) 1204 1237 1205 (defun safe-file-write-date (pathname)1238 (defun* safe-file-write-date (pathname) 1206 1239 ;; If FILE-WRITE-DATE returns NIL, it's possible that 1207 1240 ;; the user or some other agent has deleted an input file. … … 1214 1247 (or (and pathname (probe-file pathname) (file-write-date pathname)) 1215 1248 (progn 1216 (when pathname1249 (when (and pathname *asdf-verbose*) 1217 1250 (warn "Missing FILE-WRITE-DATE for ~S: treating it as zero." 1218 1251 pathname)) 1219 1252 0))) 1220 1253 1221 (defun find-system (name &optional (error-p t)) 1254 (defmethod find-system (name &optional (error-p t)) 1255 (find-system (coerce-name name) error-p)) 1256 1257 (defmethod find-system ((name string) &optional (error-p t)) 1222 1258 (catch 'find-system 1223 (let* ((name (coerce-name name)) 1224 (in-memory (system-registered-p name)) 1259 (let* ((in-memory (system-registered-p name)) 1225 1260 (on-disk (system-definition-pathname name))) 1226 1261 (when (and on-disk … … 1241 1276 (delete-package package)))) 1242 1277 (let ((in-memory (system-registered-p name))) 1243 (if in-memory 1244 (progn (when on-disk (setf (car in-memory) 1245 (safe-file-write-date on-disk))) 1246 (cdr in-memory)) 1247 (when error-p (error 'missing-component :requires name))))))) 1248 1249 (defun register-system (name system) 1278 (cond 1279 (in-memory 1280 (when on-disk 1281 (setf (car in-memory) (safe-file-write-date on-disk))) 1282 (cdr in-memory)) 1283 (error-p 1284 (error 'missing-component :requires name))))))) 1285 1286 (defun* register-system (name system) 1250 1287 (asdf-message "~&~@<; ~@;registering ~A as ~A~@:>~%" system name) 1251 1288 (setf (gethash (coerce-name name) *defined-systems*) 1252 1289 (cons (get-universal-time) system))) 1253 1290 1254 (defun sysdef-find-asdf (system)1291 (defun* sysdef-find-asdf (system) 1255 1292 (let ((name (coerce-name system))) 1256 1293 (when (equal name "asdf") … … 1318 1355 (source-file-explicit-type component)) 1319 1356 1320 (defun merge-component-name-type (name &key type defaults)1357 (defun* merge-component-name-type (name &key type defaults) 1321 1358 ;; The defaults are required notably because they provide the default host 1322 1359 ;; to the below make-pathname, which may crucially matter to people using … … 1325 1362 ;; but that should only matter if you either (a) use absolute pathnames, or 1326 1363 ;; (b) later merge relative pathnames with CL:MERGE-PATHNAMES instead of 1327 ;; ASDF -UTILITIES:MERGE-PATHNAMES*1364 ;; ASDF:MERGE-PATHNAMES* 1328 1365 (etypecase name 1329 1366 (pathname … … 1370 1407 ;; (SYSTEM1 SYSTEM2 ... SYSTEMN) 1371 1408 ;; to force systems named in a given list 1372 ;; (but this feature never worked before ASDF 1.700 and is cerror'ed out.)1409 ;; However, but this feature never worked before ASDF 1.700 and is currently cerror'ed out. 1373 1410 (forced :initform nil :initarg :force :accessor operation-forced) 1374 1411 (original-initargs :initform nil :initarg :original-initargs … … 1390 1427 (values)) 1391 1428 1392 (defun node-for (o c)1429 (defun* node-for (o c) 1393 1430 (cons (class-name (class-of o)) c)) 1394 1431 … … 1399 1436 1400 1437 1401 (defun make-sub-operation (c o dep-c dep-o)1438 (defun* make-sub-operation (c o dep-c dep-o) 1402 1439 "C is a component, O is an operation, DEP-C is another 1403 1440 component, and DEP-O, confusingly enough, is an operation … … 1544 1581 recursive calls to traverse.") 1545 1582 1546 (defgeneric do-traverse (operation component collect))1547 1548 (defun %do-one-dep (operation c collect required-op required-c required-v)1583 (defgeneric* do-traverse (operation component collect)) 1584 1585 (defun* %do-one-dep (operation c collect required-op required-c required-v) 1549 1586 ;; collects a partial plan that results from performing required-op 1550 1587 ;; on required-c, possibly with a required-vERSION … … 1562 1599 (do-traverse op dep-c collect))) 1563 1600 1564 (defun do-one-dep (operation c collect required-op required-c required-v)1601 (defun* do-one-dep (operation c collect required-op required-c required-v) 1565 1602 ;; this function is a thin, error-handling wrapper around 1566 1603 ;; %do-one-dep. Returns a partial plan per that function. … … 1572 1609 :report (lambda (s) 1573 1610 (format s "~@<Retry loading component ~S.~@:>" 1574 required-c))1611 (component-find-path required-c))) 1575 1612 :test 1576 1613 (lambda (c) … … 1587 1624 required-c)))))))) 1588 1625 1589 (defun do-dep (operation c collect op dep)1626 (defun* do-dep (operation c collect op dep) 1590 1627 ;; type of arguments uncertain: 1591 1628 ;; op seems to at least potentially be a symbol, rather than an operation … … 1626 1663 flag)))) 1627 1664 1628 (defun do-collect (collect x) 1665 (defvar *visit-count* 0) ; counter that allows to sort nodes from operation-visited-nodes 1666 1667 (defun* do-collect (collect x) 1629 1668 (funcall collect x)) 1630 1669 … … 1711 1750 (do-collect collect (cons operation c))))) 1712 1751 (setf (visiting-component operation c) nil))) 1713 (visit-component operation c flag)1752 (visit-component operation c (when flag (incf *visit-count*))) 1714 1753 flag)) 1715 1754 1716 (defun flatten-tree (l)1755 (defun* flatten-tree (l) 1717 1756 ;; You collected things into a list. 1718 1757 ;; Most elements are just things to collect again. … … 1741 1780 (flatten-tree 1742 1781 (while-collecting (collect) 1743 (do-traverse operation c #'collect)))) 1782 (let ((*visit-count* 0)) 1783 (do-traverse operation c #'collect))))) 1744 1784 1745 1785 (defmethod perform ((operation operation) (c source-file)) … … 1754 1794 1755 1795 (defmethod explain ((operation operation) (component component)) 1756 (asdf-message "~&;;; ~A on ~A~%" operation component)) 1796 (asdf-message "~&;;; ~A~%" (operation-description operation component))) 1797 1798 (defmethod operation-description (operation component) 1799 (format nil "~A on component ~S" (class-of operation) (component-find-path component))) 1757 1800 1758 1801 ;;;; ------------------------------------------------------------------------- … … 1768 1811 :initform #-ecl nil #+ecl '(:system-p t)))) 1769 1812 1813 (defun output-file (operation component) 1814 "The unique output file of performing OPERATION on COMPONENT" 1815 (let ((files (output-files operation component))) 1816 (assert (length=n-p files 1)) 1817 (first files))) 1818 1770 1819 (defmethod perform :before ((operation compile-op) (c source-file)) 1771 1820 (map nil #'ensure-directories-exist (output-files operation c))) … … 1793 1842 #-:broken-fasl-loader 1794 1843 (let ((source-file (component-pathname c)) 1795 (output-file (car (output-files operation c))) 1844 ;; on some implementations, there are more than one output-file, 1845 ;; but the first one should always be the primary fasl that gets loaded. 1846 (output-file (first (output-files operation c))) 1796 1847 (*compile-file-warnings-behaviour* (operation-on-warnings operation)) 1797 1848 (*compile-file-failure-behaviour* (operation-on-failure operation))) … … 1836 1887 nil) 1837 1888 1889 (defmethod operation-description ((operation compile-op) component) 1890 (declare (ignorable operation)) 1891 (format nil "compiling component ~S" (component-find-path component))) 1838 1892 1839 1893 ;;;; ------------------------------------------------------------------------- … … 1912 1966 (call-next-method))) 1913 1967 1968 (defmethod operation-description ((operation load-op) component) 1969 (declare (ignorable operation)) 1970 (format nil "loading component ~S" (component-find-path component))) 1971 1972 1914 1973 ;;;; ------------------------------------------------------------------------- 1915 1974 ;;;; load-source-op … … 1949 2008 (component-property c 'last-loaded-as-source))) 1950 2009 nil t)) 2010 2011 (defmethod operation-description ((operation load-source-op) component) 2012 (declare (ignorable operation)) 2013 (format nil "loading component ~S" (component-find-path component))) 1951 2014 1952 2015 … … 1999 2062 :report 2000 2063 (lambda (s) 2001 (format s "~@<Retry performing ~S on ~S.~@:>" 2002 op component))) 2064 (format s "~@<Retry ~A.~@:>" (operation-description op component)))) 2003 2065 (accept () 2004 2066 :report 2005 2067 (lambda (s) 2006 (format s "~@<Continue, treating ~ S on ~Sas ~2068 (format s "~@<Continue, treating ~A as ~ 2007 2069 having been successful.~@:>" 2008 op component))2070 (operation-description op component))) 2009 2071 (setf (gethash (type-of op) 2010 2072 (component-operation-times component)) 2011 2073 (get-universal-time)) 2012 (return)))))) )2013 op))2014 2015 (defun oos (operation-class system &rest args &key force verbose version2074 (return)))))) 2075 (values op steps)))) 2076 2077 (defun* oos (operation-class system &rest args &key force verbose version 2016 2078 &allow-other-keys) 2017 2079 (declare (ignore force verbose version)) … … 2043 2105 operate-docstring)) 2044 2106 2045 (defun load-system (system &rest args &key force verbose version2107 (defun* load-system (system &rest args &key force verbose version 2046 2108 &allow-other-keys) 2047 2109 "Shorthand for `(operate 'asdf:load-op system)`. See OPERATE for … … 2050 2112 (apply #'operate 'load-op system args)) 2051 2113 2052 (defun compile-system (system &rest args &key force verbose version2114 (defun* compile-system (system &rest args &key force verbose version 2053 2115 &allow-other-keys) 2054 2116 "Shorthand for `(operate 'asdf:compile-op system)`. See OPERATE … … 2057 2119 (apply #'operate 'compile-op system args)) 2058 2120 2059 (defun test-system (system &rest args &key force verbose version2121 (defun* test-system (system &rest args &key force verbose version 2060 2122 &allow-other-keys) 2061 2123 "Shorthand for `(operate 'asdf:test-op system)`. See OPERATE for … … 2067 2129 ;;;; Defsystem 2068 2130 2069 (defun load-pathname ()2131 (defun* load-pathname () 2070 2132 (let ((pn (or *load-pathname* *compile-file-pathname*))) 2071 2133 (if *resolve-symlinks* … … 2073 2135 pn))) 2074 2136 2075 (defun determine-system-pathname (pathname pathname-supplied-p)2137 (defun* determine-system-pathname (pathname pathname-supplied-p) 2076 2138 ;; The defsystem macro calls us to determine 2077 2139 ;; the pathname of a system as follows: … … 2082 2144 (directory-pathname (and file-pathname (pathname-directory-pathname file-pathname)))) 2083 2145 (or (and pathname-supplied-p (merge-pathnames* pathname directory-pathname)) 2084 file-pathname2146 directory-pathname 2085 2147 (default-directory)))) 2086 2148 … … 2113 2175 ',component-options)))))) 2114 2176 2115 (defun class-for-type (parent type)2177 (defun* class-for-type (parent type) 2116 2178 (or (loop :for symbol :in (list 2117 2179 (unless (keywordp type) type) … … 2126 2188 (sysdef-error "~@<don't recognize component type ~A~@:>" type))) 2127 2189 2128 (defun maybe-add-tree (tree op1 op2 c)2190 (defun* maybe-add-tree (tree op1 op2 c) 2129 2191 "Add the node C at /OP1/OP2 in TREE, unless it's there already. 2130 2192 Returns the new tree (which probably shares structure with the old one)" … … 2141 2203 (acons op1 (list (list op2 c)) tree)))) 2142 2204 2143 (defun union-of-dependencies (&rest deps)2205 (defun* union-of-dependencies (&rest deps) 2144 2206 (let ((new-tree nil)) 2145 2207 (dolist (dep deps) … … 2154 2216 (defvar *serial-depends-on* nil) 2155 2217 2156 (defun sysdef-error-component (msg type name value)2218 (defun* sysdef-error-component (msg type name value) 2157 2219 (sysdef-error (concatenate 'string msg 2158 2220 "~&The value specified for ~(~A~) ~A is ~S") 2159 2221 type name value)) 2160 2222 2161 (defun check-component-input (type name weakly-depends-on2223 (defun* check-component-input (type name weakly-depends-on 2162 2224 depends-on components in-order-to) 2163 2225 "A partial test of the values of a component." … … 2175 2237 type name in-order-to))) 2176 2238 2177 (defun %remove-component-inline-methods (component)2239 (defun* %remove-component-inline-methods (component) 2178 2240 (dolist (name +asdf-methods+) 2179 2241 (map () … … 2187 2249 (setf (component-inline-methods component) nil)) 2188 2250 2189 (defun %define-component-inline-methods (ret rest)2251 (defun* %define-component-inline-methods (ret rest) 2190 2252 (dolist (name +asdf-methods+) 2191 2253 (let ((keyword (intern (symbol-name name) :keyword))) … … 2201 2263 (component-inline-methods ret))))))) 2202 2264 2203 (defun %refresh-component-inline-methods (component rest)2265 (defun* %refresh-component-inline-methods (component rest) 2204 2266 (%remove-component-inline-methods component) 2205 2267 (%define-component-inline-methods component rest)) 2206 2268 2207 (defun parse-component-form (parent options)2269 (defun* parse-component-form (parent options) 2208 2270 (destructuring-bind 2209 2271 (type name &rest rest &key … … 2286 2348 ;;;; years so everyone has time to migrate away from it. -- fare 2009-12-01 2287 2349 2288 (defun run-shell-command (control-string &rest args)2350 (defun* run-shell-command (control-string &rest args) 2289 2351 "Interpolate ARGS into CONTROL-STRING as if by FORMAT, and 2290 2352 synchronously execute the result using a Bourne-compatible shell, with … … 2358 2420 (system-source-file (find-system system-name))) 2359 2421 2360 (defun system-source-directory (system-designator)2422 (defun* system-source-directory (system-designator) 2361 2423 "Return a pathname object corresponding to the 2362 2424 directory in which the system specification (.asd file) is … … 2366 2428 :defaults (system-source-file system-designator))) 2367 2429 2368 (defun relativize-directory (directory)2430 (defun* relativize-directory (directory) 2369 2431 (cond 2370 2432 ((stringp directory) … … 2375 2437 directory))) 2376 2438 2377 (defun relativize-pathname-directory (pathspec)2439 (defun* relativize-pathname-directory (pathspec) 2378 2440 (let ((p (pathname pathspec))) 2379 2441 (make-pathname … … 2381 2443 :defaults p))) 2382 2444 2383 (defun system-relative-pathname (system name &key type)2445 (defun* system-relative-pathname (system name &key type) 2384 2446 (merge-pathnames* 2385 2447 (merge-component-name-type name :type type) … … 2412 2474 2413 2475 2414 (defun lisp-version-string ()2476 (defun* lisp-version-string () 2415 2477 (let ((s (lisp-implementation-version))) 2416 2478 (declare (ignorable s)) … … 2447 2509 ecl gcl lispworks mcl sbcl scl) s)) 2448 2510 2449 (defun first-feature (features)2511 (defun* first-feature (features) 2450 2512 (labels 2451 2513 ((fp (thing) … … 2463 2525 :when (fp f) :return :it))) 2464 2526 2465 (defun implementation-type ()2527 (defun* implementation-type () 2466 2528 (first-feature *implementation-features*)) 2467 2529 2468 (defun implementation-identifier ()2530 (defun* implementation-identifier () 2469 2531 (labels 2470 2532 ((maybe-warn (value fstring &rest args) … … 2496 2558 #-(or unix cygwin) #\;) 2497 2559 2498 (defun user-homedir ()2560 (defun* user-homedir () 2499 2561 (truename (user-homedir-pathname))) 2500 2562 2501 (defun try-directory-subpath (x sub &key type)2563 (defun* try-directory-subpath (x sub &key type) 2502 2564 (let* ((p (and x (ensure-directory-pathname x))) 2503 (tp (and p ( ignore-errors (truename p))))2565 (tp (and p (probe-file* p))) 2504 2566 (sp (and tp (merge-pathnames* (merge-component-name-type sub :type type) p))) 2505 (ts (and sp ( ignore-errors (truename sp)))))2567 (ts (and sp (probe-file* sp)))) 2506 2568 (and ts (values sp ts)))) 2507 (defun user-configuration-directories ()2569 (defun* user-configuration-directories () 2508 2570 (remove-if 2509 2571 #'null … … 2518 2580 ,(try (getenv "APPDATA") "common-lisp/config/")) 2519 2581 ,(try (user-homedir) ".config/common-lisp/"))))) 2520 (defun system-configuration-directories ()2582 (defun* system-configuration-directories () 2521 2583 (remove-if 2522 2584 #'null … … 2528 2590 ,(try (getenv "ALLUSERSPROFILE") "Application Data/common-lisp/config/")))) 2529 2591 (list #p"/etc/common-lisp/")))) 2530 (defun in-first-directory (dirs x)2592 (defun* in-first-directory (dirs x) 2531 2593 (loop :for dir :in dirs 2532 :thereis (and dir (ignore-errors 2533 (truename (merge-pathnames* x (ensure-directory-pathname dir))))))) 2534 (defun in-user-configuration-directory (x) 2594 :thereis (and dir (probe-file* (merge-pathnames* x (ensure-directory-pathname dir)))))) 2595 (defun* in-user-configuration-directory (x) 2535 2596 (in-first-directory (user-configuration-directories) x)) 2536 (defun in-system-configuration-directory (x)2597 (defun* in-system-configuration-directory (x) 2537 2598 (in-first-directory (system-configuration-directories) x)) 2538 2599 2539 (defun configuration-inheritance-directive-p (x)2600 (defun* configuration-inheritance-directive-p (x) 2540 2601 (let ((kw '(:inherit-configuration :ignore-inherited-configuration))) 2541 2602 (or (member x kw) 2542 2603 (and (length=n-p x 1) (member (car x) kw))))) 2543 2604 2544 (defun validate-configuration-form (form tag directive-validator2605 (defun* validate-configuration-form (form tag directive-validator 2545 2606 &optional (description tag)) 2546 2607 (unless (and (consp form) (eq (car form) tag)) … … 2557 2618 form) 2558 2619 2559 (defun validate-configuration-file (file validator description)2620 (defun* validate-configuration-file (file validator description) 2560 2621 (let ((forms (read-file-forms file))) 2561 2622 (unless (length=n-p forms 1) … … 2563 2624 (funcall validator (car forms)))) 2564 2625 2565 (defun hidden-file-p (pathname)2626 (defun* hidden-file-p (pathname) 2566 2627 (equal (first-char (pathname-name pathname)) #\.)) 2567 2628 2568 (defun validate-configuration-directory (directory tag validator)2629 (defun* validate-configuration-directory (directory tag validator) 2569 2630 (let ((files (sort (ignore-errors 2570 2631 (remove-if … … 2604 2665 *user-cache*) 2605 2666 2606 (defun output-translations ()2667 (defun* output-translations () 2607 2668 (car *output-translations*)) 2608 2669 2609 (defun (setf output-translations) (new-value)2670 (defun* (setf output-translations) (new-value) 2610 2671 (setf *output-translations* 2611 2672 (list … … 2618 2679 new-value) 2619 2680 2620 (defun output-translations-initialized-p ()2681 (defun* output-translations-initialized-p () 2621 2682 (and *output-translations* t)) 2622 2683 2623 (defun clear-output-translations ()2684 (defun* clear-output-translations () 2624 2685 "Undoes any initialization of the output translations. 2625 2686 You might want to call that before you dump an image that would be resumed … … 2632 2693 :name :wild :type "asd" :version :newest)) 2633 2694 2634 2635 (declaim (ftype (function (t &optional boolean) (or null pathname)) 2695 (declaim (ftype (function (t &optional boolean) (values (or null pathname) &optional)) 2636 2696 resolve-location)) 2637 2697 2638 (defun resolve-relative-location-component (super x &optional wildenp)2698 (defun* resolve-relative-location-component (super x &optional wildenp) 2639 2699 (let* ((r (etypecase x 2640 2700 (pathname x) … … 2661 2721 (merge-pathnames* s super))) 2662 2722 2663 (defun resolve-absolute-location-component (x wildenp)2723 (defun* resolve-absolute-location-component (x wildenp) 2664 2724 (let* ((r 2665 2725 (etypecase x … … 2689 2749 s)) 2690 2750 2691 (defun resolve-location (x &optional wildenp)2751 (defun* resolve-location (x &optional wildenp) 2692 2752 (if (atom x) 2693 2753 (resolve-absolute-location-component x wildenp) … … 2698 2758 :finally (return path)))) 2699 2759 2700 (defun location-designator-p (x)2760 (defun* location-designator-p (x) 2701 2761 (flet ((componentp (c) (typep c '(or string pathname keyword)))) 2702 2762 (or (typep x 'boolean) (componentp x) (and (consp x) (every #'componentp x))))) 2703 2763 2704 (defun location-function-p (x)2764 (defun* location-function-p (x) 2705 2765 (and 2706 2766 (consp x) … … 2712 2772 (length=n-p (second x) 2))))) 2713 2773 2714 (defun validate-output-translations-directive (directive)2774 (defun* validate-output-translations-directive (directive) 2715 2775 (unless 2716 2776 (or (member directive '(:inherit-configuration … … 2729 2789 directive) 2730 2790 2731 (defun validate-output-translations-form (form)2791 (defun* validate-output-translations-form (form) 2732 2792 (validate-configuration-form 2733 2793 form … … 2736 2796 "output translations")) 2737 2797 2738 (defun validate-output-translations-file (file)2798 (defun* validate-output-translations-file (file) 2739 2799 (validate-configuration-file 2740 2800 file 'validate-output-translations-form "output translations")) 2741 2801 2742 (defun validate-output-translations-directory (directory)2802 (defun* validate-output-translations-directory (directory) 2743 2803 (validate-configuration-directory 2744 2804 directory :output-translations 'validate-output-translations-directive)) 2745 2805 2746 (defun parse-output-translations-string (string)2806 (defun* parse-output-translations-string (string) 2747 2807 (cond 2748 2808 ((or (null string) (equal string "")) … … 2789 2849 system-output-translations-directory-pathname)) 2790 2850 2791 (defun wrapping-output-translations ()2851 (defun* wrapping-output-translations () 2792 2852 `(:output-translations 2793 2853 ;; Some implementations have precompiled ASDF systems, … … 2807 2867 (defparameter *output-translations-directory* #p"asdf-output-translations.conf.d/") 2808 2868 2809 (defun user-output-translations-pathname ()2869 (defun* user-output-translations-pathname () 2810 2870 (in-user-configuration-directory *output-translations-file* )) 2811 (defun system-output-translations-pathname ()2871 (defun* system-output-translations-pathname () 2812 2872 (in-system-configuration-directory *output-translations-file*)) 2813 (defun user-output-translations-directory-pathname ()2873 (defun* user-output-translations-directory-pathname () 2814 2874 (in-user-configuration-directory *output-translations-directory*)) 2815 (defun system-output-translations-directory-pathname ()2875 (defun* system-output-translations-directory-pathname () 2816 2876 (in-system-configuration-directory *output-translations-directory*)) 2817 (defun environment-output-translations ()2877 (defun* environment-output-translations () 2818 2878 (getenv "ASDF_OUTPUT_TRANSLATIONS")) 2819 2879 2820 (defgeneric process-output-translations (spec &key inherit collect))2880 (defgeneric* process-output-translations (spec &key inherit collect)) 2821 2881 (declaim (ftype (function (t &key (:collect (or symbol function))) t) 2822 2882 inherit-output-translations)) … … 2848 2908 (process-output-translations-directive directive :inherit inherit :collect collect))) 2849 2909 2850 (defun inherit-output-translations (inherit &key collect)2910 (defun* inherit-output-translations (inherit &key collect) 2851 2911 (when inherit 2852 2912 (process-output-translations (first inherit) :collect collect :inherit (rest inherit)))) 2853 2913 2854 (defun process-output-translations-directive (directive &key inherit collect)2914 (defun* process-output-translations-directive (directive &key inherit collect) 2855 2915 (if (atom directive) 2856 2916 (ecase directive … … 2890 2950 (funcall collect (list trusrc trudst))))))))))) 2891 2951 2892 (defun compute-output-translations (&optional parameter)2952 (defun* compute-output-translations (&optional parameter) 2893 2953 "read the configuration, return it" 2894 2954 (remove-duplicates … … 2898 2958 :test 'equal :from-end t)) 2899 2959 2900 (defun initialize-output-translations (&optional parameter)2960 (defun* initialize-output-translations (&optional parameter) 2901 2961 "read the configuration, initialize the internal configuration variable, 2902 2962 return the configuration" 2903 2963 (setf (output-translations) (compute-output-translations parameter))) 2904 2964 2905 (defun disable-output-translations ()2965 (defun* disable-output-translations () 2906 2966 "Initialize output translations in a way that maps every file to itself, 2907 2967 effectively disabling the output translation facility." … … 2913 2973 ;; the latter, initialize. ASDF will call this function at the start 2914 2974 ;; of (asdf:find-system). 2915 (defun ensure-output-translations ()2975 (defun* ensure-output-translations () 2916 2976 (if (output-translations-initialized-p) 2917 2977 (output-translations) 2918 2978 (initialize-output-translations))) 2919 2979 2920 (defun apply-output-translations (path) 2980 (defun* translate-pathname* (path absolute-source destination &optional root source) 2981 (declare (ignore source)) 2982 (cond 2983 ((functionp destination) 2984 (funcall destination path absolute-source)) 2985 ((eq destination t) 2986 path) 2987 ((not (pathnamep destination)) 2988 (error "invalid destination")) 2989 ((not (absolute-pathname-p destination)) 2990 (translate-pathname path absolute-source (merge-pathnames* destination root))) 2991 (root 2992 (translate-pathname (directorize-pathname-host-device path) absolute-source destination)) 2993 (t 2994 (translate-pathname path absolute-source destination)))) 2995 2996 (defun* apply-output-translations (path) 2921 2997 (etypecase path 2922 2998 (logical-pathname … … 2935 3011 (t source)) 2936 3012 :when (or (eq source t) (pathname-match-p p absolute-source)) 2937 :return 2938 (cond 2939 ((functionp destination) 2940 (funcall destination p absolute-source)) 2941 ((eq destination t) 2942 p) 2943 ((not (pathnamep destination)) 2944 (error "invalid destination")) 2945 ((not (absolute-pathname-p destination)) 2946 (translate-pathname p absolute-source (merge-pathnames* destination root))) 2947 (root 2948 (translate-pathname (directorize-pathname-host-device p) absolute-source destination)) 2949 (t 2950 (translate-pathname p absolute-source destination))) 3013 :return (translate-pathname* p absolute-source destination root source) 2951 3014 :finally (return p))))) 2952 3015 … … 2961 3024 t)) 2962 3025 2963 (defun compile-file-pathname* (input-file &rest keys &key output-file &allow-other-keys)3026 (defun* compile-file-pathname* (input-file &rest keys &key output-file &allow-other-keys) 2964 3027 (or output-file 2965 3028 (apply-output-translations … … 2968 3031 keys)))) 2969 3032 2970 (defun tmpize-pathname (x)3033 (defun* tmpize-pathname (x) 2971 3034 (make-pathname 2972 3035 :name (format nil "ASDF-TMP-~A" (pathname-name x)) 2973 3036 :defaults x)) 2974 3037 2975 (defun delete-file-if-exists (x)3038 (defun* delete-file-if-exists (x) 2976 3039 (when (and x (probe-file x)) 2977 3040 (delete-file x))) 2978 3041 2979 (defun compile-file* (input-file &rest keys &key &allow-other-keys)3042 (defun* compile-file* (input-file &rest keys &key &allow-other-keys) 2980 3043 (let* ((output-file (apply 'compile-file-pathname* input-file keys)) 2981 3044 (tmp-file (tmpize-pathname output-file)) … … 3002 3065 3003 3066 #+abcl 3004 (defun translate-jar-pathname (source wildcard)3067 (defun* translate-jar-pathname (source wildcard) 3005 3068 (declare (ignore wildcard)) 3006 3069 (let* ((p (pathname (first (pathname-device source)))) … … 3018 3081 ;;;; Compatibility mode for ASDF-Binary-Locations 3019 3082 3020 (defun enable-asdf-binary-locations-compatibility3083 (defun* enable-asdf-binary-locations-compatibility 3021 3084 (&key 3022 3085 (centralize-lisp-binaries nil) … … 3057 3120 (defparameter *link-guid* #(1 20 2 0 0 0 0 0 192 0 0 0 0 0 0 70)) 3058 3121 3059 (defun read-null-terminated-string (s)3122 (defun* read-null-terminated-string (s) 3060 3123 (with-output-to-string (out) 3061 3124 (loop :for code = (read-byte s) … … 3063 3126 :do (write-char (code-char code) out)))) 3064 3127 3065 (defun read-little-endian (s &optional (bytes 4))3128 (defun* read-little-endian (s &optional (bytes 4)) 3066 3129 (loop 3067 3130 :for i :from 0 :below bytes 3068 3131 :sum (ash (read-byte s) (* 8 i)))) 3069 3132 3070 (defun parse-file-location-info (s)3133 (defun* parse-file-location-info (s) 3071 3134 (let ((start (file-position s)) 3072 3135 (total-length (read-little-endian s)) … … 3092 3155 (read-null-terminated-string s)))))) 3093 3156 3094 (defun parse-windows-shortcut (pathname)3157 (defun* parse-windows-shortcut (pathname) 3095 3158 (with-open-file (s pathname :element-type '(unsigned-byte 8)) 3096 3159 (handler-case … … 3130 3193 '(".bzr" ".cdv" "~.dep" "~.dot" "~.nib" "~.plst" 3131 3194 ".git" ".hg" ".pc" ".svn" "CVS" "RCS" "SCCS" "_darcs" 3132 "_sgbak" "autom4te.cache" "cover_db" "_build")) 3195 "_sgbak" "autom4te.cache" "cover_db" "_build" 3196 "debian")) ;; debian often build stuff under the debian directory... BAD. 3133 3197 3134 3198 (defvar *source-registry-exclusions* *default-source-registry-exclusions*) … … 3138 3202 said element itself being a list of directory pathnames where to look for .asd files") 3139 3203 3140 (defun source-registry ()3204 (defun* source-registry () 3141 3205 (car *source-registry*)) 3142 3206 3143 (defun (setf source-registry) (new-value)3207 (defun* (setf source-registry) (new-value) 3144 3208 (setf *source-registry* (list new-value)) 3145 3209 new-value) 3146 3210 3147 (defun source-registry-initialized-p ()3211 (defun* source-registry-initialized-p () 3148 3212 (and *source-registry* t)) 3149 3213 3150 (defun clear-source-registry ()3214 (defun* clear-source-registry () 3151 3215 "Undoes any initialization of the source registry. 3152 3216 You might want to call that before you dump an image that would be resumed … … 3155 3219 (values)) 3156 3220 3157 (defun validate-source-registry-directive (directive)3221 (defun* validate-source-registry-directive (directive) 3158 3222 (unless 3159 3223 (or (member directive '(:default-registry (:default-registry)) :test 'equal) … … 3169 3233 directive) 3170 3234 3171 (defun validate-source-registry-form (form)3235 (defun* validate-source-registry-form (form) 3172 3236 (validate-configuration-form 3173 3237 form :source-registry 'validate-source-registry-directive "a source registry")) 3174 3238 3175 (defun validate-source-registry-file (file)3239 (defun* validate-source-registry-file (file) 3176 3240 (validate-configuration-file 3177 3241 file 'validate-source-registry-form "a source registry")) 3178 3242 3179 (defun validate-source-registry-directory (directory)3243 (defun* validate-source-registry-directory (directory) 3180 3244 (validate-configuration-directory 3181 3245 directory :source-registry 'validate-source-registry-directive)) 3182 3246 3183 (defun parse-source-registry-string (string)3247 (defun* parse-source-registry-string (string) 3184 3248 (cond 3185 3249 ((or (null string) (equal string "")) … … 3215 3279 (return `(:source-registry ,@(nreverse directives)))))))))) 3216 3280 3217 (defun register-asd-directory (directory &key recurse exclude collect)3281 (defun* register-asd-directory (directory &key recurse exclude collect) 3218 3282 (if (not recurse) 3219 3283 (funcall collect directory) … … 3246 3310 (defparameter *source-registry-directory* #p"source-registry.conf.d/") 3247 3311 3248 (defun wrapping-source-registry ()3312 (defun* wrapping-source-registry () 3249 3313 `(:source-registry 3250 3314 #+sbcl (:tree ,(getenv "SBCL_HOME")) 3251 3315 :inherit-configuration 3252 3316 #+cmu (:tree #p"modules:"))) 3253 (defun default-source-registry ()3317 (defun* default-source-registry () 3254 3318 (flet ((try (x sub) (try-directory-subpath x sub :type :directory))) 3255 3319 `(:source-registry … … 3277 3341 :collect `(:tree ,(try dir "common-lisp/source/")))) 3278 3342 :inherit-configuration))) 3279 (defun user-source-registry ()3343 (defun* user-source-registry () 3280 3344 (in-user-configuration-directory *source-registry-file*)) 3281 (defun system-source-registry ()3345 (defun* system-source-registry () 3282 3346 (in-system-configuration-directory *source-registry-file*)) 3283 (defun user-source-registry-directory ()3347 (defun* user-source-registry-directory () 3284 3348 (in-user-configuration-directory *source-registry-directory*)) 3285 (defun system-source-registry-directory ()3349 (defun* system-source-registry-directory () 3286 3350 (in-system-configuration-directory *source-registry-directory*)) 3287 (defun environment-source-registry ()3351 (defun* environment-source-registry () 3288 3352 (getenv "CL_SOURCE_REGISTRY")) 3289 3353 3290 (defgeneric process-source-registry (spec &key inherit register))3354 (defgeneric* process-source-registry (spec &key inherit register)) 3291 3355 (declaim (ftype (function (t &key (:register (or symbol function))) t) 3292 3356 inherit-source-registry)) … … 3317 3381 (process-source-registry-directive directive :inherit inherit :register register)))) 3318 3382 3319 (defun inherit-source-registry (inherit &key register)3383 (defun* inherit-source-registry (inherit &key register) 3320 3384 (when inherit 3321 3385 (process-source-registry (first inherit) :register register :inherit (rest inherit)))) 3322 3386 3323 (defun process-source-registry-directive (directive &key inherit register)3387 (defun* process-source-registry-directive (directive &key inherit register) 3324 3388 (destructuring-bind (kw &rest rest) (if (consp directive) directive (list directive)) 3325 3389 (ecase kw … … 3347 3411 nil) 3348 3412 3349 (defun flatten-source-registry (&optional parameter)3413 (defun* flatten-source-registry (&optional parameter) 3350 3414 (remove-duplicates 3351 3415 (while-collecting (collect) … … 3360 3424 ;; Will read the configuration and initialize all internal variables, 3361 3425 ;; and return the new configuration. 3362 (defun compute-source-registry (&optional parameter)3426 (defun* compute-source-registry (&optional parameter) 3363 3427 (while-collecting (collect) 3364 3428 (dolist (entry (flatten-source-registry parameter)) … … 3368 3432 :recurse recurse :exclude exclude :collect #'collect))))) 3369 3433 3370 (defun initialize-source-registry (&optional parameter)3434 (defun* initialize-source-registry (&optional parameter) 3371 3435 (setf (source-registry) (compute-source-registry parameter))) 3372 3436 … … 3379 3443 ;; you may override the configuration explicitly by calling 3380 3444 ;; initialize-source-registry directly with your parameter. 3381 (defun ensure-source-registry (&optional parameter)3445 (defun* ensure-source-registry (&optional parameter) 3382 3446 (if (source-registry-initialized-p) 3383 3447 (source-registry) 3384 3448 (initialize-source-registry parameter))) 3385 3449 3386 (defun sysdef-source-registry-search (system)3450 (defun* sysdef-source-registry-search (system) 3387 3451 (ensure-source-registry) 3388 3452 (loop :with name = (coerce-name system) … … 3391 3455 :when file :return file)) 3392 3456 3457 (defun* clear-configuration () 3458 (clear-source-registry) 3459 (clear-output-translations)) 3460 3393 3461 ;;;; ----------------------------------------------------------------- 3394 3462 ;;;; Hook into REQUIRE for ABCL, ClozureCL, CMUCL, ECL and SBCL 3395 3463 ;;;; 3396 #+(or abcl clozure cmu ecl sbcl) 3397 (progn 3398 (defun module-provide-asdf (name) 3399 (handler-bind 3400 ((style-warning #'muffle-warning) 3401 (missing-component (constantly nil)) 3402 (error (lambda (e) 3403 (format *error-output* "ASDF could not load ~(~A~) because ~A.~%" 3404 name e)))) 3405 (let* ((*verbose-out* (make-broadcast-stream)) 3406 (system (find-system (string-downcase name) nil))) 3407 (when system 3408 (load-system system) 3409 t)))) 3410 (pushnew 'module-provide-asdf 3411 #+abcl sys::*module-provider-functions* 3412 #+clozure ccl:*module-provider-functions* 3413 #+cmu ext:*module-provider-functions* 3414 #+ecl si:*module-provider-functions* 3415 #+sbcl sb-ext:*module-provider-functions*)) 3464 (defun* module-provide-asdf (name) 3465 (handler-bind 3466 ((style-warning #'muffle-warning) 3467 (missing-component (constantly nil)) 3468 (error (lambda (e) 3469 (format *error-output* "ASDF could not load ~(~A~) because ~A.~%" 3470 name e)))) 3471 (let* ((*verbose-out* (make-broadcast-stream)) 3472 (system (find-system (string-downcase name) nil))) 3473 (when system 3474 (load-system system) 3475 t)))) 3476 3477 #+(or abcl clisp clozure cmu ecl sbcl) 3478 (let ((x (and #+clisp (find-symbol "*MODULE-PROVIDER-FUNCTIONS*" :custom)))) 3479 (when x 3480 (eval `(pushnew 'module-provide-asdf 3481 #+abcl sys::*module-provider-functions* 3482 #+clisp ,x 3483 #+clozure ccl:*module-provider-functions* 3484 #+cmu ext:*module-provider-functions* 3485 #+ecl si:*module-provider-functions* 3486 #+sbcl sb-ext:*module-provider-functions*)))) 3487 3416 3488 3417 3489 ;;;; -------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.
