Changeset 14789
- Timestamp:
- May 9, 2011, 10:12:10 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/source/tools/asdf.lisp (modified) (94 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/tools/asdf.lisp
r14706 r14789 1 1 ;;; -*- mode: common-lisp; Base: 10 ; Syntax: ANSI-Common-Lisp -*- 2 ;;; This is ASDF 2.01 4: Another System Definition Facility.2 ;;; This is ASDF 2.015: Another System Definition Facility. 3 3 ;;; 4 4 ;;; Feedback, bug reports, and patches are all welcome: … … 20 20 ;;; Monday; July 13, 2009) 21 21 ;;; 22 ;;; Copyright (c) 2001-201 0Daniel Barlow and contributors22 ;;; Copyright (c) 2001-2011 Daniel Barlow and contributors 23 23 ;;; 24 24 ;;; Permission is hereby granted, free of charge, to any person obtaining … … 50 50 (cl:in-package #-genera :common-lisp-user #+genera :future-common-lisp-user) 51 51 52 #-(or abcl allegro clisp clozure cmu cormanlisp ecl gcl genera lispworks mcl sbcl scl xcl) 53 (error "ASDF is not supported on your implementation. Please help us with it.") 54 52 55 #+gcl (defpackage :asdf (:use :cl)) ;; GCL treats defpackage magically and needs this 53 56 54 57 (eval-when (:compile-toplevel :load-toplevel :execute) 55 ;;; make package if it doesn't exist yet.56 ;;; DEFPACKAGE may cause errors on discrepancies, so we avoid it.57 (unless (find-package :asdf)58 (make-package :asdf :use '(:common-lisp)))59 58 ;;; Implementation-dependent tweaks 60 59 ;; (declaim (optimize (speed 2) (debug 2) (safety 3))) ; NO: rely on the implementation defaults. … … 62 61 (setf excl::*autoload-package-name-alist* 63 62 (remove "asdf" excl::*autoload-package-name-alist* 64 :test 'equalp :key 'car)) 63 :test 'equalp :key 'car)) ; need that BEFORE any mention of package ASDF as below 65 64 #+(and ecl (not ecl-bytecmp)) (require :cmp) 66 65 #+(and (or win32 windows mswindows mingw32) (not cygwin)) (pushnew :asdf-windows *features*) 67 #+(or unix cygwin) (pushnew :asdf-unix *features*)) 66 #+(or unix cygwin) (pushnew :asdf-unix *features*) 67 ;;; make package if it doesn't exist yet. 68 ;;; DEFPACKAGE may cause errors on discrepancies, so we avoid it. 69 (unless (find-package :asdf) 70 (make-package :asdf :use '(:common-lisp)))) 68 71 69 72 (in-package :asdf) 70 71 ;;; Strip out formating that is not supported on Genera.72 (defmacro compatfmt (format)73 #-genera format74 #+genera75 (let ((r '(("~@<" . "")76 ("; ~@;" . "; ")77 ("~3i~_" . "")78 ("~@:>" . "")79 ("~:>" . ""))))80 (dolist (i r)81 (loop :for found = (search (car i) format) :while found :do82 (setf format (concatenate 'simple-string (subseq format 0 found)83 (cdr i)84 (subseq format (+ found (length (car i))))))))85 format))86 73 87 74 ;;;; Create packages in a way that is compatible with hot-upgrade. … … 92 79 (defvar *asdf-version* nil) 93 80 (defvar *upgraded-p* nil) 81 (defvar *asdf-verbose* nil) ; was t from 2.000 to 2.014.12. 82 ;; Strip out formatting that is not supported on Genera. 83 ;; Has to be inside the eval-when to make Lispworks happy (!) 84 (defmacro compatfmt (format) 85 #-genera format 86 #+genera 87 (loop :for (unsupported . replacement) :in 88 '(("~@<" . "") 89 ("; ~@;" . "; ") 90 ("~3i~_" . "") 91 ("~@:>" . "") 92 ("~:>" . "")) :do 93 (loop :for found = (search unsupported format) :while found :do 94 (setf format 95 (concatenate 'simple-string 96 (subseq format 0 found) replacement 97 (subseq format (+ found (length unsupported))))))) 98 format) 94 99 (let* (;; For bug reporting sanity, please always bump this version when you modify this file. 95 100 ;; Please also modify asdf.asd to reflect this change. The script bin/bump-version … … 100 105 ;; "2.345.0.7" would be your seventh local modification of official release 2.345 101 106 ;; "2.345.6.7" would be your seventh local modification of development version 2.345.6 102 (asdf-version "2.01 4")107 (asdf-version "2.015") 103 108 (existing-asdf (fboundp 'find-system)) 104 109 (existing-version *asdf-version*) 105 110 (already-there (equal asdf-version existing-version))) 106 111 (unless (and existing-asdf already-there) 107 (when existing-asdf112 (when (and existing-asdf *asdf-verbose*) 108 113 (format *trace-output* 109 (compatfmt "~&~@<; ~@;Upgrading ASDF ~@[from version ~A ~]to version ~A~@:>~%")110 existing-version asdf-version))114 (compatfmt "~&~@<; ~@;Upgrading ASDF ~@[from version ~A ~]to version ~A~@:>~%") 115 existing-version asdf-version)) 111 116 (labels 112 117 ((present-symbol-p (symbol package) … … 148 153 (let ((sym (find-sym symbol package))) 149 154 (when sym 150 (unexport sym package)155 #-cormanlisp (unexport sym package) 151 156 (unintern sym package) 152 157 sym))) … … 214 219 #:system-source-file #:operate #:find-component #:find-system 215 220 #:apply-output-translations #:translate-pathname* #:resolve-location 216 #:compile-file* )221 #:compile-file* #:source-file-type) 217 222 :unintern 218 223 (#:*asdf-revision* #:around #:asdf-method-combination … … 226 231 :export 227 232 (#:defsystem #:oos #:operate #:find-system #:run-shell-command 228 #:system-definition-pathname #:find-component ; miscellaneous 233 #:system-definition-pathname 234 #:search-for-system-definition #:find-component ; miscellaneous 229 235 #:compile-system #:load-system #:test-system #:clear-system 230 236 #:compile-op #:load-op #:load-source-op … … 234 240 #:version ; metaphorically sort-of an operation 235 241 #:version-satisfies 242 #:upgrade-asdf 243 #:implementation-identifier #:implementation-type 236 244 237 245 #:input-files #:output-files #:output-file #:perform ; operation methods … … 240 248 #:component #:source-file 241 249 #:c-source-file #:cl-source-file #:java-source-file 250 #:cl-source-file.cl #:cl-source-file.lsp 242 251 #:static-file 243 252 #:doc-file … … 350 359 #:truenamize 351 360 #:while-collecting))) 352 #+genera (import 'scl:boolean :asdf)361 #+genera (import 'scl:boolean :asdf) 353 362 (setf *asdf-version* asdf-version 354 363 *upgraded-p* (if existing-version … … 362 371 "Exported interface to the version of ASDF currently installed. A string. 363 372 You can compare this string with e.g.: 364 (ASDF:VERSION-SATISFIES (ASDF:ASDF-VERSION) \"2. 013\")."373 (ASDF:VERSION-SATISFIES (ASDF:ASDF-VERSION) \"2.345.67\")." 365 374 *asdf-version*) 366 375 … … 382 391 383 392 (defvar *verbose-out* nil) 384 385 (defvar *asdf-verbose* t)386 393 387 394 (defparameter +asdf-methods+ … … 397 404 398 405 ;;;; ------------------------------------------------------------------------- 406 ;;;; Resolve forward references 407 408 (declaim (ftype (function (t) t) 409 format-arguments format-control 410 error-name error-pathname error-condition 411 duplicate-names-name 412 error-component error-operation 413 module-components module-components-by-name 414 circular-dependency-components 415 condition-arguments condition-form 416 condition-format condition-location 417 coerce-name) 418 #-cormanlisp 419 (ftype (function (t t) t) (setf module-components-by-name))) 420 421 ;;;; ------------------------------------------------------------------------- 422 ;;;; Compatibility with Corman Lisp 423 #+cormanlisp 424 (progn 425 (deftype logical-pathname () nil) 426 (defun make-broadcast-stream () *error-output*) 427 (defun file-namestring (p) 428 (setf p (pathname p)) 429 (format nil "~@[~A~]~@[.~A~]" (pathname-name p) (pathname-type p))) 430 (defparameter *count* 3) 431 (defun dbg (&rest x) 432 (format *error-output* "~S~%" x))) 433 #+cormanlisp 434 (defun maybe-break () 435 (decf *count*) 436 (unless (plusp *count*) 437 (setf *count* 3) 438 (break))) 439 440 ;;;; ------------------------------------------------------------------------- 399 441 ;;;; General Purpose Utilities 400 442 … … 404 446 `(progn 405 447 #+(or ecl gcl) (fmakunbound ',name) 406 ,(when (and #+ecl (symbolp name)) 407 `(declaim (notinline ,name))) ; fails for setf functions on ecl 448 #-gcl ; gcl 2.7.0 notinline functions lose secondary return values :-( 449 ,(when (and #+ecl (symbolp name)) ; fails for setf functions on ecl 450 `(declaim (notinline ,name))) 408 451 (,',def ,name ,formals ,@rest))))) 409 452 (defdef defgeneric* defgeneric) … … 529 572 (and (stringp s) (plusp (length s)) (char s (1- (length s))))) 530 573 531 574 532 575 (defun* asdf-message (format-string &rest format-args) 533 576 (declare (dynamic-extent format-args)) 534 (apply #'format *verbose-out* format-string format-args))577 (apply 'format *verbose-out* format-string format-args)) 535 578 536 579 (defun* split-string (string &key max (separator '(#\Space #\Tab))) … … 540 583 starting the separation from the end, e.g. when called with arguments 541 584 \"a.b.c.d.e\" :max 3 :separator \".\" it will return (\"a.b.c\" \"d\" \"e\")." 542 ( blocknil585 (catch nil 543 586 (let ((list nil) (words 0) (end (length string))) 544 587 (flet ((separatorp (char) (find char separator)) 545 (done () ( return(cons (subseq string 0 end) list))))588 (done () (throw nil (cons (subseq string 0 end) list)))) 546 589 (loop 547 590 :for start = (if (and max (>= words (1- max))) … … 623 666 (defun* getenv (x) 624 667 (declare (ignorable x)) 625 #+(or abcl clisp ) (ext:getenv x)668 #+(or abcl clisp xcl) (ext:getenv x) 626 669 #+allegro (sys:getenv x) 627 670 #+clozure (ccl:getenv x) 628 671 #+(or cmu scl) (cdr (assoc x ext:*environment-list* :test #'string=)) 672 #+cormanlisp 673 (let* ((buffer (ct:malloc 1)) 674 (cname (ct:lisp-string-to-c-string x)) 675 (needed-size (win:getenvironmentvariable cname buffer 0)) 676 (buffer1 (ct:malloc (1+ needed-size)))) 677 (prog1 (if (zerop (win:getenvironmentvariable cname buffer1 needed-size)) 678 nil 679 (ct:c-string-to-lisp-string buffer1)) 680 (ct:free buffer) 681 (ct:free buffer1))) 629 682 #+ecl (si:getenv x) 630 683 #+gcl (system:getenv x) … … 636 689 (ccl:%get-cstring value)))) 637 690 #+sbcl (sb-ext:posix-getenv x) 638 #-(or abcl allegro clisp clozure cmu ecl gcl genera lispworks mcl sbcl scl)639 (error " getenv not available on your implementation"))691 #-(or abcl allegro clisp clozure cmu cormanlisp ecl gcl genera lispworks mcl sbcl scl xcl) 692 (error "~S is not supported on your implementation" 'getenv)) 640 693 641 694 (defun* directory-pathname-p (pathname) … … 713 766 (defun* get-uid () 714 767 #+allegro (excl.osi:getuid) 768 #+ccl (ccl::getuid) 715 769 #+clisp (loop :for s :in '("posix:uid" "LINUX:getuid") 716 770 :for f = (ignore-errors (read-from-string s)) … … 721 775 '(ext::getuid)) 722 776 #+sbcl (sb-unix:unix-getuid) 723 #-(or allegro c lisp cmu ecl sbcl scl)777 #-(or allegro ccl clisp cmu ecl sbcl scl) 724 778 (let ((uid-string 725 779 (with-output-to-string (*verbose-out*) … … 743 797 with given pathname and if it exists return its truename." 744 798 (etypecase p 745 (null nil)746 (string (probe-file* (parse-namestring p)))747 (pathname (unless (wild-pathname-p p)748 #.(or #+(or allegro clozure cmuecl sbcl scl) '(probe-file p)749 #+clisp (aif (find-symbol (string '#:probe-pathname) :ext) `(ignore-errors (,it p)))750 '(ignore-errors (truename p)))))))799 (null nil) 800 (string (probe-file* (parse-namestring p))) 801 (pathname (unless (wild-pathname-p p) 802 #.(or #+(or allegro clozure cmu cormanlisp ecl sbcl scl) '(probe-file p) 803 #+clisp (aif (find-symbol (string '#:probe-pathname) :ext) `(ignore-errors (,it p))) 804 '(ignore-errors (truename p))))))) 751 805 752 806 (defun* truenamize (p) … … 789 843 (excl:pathname-resolve-symbolic-links path))) 790 844 845 (defun* resolve-symlinks* (path) 846 (if *resolve-symlinks* 847 (and path (resolve-symlinks path)) 848 path)) 849 850 (defun ensure-pathname-absolute (path) 851 (cond 852 ((absolute-pathname-p path) path) 853 ((stringp path) (ensure-pathname-absolute (pathname path))) 854 ((not (pathnamep path)) (error "not a valid pathname designator ~S" path)) 855 (t (let ((resolved (resolve-symlinks path))) 856 (assert (absolute-pathname-p resolved)) 857 resolved)))) 858 791 859 (defun* default-directory () 792 860 (truenamize (pathname-directory-pathname *default-pathname-defaults*))) … … 795 863 (make-pathname :type "lisp" :defaults input-file)) 796 864 865 (defparameter *wild* #-cormanlisp :wild #+cormanlisp "*") 797 866 (defparameter *wild-file* 798 (make-pathname :name :wild :type :wild :version :wild:directory nil))867 (make-pathname :name *wild* :type *wild* :version *wild* :directory nil)) 799 868 (defparameter *wild-directory* 800 (make-pathname :directory '(:relative :wild) :name nil :type nil :version nil))869 (make-pathname :directory `(:relative ,*wild*) :name nil :type nil :version nil)) 801 870 (defparameter *wild-inferiors* 802 871 (make-pathname :directory '(:relative :wild-inferiors) :name nil :type nil :version nil)) … … 835 904 (defun* directorize-pathname-host-device (pathname) 836 905 (let ((scheme (ext:pathname-scheme pathname)) 837 (host (pathname-host pathname))838 (port (ext:pathname-port pathname))839 (directory (pathname-directory pathname)))906 (host (pathname-host pathname)) 907 (port (ext:pathname-port pathname)) 908 (directory (pathname-directory pathname))) 840 909 (flet ((not-unspecific (component) 841 (and (not (eq component :unspecific)) component)))910 (and (not (eq component :unspecific)) component))) 842 911 (cond ((or (not-unspecific port) 843 (and (not-unspecific host) (plusp (length host)))844 (not-unspecific scheme))845 (let ((prefix ""))846 (when (not-unspecific port)847 (setf prefix (format nil ":~D" port)))848 (when (and (not-unspecific host) (plusp (length host)))849 (setf prefix (concatenate 'string host prefix)))850 (setf prefix (concatenate 'string ":" prefix))851 (when (not-unspecific scheme)852 (setf prefix (concatenate 'string scheme prefix)))853 (assert (and directory (eq (first directory) :absolute)))854 (make-pathname :directory `(:absolute ,prefix ,@(rest directory))855 :defaults pathname)))856 (t857 pathname)))))912 (and (not-unspecific host) (plusp (length host))) 913 (not-unspecific scheme)) 914 (let ((prefix "")) 915 (when (not-unspecific port) 916 (setf prefix (format nil ":~D" port))) 917 (when (and (not-unspecific host) (plusp (length host))) 918 (setf prefix (concatenate 'string host prefix))) 919 (setf prefix (concatenate 'string ":" prefix)) 920 (when (not-unspecific scheme) 921 (setf prefix (concatenate 'string scheme prefix))) 922 (assert (and directory (eq (first directory) :absolute))) 923 (make-pathname :directory `(:absolute ,prefix ,@(rest directory)) 924 :defaults pathname))) 925 (t 926 pathname))))) 858 927 859 928 ;;;; ------------------------------------------------------------------------- … … 892 961 (defgeneric* (setf component-property) (new-value component property)) 893 962 963 (eval-when (:compile-toplevel :load-toplevel :execute) 964 (defgeneric* (setf module-components-by-name) (new-value module))) 965 894 966 (defgeneric* version-satisfies (component version)) 895 967 … … 968 1040 (when (find-class 'module nil) 969 1041 (eval 970 `(defmethod update-instance-for-redefined-class :after1042 '(defmethod update-instance-for-redefined-class :after 971 1043 ((m module) added deleted plist &key) 972 1044 (declare (ignorable deleted plist)) 973 (when (or *asdf-verbose* *load-verbose*)1045 (when *asdf-verbose* 974 1046 (asdf-message (compatfmt "~&~@<; ~@;Updating ~A for ASDF ~A~@:>~%") 975 m ,(asdf-version)))1047 m (asdf-version))) 976 1048 (when (member 'components-by-name added) 977 1049 (compute-module-components-by-name m)) … … 995 1067 #+cmu (:report print-object)) 996 1068 997 (declaim (ftype (function (t) t)998 format-arguments format-control999 error-name error-pathname error-condition1000 duplicate-names-name1001 error-component error-operation1002 module-components module-components-by-name1003 circular-dependency-components1004 condition-arguments condition-form1005 condition-format condition-location1006 coerce-name)1007 (ftype (function (t t) t) (setf module-components-by-name)))1008 1009 1010 1069 (define-condition formatted-system-definition-error (system-definition-error) 1011 1070 ((format-control :initarg :format-control :reader format-control) 1012 1071 (format-arguments :initarg :format-arguments :reader format-arguments)) 1013 1072 (:report (lambda (c s) 1014 (apply #'format s (format-control c) (format-arguments c)))))1073 (apply 'format s (format-control c) (format-arguments c))))) 1015 1074 1016 1075 (define-condition load-system-definition-error (system-definition-error) … … 1019 1078 (condition :initarg :condition :reader error-condition)) 1020 1079 (:report (lambda (c s) 1021 (format s (compatfmt "~@<Error while trying to load definition for system ~A from pathname ~A: ~3i~_~A~@:>")1022 (error-name c) (error-pathname c) (error-condition c)))))1080 (format s (compatfmt "~@<Error while trying to load definition for system ~A from pathname ~A: ~3i~_~A~@:>") 1081 (error-name c) (error-pathname c) (error-condition c))))) 1023 1082 1024 1083 (define-condition circular-dependency (system-definition-error) 1025 1084 ((components :initarg :components :reader circular-dependency-components)) 1026 1085 (:report (lambda (c s) 1027 (format s (compatfmt "~@<Circular dependency: ~3i~_~S~@:>")1028 (circular-dependency-components c)))))1086 (format s (compatfmt "~@<Circular dependency: ~3i~_~S~@:>") 1087 (circular-dependency-components c))))) 1029 1088 1030 1089 (define-condition duplicate-names (system-definition-error) 1031 1090 ((name :initarg :name :reader duplicate-names-name)) 1032 1091 (:report (lambda (c s) 1033 (format s (compatfmt "~@<Error while defining system: multiple components are given same name ~A~@:>")1034 (duplicate-names-name c)))))1092 (format s (compatfmt "~@<Error while defining system: multiple components are given same name ~A~@:>") 1093 (duplicate-names-name c))))) 1035 1094 1036 1095 (define-condition missing-component (system-definition-error) … … 1074 1133 1075 1134 (defclass component () 1076 ((name :accessor component-name :initarg :name : documentation1135 ((name :accessor component-name :initarg :name :type string :documentation 1077 1136 "Component name: designator for a string composed of portable pathname characters") 1078 (version :accessor component-version :initarg :version) 1137 (version :accessor component-version :initarg :version) ;; :type (and string (satisfies parse-version)) -- not until we fix all systems that don't use it correctly! 1079 1138 (description :accessor component-description :initarg :description) 1080 1139 (long-description :accessor component-long-description :initarg :long-description) … … 1155 1214 (missing-version c) 1156 1215 (when (missing-parent c) 1157 (co mponent-name (missing-parent c)))))1216 (coerce-name (missing-parent c))))) 1158 1217 1159 1218 (defmethod component-system ((component component)) … … 1245 1304 (defmethod version-satisfies ((c component) version) 1246 1305 (unless (and version (slot-boundp c 'version)) 1306 (when version 1307 (warn "Requested version ~S but component ~S has no version" version c)) 1247 1308 (return-from version-satisfies t)) 1248 1309 (version-satisfies (component-version c) version)) 1249 1310 1311 (defun parse-version (string &optional on-error) 1312 "Parse a version string as a series of natural integers separated by dots. 1313 Return a (non-null) list of integers if the string is valid, NIL otherwise. 1314 If on-error is error, warn, or designates a function of compatible signature, 1315 the function is called with an explanation of what is wrong with the argument. 1316 NB: ignores leading zeroes, and so doesn't distinguish between 2.003 and 2.3" 1317 (and 1318 (or (stringp string) 1319 (when on-error 1320 (funcall on-error "~S: ~S is not a string" 1321 'parse-version string)) nil) 1322 (or (loop :for prev = nil :then c :for c :across string 1323 :always (or (digit-char-p c) 1324 (and (eql c #\.) prev (not (eql prev #\.)))) 1325 :finally (return (and c (digit-char-p c)))) 1326 (when on-error 1327 (funcall on-error "~S: ~S doesn't follow asdf version numbering convention" 1328 'parse-version string)) nil) 1329 (mapcar #'parse-integer (split-string string :separator ".")))) 1330 1250 1331 (defmethod version-satisfies ((cver string) version) 1251 (let ((x (mapcar #'parse-integer 1252 (split-string cver :separator "."))) 1253 (y (mapcar #'parse-integer 1254 (split-string version :separator ".")))) 1332 (let ((x (parse-version cver 'warn)) 1333 (y (parse-version version 'warn))) 1255 1334 (labels ((bigger (x y) 1256 1335 (cond ((not y) t) … … 1259 1338 ((= (car x) (car y)) 1260 1339 (bigger (cdr x) (cdr y)))))) 1261 (and (= (car x) (car y))1340 (and x y (= (car x) (car y)) 1262 1341 (or (not (cdr y)) (bigger (cdr x) (cdr y))))))) 1263 1342 … … 1285 1364 (gethash (coerce-name name) *defined-systems*)) 1286 1365 1366 (defun* register-system (system) 1367 (check-type system system) 1368 (let ((name (component-name system))) 1369 (check-type name string) 1370 (asdf-message (compatfmt "~&~@<; ~@;Registering ~3i~_~A~@:>~%") system) 1371 (unless (eq system (cdr (gethash name *defined-systems*))) 1372 (setf (gethash name *defined-systems*) 1373 (cons (get-universal-time) system))))) 1374 1287 1375 (defun* clear-system (name) 1288 1376 "Clear the entry for a system in the database of systems previously loaded. 1289 1377 Note that this does NOT in any way cause the code of the system to be unloaded." 1290 ;; There is no "unload" operation in Common Lisp, and a general such operation1291 ;; cannot be portably written, considering how much CL relies on side-effects1292 ;; to global data structures.1378 ;; There is no "unload" operation in Common Lisp, and 1379 ;; a general such operation cannot be portably written, 1380 ;; considering how much CL relies on side-effects to global data structures. 1293 1381 (remhash (coerce-name name) *defined-systems*)) 1294 1382 … … 1309 1397 1310 1398 (defparameter *system-definition-search-functions* 1311 '(sysdef-central-registry-search sysdef-source-registry-search sysdef-find-asdf)) 1312 1313 (defun* system-definition-pathname (system) 1399 '(sysdef-central-registry-search 1400 sysdef-source-registry-search 1401 sysdef-find-asdf)) 1402 1403 (defun* search-for-system-definition (system) 1314 1404 (let ((system-name (coerce-name system))) 1315 (or 1316 (some #'(lambda (x) (funcall x system-name)) 1317 *system-definition-search-functions*) 1318 (let ((system-pair (system-registered-p system-name))) 1319 (and system-pair 1320 (system-source-file (cdr system-pair))))))) 1405 (some #'(lambda (x) (funcall x system-name)) 1406 *system-definition-search-functions*))) 1321 1407 1322 1408 (defvar *central-registry* nil … … 1382 1468 (coerce-entry-to-directory () 1383 1469 :report (lambda (s) 1384 (format s (compatfmt "~@<Coerce entry to ~a, replace ~a and continue.~@:>")1385 (ensure-directory-pathname defaults) dir))1470 (format s (compatfmt "~@<Coerce entry to ~a, replace ~a and continue.~@:>") 1471 (ensure-directory-pathname defaults) dir)) 1386 1472 (push (cons dir (ensure-directory-pathname defaults)) to-replace)))))))) 1387 1473 ;; cleanup … … 1415 1501 ;; as if the file were very old. 1416 1502 ;; (or should we treat the case in a different, special way?) 1417 (or (and pathname (probe-file* pathname) ( file-write-date pathname))1503 (or (and pathname (probe-file* pathname) (ignore-errors (file-write-date pathname))) 1418 1504 (progn 1419 1505 (when (and pathname *asdf-verbose*) … … 1421 1507 pathname)) 1422 1508 0))) 1509 1510 (defmethod find-system ((name null) &optional (error-p t)) 1511 (when error-p 1512 (sysdef-error (compatfmt "~@<NIL is not a valid system name~@:>")))) 1423 1513 1424 1514 (defmethod find-system (name &optional (error-p t)) … … 1436 1526 (let ((*package* package)) 1437 1527 (asdf-message (compatfmt "~&~@<; ~@;Loading system definition from ~A into ~A~@:>~%") 1438 pathname package)1528 pathname package) 1439 1529 (load pathname))) 1440 1530 (delete-package package)))) 1441 1531 1442 1532 (defmethod find-system ((name string) &optional (error-p t)) 1443 (catch 'find-system 1444 (let* ((in-memory (system-registered-p name)) ; load from disk if absent or newer on disk 1445 (on-disk (system-definition-pathname name))) 1446 (when (and on-disk 1447 (or (not in-memory) 1448 ;; don't reload if it's already been loaded, 1449 ;; or its filestamp is in the future which means some clock is skewed 1450 ;; and trying to load might cause an infinite loop. 1451 (< (car in-memory) (safe-file-write-date on-disk) (get-universal-time)))) 1452 (load-sysdef name on-disk)) 1453 (let ((in-memory (system-registered-p name))) ; try again after loading from disk 1454 (cond 1455 (in-memory 1456 (when on-disk 1457 (setf (car in-memory) (safe-file-write-date on-disk))) 1458 (cdr in-memory)) 1459 (error-p 1460 (error 'missing-component :requires name))))))) 1461 1462 (defun* register-system (name system) 1463 (setf name (coerce-name name)) 1464 (assert (equal name (component-name system))) 1465 (asdf-message (compatfmt "~&~@<; ~@;Registering ~3i~_~A~@:>~%") system) 1466 (setf (gethash name *defined-systems*) (cons (get-universal-time) system))) 1533 (let* ((in-memory (system-registered-p name)) ; load from disk if absent or newer on disk 1534 (previous (cdr in-memory)) 1535 (previous (and (typep previous 'system) previous)) 1536 (previous-time (car in-memory)) 1537 (found (search-for-system-definition name)) 1538 (found-system (and (typep found 'system) found)) 1539 (pathname (or (and (typep found '(or pathname string)) (pathname found)) 1540 (and found-system (system-source-file found-system)) 1541 (and previous (system-source-file previous))))) 1542 (setf pathname (resolve-symlinks* pathname)) 1543 (when (and pathname (not (absolute-pathname-p pathname))) 1544 (setf pathname (ensure-pathname-absolute pathname)) 1545 (when found-system 1546 (%set-system-source-file pathname found-system))) 1547 (when (and previous (not (#-cormanlisp equal #+cormanlisp equalp 1548 (system-source-file previous) pathname))) 1549 (%set-system-source-file pathname previous) 1550 (setf previous-time nil)) 1551 (when (and found-system (not previous)) 1552 (register-system found-system)) 1553 (when (and pathname 1554 (or (not previous-time) 1555 ;; don't reload if it's already been loaded, 1556 ;; or its filestamp is in the future which means some clock is skewed 1557 ;; and trying to load might cause an infinite loop. 1558 (< previous-time (safe-file-write-date pathname) (get-universal-time)))) 1559 (load-sysdef name pathname)) 1560 (let ((in-memory (system-registered-p name))) ; try again after loading from disk 1561 (cond 1562 (in-memory 1563 (when pathname 1564 (setf (car in-memory) (safe-file-write-date pathname))) 1565 (cdr in-memory)) 1566 (error-p 1567 (error 'missing-component :requires name)))))) 1467 1568 1468 1569 (defun* find-system-fallback (requested fallback &rest keys &key source-file &allow-other-keys) 1469 1570 (setf fallback (coerce-name fallback) 1470 source-file (or source-file1471 (if *resolve-symlinks*1472 (or *compile-file-truename* *load-truename*)1473 (or *compile-file-pathname* *load-pathname*)))1474 1571 requested (coerce-name requested)) 1475 1572 (when (equal requested fallback) 1476 (let* ((registered (cdr (gethash fallback *defined-systems*))) 1477 (system (or registered 1478 (apply 'make-instance 'system 1479 :name fallback :source-file source-file keys)))) 1480 (unless registered 1481 (register-system fallback system)) 1482 (throw 'find-system system)))) 1573 (let ((registered (cdr (gethash fallback *defined-systems*)))) 1574 (or registered 1575 (apply 'make-instance 'system 1576 :name fallback :source-file source-file keys))))) 1483 1577 1484 1578 (defun* sysdef-find-asdf (name) … … 1524 1618 (defclass cl-source-file (source-file) 1525 1619 ((type :initform "lisp"))) 1620 (defclass cl-source-file.cl (cl-source-file) 1621 ((type :initform "cl"))) 1622 (defclass cl-source-file.lsp (cl-source-file) 1623 ((type :initform "lsp"))) 1526 1624 (defclass c-source-file (source-file) 1527 1625 ((type :initform "c"))) … … 1573 1671 (t 1574 1672 (split-name-type filename))) 1575 (make-pathname :directory `(,relative ,@path) :name name :type type 1576 :defaults (or defaults *default-pathname-defaults*))))))) 1673 (apply 'make-pathname :directory (cons relative path) :name name :type type 1674 ;; XCL 0.0.0.291 and ABCL 0.25 have a bug, whereby make-pathname merges directories like merge-pathnames when a :defaults is provided. Fixed in the latest XCL. 1675 (when defaults `(:defaults ,defaults)))))))) 1577 1676 1578 1677 (defun* merge-component-name-type (name &key type defaults) 1579 1678 ;; For backwards compatibility only, for people using internals. 1580 ;; Will be removed in a future release, e.g. 2.014. 1679 ;; Will be removed in a future release, e.g. 2.016. 1680 (warn "Please don't use ASDF::MERGE-COMPONENT-NAME-TYPE. Use ASDF:COERCE-PATHNAME.") 1581 1681 (coerce-pathname name :type type :defaults defaults)) 1582 1682 … … 1594 1694 1595 1695 (defclass operation () 1596 ( 1597 ;; as of danb's 2003-03-16 commit e0d02781, :force can be: 1598 ;; T to force the inside of existing system, 1696 (;; as of danb's 2003-03-16 commit e0d02781, :force can be: 1697 ;; T to force the inside of the specified system, 1599 1698 ;; but not recurse to other systems we depend on. 1600 1699 ;; :ALL (or any other atom) to force all systems … … 1602 1701 ;; (SYSTEM1 SYSTEM2 ... SYSTEMN) 1603 1702 ;; to force systems named in a given list 1604 ;; However, but this feature never worked before ASDF 1.700 and is currently cerror'ed out.1703 ;; However, but this feature has only ever worked but starting with ASDF 2.014.5 1605 1704 (forced :initform nil :initarg :force :accessor operation-forced) 1606 1705 (original-initargs :initform nil :initarg :original-initargs … … 1644 1743 (when (eql force-p t) 1645 1744 (setf (getf args :force) nil)) 1646 (apply #'make-instance dep-o1745 (apply 'make-instance dep-o 1647 1746 :parent o 1648 1747 :original-initargs args args)) … … 1650 1749 o) 1651 1750 (t 1652 (apply #'make-instance dep-o1751 (apply 'make-instance dep-o 1653 1752 :parent o :original-initargs args args))))) 1654 1753 … … 1682 1781 1683 1782 (defmethod component-depends-on ((op-spec symbol) (c component)) 1783 ;; Note: we go from op-spec to operation via make-instance 1784 ;; to allow for specialization through defmethod's, even though 1785 ;; it's a detour in the default case below. 1684 1786 (component-depends-on (make-instance op-spec) c)) 1685 1787 1686 1788 (defmethod component-depends-on ((o operation) (c component)) 1687 (cdr (assoc (class-name (class-of o)) 1688 (component-in-order-to c)))) 1789 (cdr (assoc (type-of o) (component-in-order-to c)))) 1689 1790 1690 1791 (defmethod component-self-dependencies ((o operation) (c component)) … … 1803 1904 (retry () 1804 1905 :report (lambda (s) 1805 (format s "~@<Retry loading component ~3i~_~S.~@:>" required-c))1906 (format s "~@<Retry loading ~3i~_~A.~@:>" required-c)) 1806 1907 :test 1807 1908 (lambda (c) 1808 (or (null c)1809 (and (typep c 'missing-dependency)1810 (equalp (missing-requires c)1811 required-c))))))))1909 (or (null c) 1910 (and (typep c 'missing-dependency) 1911 (equalp (missing-requires c) 1912 required-c)))))))) 1812 1913 1813 1914 (defun* do-dep (operation c collect op dep) … … 1856 1957 1857 1958 (defmethod do-traverse ((operation operation) (c component) collect) 1858 (let ((flag nil)) ;; return value: must we rebuild this and its dependencies? 1959 (let ((*forcing* *forcing*) 1960 (flag nil)) ;; return value: must we rebuild this and its dependencies? 1859 1961 (labels 1860 1962 ((update-flag (x) 1861 (when x 1862 (setf flag t))) 1963 (orf flag x)) 1863 1964 (dep (op comp) 1864 1965 (update-flag (do-dep operation c collect op comp)))) … … 1874 1975 (unwind-protect 1875 1976 (progn 1977 (let ((f (operation-forced 1978 (operation-ancestor operation)))) 1979 (when (and f (or (not (consp f)) ;; T or :ALL 1980 (and (typep c 'system) ;; list of names of systems to force 1981 (member (component-name c) f 1982 :test #'string=)))) 1983 (setf *forcing* t))) 1876 1984 ;; first we check and do all the dependencies for the module. 1877 1985 ;; Operations planned in this loop will show up … … 1913 2021 (not at-least-one)) 1914 2022 (error error))))))) 1915 (update-flag 1916 (or 1917 *forcing* 1918 (not (operation-done-p operation c)) 2023 (update-flag (or *forcing* (not (operation-done-p operation c)))) 1919 2024 ;; For sub-operations, check whether 1920 2025 ;; the original ancestor operation was forced, … … 1923 2028 ;; between all the things with a given name. Sigh. 1924 2029 ;; BROKEN! 1925 (let ((f (operation-forced1926 (operation-ancestor operation))))1927 (and f (or (not (consp f)) ;; T or :ALL1928 (and (typep c 'system) ;; list of names of systems to force1929 (member (component-name c) f1930 :test #'string=)))))))1931 2030 (when flag 1932 2031 (let ((do-first (cdr (assoc (class-name (class-of operation)) … … 1957 2056 1958 2057 (defmethod traverse ((operation operation) (c component)) 1959 ;; cerror'ing a feature that seems to have NEVER EVER worked1960 ;; ever since danb created it in his 2003-03-16 commit e0d02781.1961 ;; It was both fixed and disabled in the 1.700 rewrite.1962 2058 (when (consp (operation-forced operation)) 1963 (cerror "Continue nonetheless."1964 "Congratulations, you're the first ever user of the :force (list of system names) feature! Please contact the asdf-devel mailing-list to collect a cookie.")1965 2059 (setf (operation-forced operation) 1966 2060 (mapcar #'coerce-name (operation-forced operation)))) … … 1980 2074 1981 2075 (defmethod explain ((operation operation) (component component)) 1982 (asdf-message "~&;;; ~A~%" (operation-description operation component))) 2076 (asdf-message (compatfmt "~&~@<; ~@;~A~:>~%") 2077 (operation-description operation component))) 1983 2078 1984 2079 (defmethod operation-description (operation component) 1985 (format nil (compatfmt "~@<~A on component ~S~@:>")1986 (class-of operation) (component-find-path component)))2080 (format nil (compatfmt "~@<~A on ~A~@:>") 2081 (class-of operation) component)) 1987 2082 1988 2083 ;;;; ------------------------------------------------------------------------- … … 2068 2163 (defmethod operation-description ((operation compile-op) component) 2069 2164 (declare (ignorable operation)) 2070 (format nil "compiling component ~S" (component-find-path component))) 2165 (format nil (compatfmt "~@<compiling ~3i~_~A~@:>") component)) 2166 2167 (defmethod operation-description ((operation compile-op) (component module)) 2168 (declare (ignorable operation)) 2169 (format nil (compatfmt "~@<compiled ~3i~_~A~@:>") component)) 2170 2071 2171 2072 2172 ;;;; ------------------------------------------------------------------------- … … 2081 2181 2082 2182 (defmethod perform-with-restarts (operation component) 2183 ;;(when *asdf-verbose* (explain operation component)) ; TOO verbose, especially as the default. 2083 2184 (perform operation component)) 2084 2185 … … 2095 2196 (:failed-load 2096 2197 (setf state :recompiled) 2097 (perform (make- instance'compile-op) c))2198 (perform (make-sub-operation c o c 'compile-op) c)) 2098 2199 (t 2099 2200 (with-simple-restart … … 2143 2244 (defmethod operation-description ((operation load-op) component) 2144 2245 (declare (ignorable operation)) 2145 (format nil (compatfmt "~@<Loading component: ~3i~_~S~@:>") 2146 (component-find-path component))) 2147 2246 (format nil (compatfmt "~@<loading ~3i~_~A~@:>") 2247 component)) 2248 2249 (defmethod operation-description ((operation load-op) (component cl-source-file)) 2250 (declare (ignorable operation)) 2251 (format nil (compatfmt "~@<loading FASL for ~3i~_~A~@:>") 2252 component)) 2253 2254 (defmethod operation-description ((operation load-op) (component module)) 2255 (declare (ignorable operation)) 2256 (format nil (compatfmt "~@<loaded ~3i~_~A~@:>") 2257 component)) 2148 2258 2149 2259 ;;;; ------------------------------------------------------------------------- … … 2170 2280 (defmethod component-depends-on ((o load-source-op) (c component)) 2171 2281 (declare (ignorable o)) 2172 (let ((what-would-load-op-do (cdr (assoc 'load-op 2173 (component-in-order-to c))))) 2174 (mapcar #'(lambda (dep) 2175 (if (eq (car dep) 'load-op) 2176 (cons 'load-source-op (cdr dep)) 2177 dep)) 2178 what-would-load-op-do))) 2282 (loop :with what-would-load-op-do = (component-depends-on 'load-op c) 2283 :for (op co) :in what-would-load-op-do 2284 :when (eq op 'load-op) :collect (cons 'load-source-op co))) 2179 2285 2180 2286 (defmethod operation-done-p ((o load-source-op) (c source-file)) … … 2187 2293 (defmethod operation-description ((operation load-source-op) component) 2188 2294 (declare (ignorable operation)) 2189 (format nil (compatfmt "~@<Loading component: ~3i~_~S~@:>") 2190 (component-find-path component))) 2295 (format nil (compatfmt "~@<Loading source of ~3i~_~A~@:>") 2296 component)) 2297 2298 (defmethod operation-description ((operation load-source-op) (component module)) 2299 (declare (ignorable operation)) 2300 (format nil (compatfmt "~@<Loaded source of ~3i~_~A~@:>") component)) 2191 2301 2192 2302 … … 2214 2324 2215 2325 (defgeneric* operate (operation-class system &key &allow-other-keys)) 2326 (defgeneric* perform-plan (plan &key)) 2327 2328 ;;;; Try to upgrade of ASDF. If a different version was used, return T. 2329 ;;;; We need do that before we operate on anything that depends on ASDF. 2330 (defun* upgrade-asdf () 2331 (let ((version (asdf:asdf-version))) 2332 (handler-bind (((or style-warning warning) #'muffle-warning)) 2333 (operate 'load-op :asdf :verbose nil)) 2334 (let ((new-version (asdf:asdf-version))) 2335 (block nil 2336 (cond 2337 ((equal version new-version) 2338 (return nil)) 2339 ((version-satisfies new-version version) 2340 (asdf-message (compatfmt "~&~@<; ~@;Upgraded ASDF from version ~A to version ~A~@:>~%") 2341 version new-version)) 2342 ((version-satisfies version new-version) 2343 (warn (compatfmt "~&~@<Downgraded ASDF from version ~A to version ~A~@:>~%") 2344 version new-version)) 2345 (t 2346 (asdf-message (compatfmt "~&~@<; ~@;Changed ASDF from version ~A to incompatible version ~A~@:>~%") 2347 version new-version))) 2348 (let ((asdf (find-system :asdf))) 2349 ;; invalidate all systems but ASDF itself 2350 (setf *defined-systems* (make-defined-systems-table)) 2351 (register-system asdf) 2352 t))))) 2353 2354 (defmethod perform-plan ((steps list) &key) 2355 (let ((*package* *package*) 2356 (*readtable* *readtable*)) 2357 (with-compilation-unit () 2358 (loop :for (op . component) :in steps :do 2359 (loop 2360 (restart-case 2361 (progn 2362 (perform-with-restarts op component) 2363 (return)) 2364 (retry () 2365 :report 2366 (lambda (s) 2367 (format s (compatfmt "~@<Retry ~A.~@:>") 2368 (operation-description op component)))) 2369 (accept () 2370 :report 2371 (lambda (s) 2372 (format s (compatfmt "~@<Continue, treating ~A as having been successful.~@:>") 2373 (operation-description op component))) 2374 (setf (gethash (type-of op) 2375 (component-operation-times component)) 2376 (get-universal-time)) 2377 (return)))))))) 2216 2378 2217 2379 (defmethod operate (operation-class system &rest args … … 2219 2381 &allow-other-keys) 2220 2382 (declare (ignore force)) 2221 (let* ((*package* *package*) 2222 (*readtable* *readtable*) 2223 (op (apply #'make-instance operation-class 2383 (let* ((op (apply 'make-instance operation-class 2224 2384 :original-initargs args 2225 2385 args)) 2226 2386 (*verbose-out* (if *asdf-verbose* *standard-output* (make-broadcast-stream))) 2227 (system (if (typep system 'component) system (find-system system)))) 2387 (system (etypecase system 2388 (system system) 2389 ((or string symbol) (find-system system))))) 2228 2390 (unless (version-satisfies system version) 2229 2391 (error 'missing-component-of-version :requires system :version version)) 2230 2392 (let ((steps (traverse op system))) 2231 (with-compilation-unit () 2232 (loop :for (op . component) :in steps :do 2233 (loop 2234 (restart-case 2235 (progn 2236 (perform-with-restarts op component) 2237 (return)) 2238 (retry () 2239 :report 2240 (lambda (s) 2241 (format s (compatfmt "~@<Retry ~A.~@:>") 2242 (operation-description op component)))) 2243 (accept () 2244 :report 2245 (lambda (s) 2246 (format s (compatfmt "~@<Continue, treating ~A as having been successful.~@:>") 2247 (operation-description op component))) 2248 (setf (gethash (type-of op) 2249 (component-operation-times component)) 2250 (get-universal-time)) 2251 (return)))))) 2393 (when (and (not (equal '("asdf") (component-find-path system))) 2394 (find-if #'(lambda (x) (equal '("asdf") 2395 (component-find-path (cdr x)))) 2396 steps) 2397 (upgrade-asdf)) 2398 ;; If we needed to upgrade ASDF to achieve our goal, 2399 ;; then do it specially as the first thing, then 2400 ;; invalidate all existing system 2401 ;; retry the whole thing with the new OPERATE function, 2402 ;; which on some implementations 2403 ;; has a new symbol shadowing the current one. 2404 (return-from operate 2405 (apply (find-symbol* 'operate :asdf) operation-class system args))) 2406 (perform-plan steps) 2252 2407 (values op steps)))) 2253 2408 … … 2255 2410 &allow-other-keys) 2256 2411 (declare (ignore force verbose version)) 2257 (apply #'operate operation-class system args))2412 (apply 'operate operation-class system args)) 2258 2413 2259 2414 (let ((operate-docstring … … 2282 2437 operate-docstring)) 2283 2438 2284 (defun* load-system (system &rest args &key force verbose version 2285 &allow-other-keys) 2286 "Shorthand for `(operate 'asdf:load-op system)`. See OPERATE for 2287 details." 2439 (defun* load-system (system &rest args &key force verbose version &allow-other-keys) 2440 "Shorthand for `(operate 'asdf:load-op system)`. 2441 See OPERATE for details." 2288 2442 (declare (ignore force verbose version)) 2289 (apply #'operate 'load-op system args)2443 (apply 'operate 'load-op system args) 2290 2444 t) 2291 2445 … … 2295 2449 for details." 2296 2450 (declare (ignore force verbose version)) 2297 (apply #'operate 'compile-op system args)2451 (apply 'operate 'compile-op system args) 2298 2452 t) 2299 2453 … … 2303 2457 details." 2304 2458 (declare (ignore force verbose version)) 2305 (apply #'operate 'test-op system args)2459 (apply 'operate 'test-op system args) 2306 2460 t) 2307 2461 … … 2310 2464 2311 2465 (defun* load-pathname () 2312 (let ((pn (or *load-pathname* *compile-file-pathname*))) 2313 (if *resolve-symlinks* 2314 (and pn (resolve-symlinks pn)) 2315 pn))) 2466 (resolve-symlinks* (or *load-pathname* *compile-file-pathname*))) 2316 2467 2317 2468 (defun* determine-system-pathname (pathname pathname-supplied-p) … … 2347 2498 (change-class (cdr s) ',class)) 2348 2499 (t 2349 (register-system (quote ,name) 2350 (make-instance ',class :name ',name)))) 2500 (register-system (make-instance ',class :name ',name)))) 2351 2501 (%set-system-source-file (load-pathname) 2352 2502 (cdr (system-registered-p ',name)))) … … 2364 2514 (find-symbol* type :asdf)) 2365 2515 :for class = (and symbol (find-class symbol nil)) 2366 :when (and class (subtypep class 'component)) 2516 :when (and class 2517 (#-cormanlisp subtypep #+cormanlisp cl::subclassp 2518 class (find-class 'component))) 2367 2519 :return class) 2368 2520 (and (eq type :file) … … 2459 2611 weakly-depends-on 2460 2612 depends-on serial in-order-to 2613 (version nil versionp) 2461 2614 ;; list ends 2462 2615 &allow-other-keys) options … … 2471 2624 (class-for-type parent type)))) 2472 2625 (error 'duplicate-names :name name)) 2626 2627 (when versionp 2628 (unless (parse-version version nil) 2629 (warn (compatfmt "~@<Invalid version ~S for component ~S~@[ of ~S~]~@:>") 2630 version name parent))) 2473 2631 2474 2632 (let* ((other-args (remove-keys … … 2485 2643 (when *serial-depends-on* 2486 2644 (push *serial-depends-on* depends-on)) 2487 (apply #'reinitialize-instance ret2645 (apply 'reinitialize-instance ret 2488 2646 :name (coerce-name name) 2489 2647 :pathname pathname … … 2535 2693 synchronously execute the result using a Bourne-compatible shell, with 2536 2694 output to *VERBOSE-OUT*. Returns the shell's exit code." 2537 (let ((command (apply #'format nil control-string args)))2695 (let ((command (apply 'format nil control-string args))) 2538 2696 (asdf-message "; $ ~A~%" command) 2539 2697 … … 2553 2711 exit-code) 2554 2712 2555 #+clisp ;XXX not exactly *verbose-out*, I know2556 (or (ext:run-shell-command command :output :terminal:wait t) 0)2713 #+clisp ;XXX not exactly *verbose-out*, I know 2714 (or (ext:run-shell-command command :output (and *verbose-out* :terminal) :wait t) 0) 2557 2715 2558 2716 #+clozure … … 2579 2737 #+sbcl 2580 2738 (sb-ext:process-exit-code 2581 (apply #'sb-ext:run-program2739 (apply 'sb-ext:run-program 2582 2740 #+win32 "sh" #-win32 "/bin/sh" 2583 2741 (list "-c" command) … … 2592 2750 :input nil :output *verbose-out*)) 2593 2751 2594 #-(or abcl allegro clisp clozure cmu ecl gcl lispworks sbcl scl) 2752 #+xcl 2753 (ext:run-shell-command command) 2754 2755 #-(or abcl allegro clisp clozure cmu ecl gcl lispworks sbcl scl xcl) 2595 2756 (error "RUN-SHELL-COMMAND not implemented for this Lisp"))) 2596 2757 2597 2758 ;;;; --------------------------------------------------------------------------- 2598 2759 ;;;; system-relative-pathname 2760 2761 (defun* system-definition-pathname (x) 2762 ;; As of 2.014.8, we mean to make this function obsolete, 2763 ;; but that won't happen until all clients have been updated. 2764 ;;(cerror "Use ASDF:SYSTEM-SOURCE-FILE instead" 2765 "Function ASDF:SYSTEM-DEFINITION-PATHNAME is obsolete. 2766 It used to expose ASDF internals with subtle differences with respect to 2767 user expectations, that have been refactored away since. 2768 We recommend you use ASDF:SYSTEM-SOURCE-FILE instead 2769 for a mostly compatible replacement that we're supporting, 2770 or even ASDF:SYSTEM-SOURCE-DIRECTORY or ASDF:SYSTEM-RELATIVE-PATHNAME 2771 if that's whay you mean." ;;) 2772 (system-source-file x)) 2599 2773 2600 2774 (defmethod system-source-file ((system-name string)) … … 2645 2819 (:corman :cormanlisp) 2646 2820 (:lw :lispworks) 2647 :clisp :cmu :ecl :gcl :sbcl :scl :symbolics ))2821 :clisp :cmu :ecl :gcl :sbcl :scl :symbolics :xcl)) 2648 2822 2649 2823 (defparameter *os-features* … … 2659 2833 '((:amd64 :x86-64 :x86_64 :x8664-target) 2660 2834 (:x86 :i386 :i486 :i586 :i686 :pentium3 :pentium4 :pc386 :iapx386 :x8632-target) 2661 :hppa64 2662 :hppa 2663 (:ppc64 :ppc64-target) 2664 (:ppc32 :ppc32-target :ppc :powerpc) 2665 :sparc64 2666 (:sparc32 :sparc) 2835 :hppa64 :hppa 2836 (:ppc64 :ppc64-target) (:ppc32 :ppc32-target :ppc :powerpc) 2837 :sparc64 (:sparc32 :sparc) 2667 2838 (:arm :arm-target) 2668 2839 (:java :java-1.4 :java-1.5 :java-1.6 :java-1.7) 2840 :mipsel :mipseb :mips 2841 :alpha 2669 2842 :imach)) 2670 2843 … … 2729 2902 ((maybe-warn (value fstring &rest args) 2730 2903 (cond (value) 2731 (t (apply #'warn fstring args)2904 (t (apply 'warn fstring args) 2732 2905 "unknown")))) 2733 2906 (let ((lisp (maybe-warn (implementation-type) … … 2846 3019 (unless (length=n-p forms 1) 2847 3020 (error (compatfmt "~@<One and only one form allowed for ~A. Got: ~3i~_~S~@:>~%") 2848 description forms))3021 description forms)) 2849 3022 (funcall validator (car forms) :location file))) 2850 3023 … … 3102 3275 (when inherit 3103 3276 (error (compatfmt "~@<Only one inherited configuration allowed: ~3i~_~S~@:>") 3104 string))3277 string)) 3105 3278 (setf inherit t) 3106 3279 (push :inherit-configuration directives)) … … 3111 3284 (when source 3112 3285 (error (compatfmt "~@<Uneven number of components in source to destination mapping: ~3i~_~S~@:>") 3113 string))3286 string)) 3114 3287 (unless inherit 3115 3288 (push :ignore-inherited-configuration directives)) … … 3143 3316 3144 3317 (defun* user-output-translations-pathname () 3145 (in-user-configuration-directory *output-translations-file* ))3318 (in-user-configuration-directory *output-translations-file*)) 3146 3319 (defun* system-output-translations-pathname () 3147 3320 (in-system-configuration-directory *output-translations-file*)) … … 3272 3445 (defun* apply-output-translations (path) 3273 3446 (etypecase path 3447 #+cormanlisp (t (truenamize path)) 3274 3448 (logical-pathname 3275 3449 path) … … 3490 3664 (defvar *source-registry-exclusions* *default-source-registry-exclusions*) 3491 3665 3492 (defvar *source-registry* () 3493 "Either NIL (for uninitialized), or a list of one element, 3494 said element itself being a list of directory pathnames where to look for .asd files") 3495 3496 (defun* source-registry () 3497 (car *source-registry*)) 3498 3499 (defun* (setf source-registry) (new-value) 3500 (setf *source-registry* (list new-value)) 3501 new-value) 3666 (defvar *source-registry* nil 3667 "Either NIL (for uninitialized), or an equal hash-table, mapping 3668 system names to pathnames of .asd files") 3502 3669 3503 3670 (defun* source-registry-initialized-p () 3504 ( and *source-registry* t))3671 (typep *source-registry* 'hash-table)) 3505 3672 3506 3673 (defun* clear-source-registry () … … 3508 3675 You might want to call that before you dump an image that would be resumed 3509 3676 with a different configuration, so the configuration would be re-read then." 3510 (setf *source-registry* '())3677 (setf *source-registry* nil) 3511 3678 (values)) 3512 3679 3513 3680 (defparameter *wild-asd* 3514 (make-pathname :directory nil :name :wild:type "asd" :version :newest))3515 3516 (defun directory- has-asd-files-p(directory)3681 (make-pathname :directory nil :name *wild* :type "asd" :version :newest)) 3682 3683 (defun directory-asd-files (directory) 3517 3684 (ignore-errors 3518 ( and (directory* (merge-pathnames* *wild-asd* directory)) t)))3685 (directory* (merge-pathnames* *wild-asd* directory)))) 3519 3686 3520 3687 (defun subdirectories (directory) 3521 3688 (let* ((directory (ensure-directory-pathname directory)) 3522 #-(or cormanlisp genera )3689 #-(or cormanlisp genera xcl) 3523 3690 (wild (merge-pathnames* 3524 #-(or abcl allegro lispworks scl)3691 #-(or abcl allegro cmu lispworks scl xcl) 3525 3692 *wild-directory* 3526 #+(or abcl allegro lispworks scl) "*.*"3693 #+(or abcl allegro cmu lispworks scl xcl) "*.*" 3527 3694 directory)) 3528 3695 (dirs 3529 #-(or cormanlisp genera )3696 #-(or cormanlisp genera xcl) 3530 3697 (ignore-errors 3531 3698 (directory* wild . #.(or #+clozure '(:directories t :files nil) 3532 3699 #+mcl '(:directories t)))) 3533 3700 #+cormanlisp (cl::directory-subdirs directory) 3534 #+genera (fs:directory-list directory)) 3535 #+(or abcl allegro genera lispworks scl) 3536 (dirs (remove-if-not #+abcl #'extensions:probe-directory 3537 #+allegro #'excl:probe-directory 3538 #+lispworks #'lw:file-directory-p 3539 #+genera #'(lambda (x) (getf (cdr x) :directory)) 3540 #-(or abcl allegro genera lispworks) #'directory-pathname-p 3541 dirs)) 3542 #+genera 3543 (dirs (mapcar #'(lambda (x) (ensure-directory-pathname (first x))) dirs))) 3701 #+genera (fs:directory-list directory) 3702 #+xcl (system:list-directory directory)) 3703 #+(or abcl allegro cmu genera lispworks scl xcl) 3704 (dirs (loop :for x :in dirs 3705 :for d = #+(or abcl xcl) (extensions:probe-directory x) 3706 #+allegro (excl:probe-directory x) 3707 #+(or cmu scl) (directory-pathname-p x) 3708 #+genera (getf (cdr x) :directory) 3709 #+lispworks (lw:file-directory-p x) 3710 :when d :collect #+(or abcl allegro xcl) d 3711 #+genera (ensure-directory-pathname (first x)) 3712 #+(or cmu lispworks scl) x))) 3544 3713 dirs)) 3714 3715 (defun collect-asds-in-directory (directory collect) 3716 (map () collect (directory-asd-files directory))) 3545 3717 3546 3718 (defun collect-sub*directories (directory collectp recursep collector) … … 3551 3723 (collect-sub*directories subdir collectp recursep collector)))) 3552 3724 3553 (defun collect-sub*directories- with-asd3725 (defun collect-sub*directories-asd-files 3554 3726 (directory &key 3555 3727 (exclude *default-source-registry-exclusions*) … … 3557 3729 (collect-sub*directories 3558 3730 directory 3559 #'directory-has-asd-files-p3731 (constantly t) 3560 3732 #'(lambda (x) (not (member (car (last (pathname-directory x))) exclude :test #'equal))) 3561 collect))3733 #'(lambda (dir) (collect-asds-in-directory dir collect)))) 3562 3734 3563 3735 (defun* validate-source-registry-directive (directive) … … 3608 3780 (when inherit 3609 3781 (error (compatfmt "~@<Only one inherited configuration allowed: ~3i~_~S~@:>") 3610 string))3782 string)) 3611 3783 (setf inherit t) 3612 3784 (push ':inherit-configuration directives)) … … 3625 3797 (defun* register-asd-directory (directory &key recurse exclude collect) 3626 3798 (if (not recurse) 3627 ( funcall collect directory)3628 (collect-sub*directories- with-asd3799 (collect-asds-in-directory directory collect) 3800 (collect-sub*directories-asd-files 3629 3801 directory :exclude exclude :collect collect))) 3630 3802 … … 3758 3930 ;; Will read the configuration and initialize all internal variables, 3759 3931 ;; and return the new configuration. 3760 (defun* compute-source-registry (&optional parameter )3761 ( while-collecting (collect)3762 (d olist (entry (flatten-source-registry parameter))3763 ( destructuring-bind (directory &key recurse exclude) entry3932 (defun* compute-source-registry (&optional parameter (registry *source-registry*)) 3933 (dolist (entry (flatten-source-registry parameter)) 3934 (destructuring-bind (directory &key recurse exclude) entry 3935 (let* ((h (make-hash-table :test 'equal))) 3764 3936 (register-asd-directory 3765 directory 3766 :recurse recurse :exclude exclude :collect #'collect))))) 3937 directory :recurse recurse :exclude exclude :collect 3938 #'(lambda (asd) 3939 (let ((name (pathname-name asd))) 3940 (cond 3941 ((gethash name registry) ; already shadowed by something else 3942 nil) 3943 ((gethash name h) ; conflict at current level 3944 (when *asdf-verbose* 3945 (warn (compatfmt "~@<In source-registry entry ~A~@[/~*~] ~ 3946 found several entries for ~A - picking ~S over ~S~:>") 3947 directory recurse name (gethash name h) asd))) 3948 (t 3949 (setf (gethash name registry) asd) 3950 (setf (gethash name h) asd)))))) 3951 h))) 3952 (values)) 3767 3953 3768 3954 (defvar *source-registry-parameter* nil) 3769 3955 3770 3956 (defun* initialize-source-registry (&optional (parameter *source-registry-parameter*)) 3771 (setf *source-registry-parameter* parameter 3772 (source-registry) (compute-source-registry parameter))) 3957 (setf *source-registry-parameter* parameter) 3958 (setf *source-registry* (make-hash-table :test 'equal)) 3959 (compute-source-registry parameter)) 3773 3960 3774 3961 ;; Checks an initial variable to see whether the state is initialized … … 3781 3968 ;; initialize-source-registry directly with your parameter. 3782 3969 (defun* ensure-source-registry (&optional parameter) 3783 ( if(source-registry-initialized-p)3784 (source-registry)3785 (initialize-source-registry parameter)))3970 (unless (source-registry-initialized-p) 3971 (initialize-source-registry parameter)) 3972 (values)) 3786 3973 3787 3974 (defun* sysdef-source-registry-search (system) 3788 3975 (ensure-source-registry) 3789 (loop :with name = (coerce-name system) 3790 :for defaults :in (source-registry) 3791 :for file = (probe-asd name defaults) 3792 :when file :return file)) 3976 (values (gethash (coerce-name system) *source-registry*))) 3793 3977 3794 3978 (defun* clear-configuration () … … 3796 3980 (clear-output-translations)) 3797 3981 3982 3983 ;;; ECL support for COMPILE-OP / LOAD-OP 3984 ;;; 3985 ;;; In ECL, these operations produce both FASL files and the 3986 ;;; object files that they are built from. Having both of them allows 3987 ;;; us to later on reuse the object files for bundles, libraries, 3988 ;;; standalone executables, etc. 3989 ;;; 3990 ;;; This has to be in asdf.lisp and not asdf-ecl.lisp, or else it becomes 3991 ;;; a problem for asdf on ECL to compile asdf-ecl.lisp after loading asdf.lisp. 3992 ;;; 3993 #+ecl 3994 (progn 3995 (setf *compile-op-compile-file-function* 3996 (lambda (input-file &rest keys &key output-file &allow-other-keys) 3997 (declare (ignore output-file)) 3998 (multiple-value-bind (object-file flags1 flags2) 3999 (apply 'compile-file* input-file :system-p t keys) 4000 (values (and object-file 4001 (c::build-fasl (compile-file-pathname object-file :type :fasl) 4002 :lisp-files (list object-file)) 4003 object-file) 4004 flags1 4005 flags2)))) 4006 4007 (defmethod output-files ((operation compile-op) (c cl-source-file)) 4008 (declare (ignorable operation)) 4009 (let ((p (lispize-pathname (component-pathname c)))) 4010 (list (compile-file-pathname p :type :object) 4011 (compile-file-pathname p :type :fasl)))) 4012 4013 (defmethod perform ((o load-op) (c cl-source-file)) 4014 (map () #'load 4015 (loop :for i :in (input-files o c) 4016 :unless (string= (pathname-type i) "fas") 4017 :collect (compile-file-pathname (lispize-pathname i)))))) 4018 3798 4019 ;;;; ----------------------------------------------------------------- 3799 4020 ;;;; Hook into REQUIRE for ABCL, CLISP, ClozureCL, CMUCL, ECL and SBCL 3800 4021 ;;;; 4022 (defvar *require-asdf-operator* 'load-op) 4023 3801 4024 (defun* module-provide-asdf (name) 3802 4025 (handler-bind … … 3807 4030 name e)))) 3808 4031 (let ((*verbose-out* (make-broadcast-stream)) 3809 (system (find-system (string-downcase name) nil)))4032 (system (find-system (string-downcase name) nil))) 3810 4033 (when system 3811 (load-system system))))) 4034 (operate *require-asdf-operator* system :verbose nil) 4035 t)))) 3812 4036 3813 4037 #+(or abcl clisp clozure cmu ecl sbcl)
Note:
See TracChangeset
for help on using the changeset viewer.
