Commit e3748d63 authored by Robert Goldman's avatar Robert Goldman

Merge branch 'obsolete-function-warnings' into 'master'

Obsolete function warnings

This branch creates basic infrastructure for defining functions with planned obsolescence / deprecation.

@rgoldman I'm not sure whether you consider this branch ready or not, but I'm creating this merge request so we can discuss it.

See merge request !38
parents dad43553 c1652787
......@@ -78,7 +78,7 @@ SCL ?= scl
XCL ?= xcl
header_lisp := header.lisp
driver_lisp := uiop/package.lisp uiop/common-lisp.lisp uiop/utility.lisp uiop/os.lisp uiop/pathname.lisp uiop/filesystem.lisp uiop/stream.lisp uiop/image.lisp uiop/lisp-build.lisp uiop/launch-program.lisp uiop/run-program.lisp uiop/configuration.lisp uiop/backward-driver.lisp uiop/driver.lisp
driver_lisp := uiop/package.lisp uiop/common-lisp.lisp uiop/utility.lisp uiop/version.lisp uiop/os.lisp uiop/pathname.lisp uiop/filesystem.lisp uiop/stream.lisp uiop/image.lisp uiop/lisp-build.lisp uiop/launch-program.lisp uiop/run-program.lisp uiop/configuration.lisp uiop/backward-driver.lisp uiop/driver.lisp
defsystem_lisp := upgrade.lisp cache.lisp component.lisp system.lisp find-system.lisp find-component.lisp operation.lisp action.lisp lisp-action.lisp plan.lisp operate.lisp parse-defsystem.lisp bundle.lisp concatenate-source.lisp output-translations.lisp source-registry.lisp package-inferred-system.lisp backward-interface.lisp backward-internals.lisp interface.lisp user.lisp footer.lisp
all_lisp := $(header_lisp) $(driver_lisp) $(defsystem_lisp)
......
......@@ -453,3 +453,14 @@ It looks like SWANK can be fixed soon, though, so we'll see.
but instead store the name of these directories,
so these files will be read recursively by asdf, allowing for
semi-modular updates.
* Properly deprecate all that needs to go
** Get lisa, readable, bourbaki to NOT include ASDF 1 anymore in their sources.
** Identify all the things in ASDF that we want to deprecate, and make
sure we deprecate them all in 3.2.
** Implement support for deprecating old packages,
by having all functions and macros under the old package name be
proxies to those in the new package name?
(Exception: special variables can't be proxies, have to be imported.)
** Eradicate Quicklisp systems that depend on asdf-driver or
asdf-package-system, make them depend on uiop and asdf3.1 instead.
......@@ -258,6 +258,15 @@ The class needs to be updated for ASDF 3.1 and specify appropriate propagation m
:format-arguments
(list (type-of o)))))
(with-asdf-deprecation (:style-warning "3.2")
(defun backward-compatible-depends-on (o c)
"DEPRECATED: all subclasses of OPERATION used in ASDF should inherit from one of
DOWNWARD-OPERATION UPWARD-OPERATION SIDEWAY-OPERATION SELFWARD-OPERATION NON-PROPAGATING-OPERATION.
The function BACKWARD-COMPATIBLE-DEPENDS-ON temporarily provides ASDF2 behaviour for those that
don't. In the future this functionality will be removed, and the default will be no propagation."
`(,@(sideway-operation-depends-on o c)
,@(when (typep c 'parent-component) (downward-operation-depends-on o c)))))
(defmethod component-depends-on ((o operation) (c component))
`(;; Normal behavior, to allow user-specified in-order-to dependencies
,@(cdr (assoc (type-of o) (component-in-order-to c)))
......@@ -265,8 +274,7 @@ The class needs to be updated for ASDF 3.1 and specify appropriate propagation m
;; or non-propagation through an appropriate mixin will be downward and sideway.
,@(unless (typep o '(or downward-operation upward-operation sideway-operation
selfward-operation non-propagating-operation))
`(,@(sideway-operation-depends-on o c)
,@(when (typep c 'parent-component) (downward-operation-depends-on o c))))))
(backward-compatible-depends-on o c))))
(defmethod downward-operation ((o operation)) nil)
(defmethod sideway-operation ((o operation)) nil))
......
......@@ -19,11 +19,15 @@
#:explain))
(in-package :asdf/backward-interface)
(with-upgradability ()
;; NB: the warning status of these functions may have to be distinguished later,
;; as some get removed faster than the others in client code.
(with-asdf-deprecation (:style-warning "3.2")
;; These conditions from ASDF 1 and 2 are used by many packages in Quicklisp;
;; but ASDF3 replaced them with somewhat different variants of uiop:compile-condition
;; that do not involve ASDF actions.
;; TODO: find the offenders and stop them.
(progn
(define-condition operation-error (error) ;; Bad, backward-compatible name
;; Used by SBCL, cffi-tests, clsql-mysql, clsql-uffi, qt, elephant, uffi-tests, sb-grovel
((component :reader error-component :initarg :component)
......@@ -33,15 +37,19 @@
(type-of c) (error-operation c) (error-component c)))))
(define-condition compile-error (operation-error) ())
(define-condition compile-failed (compile-error) ())
(define-condition compile-warned (compile-error) ())
(define-condition compile-warned (compile-error) ()))
(defun component-load-dependencies (component)
"DEPRECATED. Please use COMPONENT-SIDEWAY-DEPENDENCIES instead."
;; In Quicklisp 2015-05, still used by lisp-executable, staple, repl-utilities, cffi
(defun component-load-dependencies (component) ;; from ASDF 2.000 to 2.26
"DEPRECATED. Please use COMPONENT-SIDEWAY-DEPENDENCIES instead; or better,
define your operations with proper use of SIDEWAY-OPERATION, SELFWARD-OPERATION,
or define methods on PREPARE-OP, etc."
;; Old deprecated name for the same thing. Please update your software.
(component-sideway-dependencies component))
;; These old interfaces from ASDF1 have never been very meaningful
;; but are still used in obscure places.
;; In Quicklisp 2015-05, still used by cl-protobufs and clx.
(defgeneric operation-on-warnings (operation)
(:documentation "DEPRECATED. Please use UIOP:*COMPILE-FILE-WARNINGS-BEHAVIOUR* instead."))
(defgeneric operation-on-failure (operation)
......@@ -50,6 +58,7 @@
(:documentation "DEPRECATED. Please SETF UIOP:*COMPILE-FILE-WARNINGS-BEHAVIOUR* instead."))
(defgeneric (setf operation-on-failure) (x operation)
(:documentation "DEPRECATED. Please SETF UIOP:*COMPILE-FILE-FAILURE-BEHAVIOUR* instead."))
(progn
(defmethod operation-on-warnings ((o operation))
*compile-file-warnings-behaviour*)
(defmethod operation-on-failure ((o operation))
......@@ -57,12 +66,15 @@
(defmethod (setf operation-on-warnings) (x (o operation))
(setf *compile-file-warnings-behaviour* x))
(defmethod (setf operation-on-failure) (x (o operation))
(setf *compile-file-failure-behaviour* x))
(setf *compile-file-failure-behaviour* x)))
;; Quicklisp 2015-05: Still used by SLIME's swank-asdf (!), common-lisp-stat,
;; js-parser, osicat, babel, staple, weblocks, cl-png, plain-odbc, autoproject,
;; cl-blapack, com.informatimago, cells-gtk3, asdf-dependency-grovel,
;; cl-glfw, cffi, jwacs, montezuma
(defun system-definition-pathname (x)
;; As of 2.014.8, we mean to make this function obsolete,
;; but that won't happen until all clients have been updated.
;;(cerror "Use ASDF:SYSTEM-SOURCE-FILE instead"
"DEPRECATED. This function used to expose ASDF internals with subtle
differences with respect to user expectations, that have been refactored
away since. We recommend you use ASDF:SYSTEM-SOURCE-FILE instead for a
......@@ -71,31 +83,33 @@ ASDF:SYSTEM-SOURCE-DIRECTORY or ASDF:SYSTEM-RELATIVE-PATHNAME
if that's whay you mean." ;;)
(system-source-file x))
;; TRAVERSE is the function used to compute a plan in ASDF 1 and 2.
;; It was never officially exposed but some people still used it.
(defgeneric traverse (operation component &key &allow-other-keys)
(:documentation
"Generate and return a plan for performing OPERATION on COMPONENT.
"DEPRECATED. Use MAKE-PLAN and PLAN-ACTIONS, or REQUIRED-COMPONENTS,
or some other supported interface instead.
Generate and return a plan for performing OPERATION on COMPONENT.
The plan returned is a list of dotted-pairs. Each pair is the CONS
of ASDF operation object and a COMPONENT object. The pairs will be
processed in order by OPERATE."))
(define-convenience-action-methods traverse (operation component &key))
(progn
(define-convenience-action-methods traverse (operation component &key)))
(defmethod traverse ((o operation) (c component) &rest keys &key plan-class &allow-other-keys)
(plan-actions (apply 'make-plan plan-class o c keys))))
(plan-actions (apply 'make-plan plan-class o c keys)))
;;;; ASDF-Binary-Locations compatibility
;; This remains supported for legacy user, but not recommended for new users.
;; We suspect there are no more legacy users in 2016.
(with-upgradability ()
;; ASDF-Binary-Locations compatibility
;; This remains supported for legacy user, but not recommended for new users.
;; We suspect there are no more legacy users in 2016.
(defun enable-asdf-binary-locations-compatibility
(&key
(centralize-lisp-binaries nil)
(default-toplevel-directory
(subpathname (user-homedir-pathname) ".fasls/")) ;; Use ".cache/common-lisp/" instead ???
;; Use ".cache/common-lisp/" instead ???
(subpathname (user-homedir-pathname) ".fasls/"))
(include-per-user-information nil)
(map-all-source-files (or #+(or clasp clisp ecl mkcl) t nil))
(source-to-target-mappings nil)
......@@ -106,6 +120,7 @@ processed in order by OPERATE."))
#+mkcl (compile-file-type :fasl-p nil)
#+clisp "lib" #+sbcl "cfasl"
#+sbcl "sbcl-warnings" #+clozure "ccl-warnings")))
"DEPRECATED. Use asdf-output-translations instead."
#+(or clasp clisp ecl mkcl)
(when (null map-all-source-files)
(error "asdf:enable-asdf-binary-locations-compatibility doesn't support :map-all-source-files nil on CLISP, ECL and MKCL"))
......@@ -129,7 +144,7 @@ processed in order by OPERATE."))
(,@destination-directory ,pattern)))
(t t)
:ignore-inherited-configuration))))
(progn
(defmethod operate :before (operation-class system &rest args &key &allow-other-keys)
(declare (ignore operation-class system args))
(when (find-symbol* '#:output-files-for-system-and-operation :asdf nil)
......@@ -143,17 +158,9 @@ ASDF:ENABLE-ASDF-BINARY-LOCATIONS-COMPATIBILITY as documented in the manual;
call that function where you would otherwise have loaded and configured A-B-L."))))
;;; run-shell-command
;; WARNING! The function below is not just deprecated but also dysfunctional.
;; Please use asdf/run-program:run-program instead.
(with-upgradability ()
;; run-shell-command from ASDF 2, lightly fixed from ASDF 1, copied from MK-DEFSYSTEM. Die!
(defun run-shell-command (control-string &rest args)
"Interpolate ARGS into CONTROL-STRING as if by FORMAT, and
synchronously execute the result using a Bourne-compatible shell, with
output to *VERBOSE-OUT*. Returns the shell's exit code.
PLEASE DO NOT USE.
Deprecated function, for backward-compatibility only.
"PLEASE DO NOT USE. This function is not just DEPRECATED, but also dysfunctional.
Please use UIOP:RUN-PROGRAM instead."
#-(and ecl os-windows)
(let ((command (apply 'format nil control-string args)))
......@@ -166,16 +173,17 @@ Please use UIOP:RUN-PROGRAM instead."
((integer 0 255) exit-code)
(t 255))))
#+(and ecl os-windows)
(not-implemented-error "run-shell-command" "for ECL on Windows.")
))
(not-implemented-error "run-shell-command" "for ECL on Windows."))
(with-upgradability ()
;; HOW do we get rid of variables??? With a symbol-macro that issues a warning?
;; In Quicklisp 2015-05, cl-protobufs still uses it, but that should be fixed in next version.
(progn
(defvar *asdf-verbose* nil)) ;; backward-compatibility with ASDF2 only. Unused.
;;; backward-compatibility methods. Do NOT use in new code. NOT SUPPORTED.
(with-upgradability ()
;; Do NOT use in new code. NOT SUPPORTED.
;; NB: When this goes away, remove the slot PROPERTY in COMPONENT.
;; In Quicklisp 2014-05, it's still used by yaclml, amazon-ecs, blackthorn-engine, cl-tidy.
;; See TODO for further cleanups required before to get rid of it.
(defgeneric component-property (component property))
(defgeneric (setf component-property) (new-value component property))
......@@ -188,16 +196,15 @@ Please use UIOP:RUN-PROGRAM instead."
(setf (cdr a) new-value)
(setf (slot-value c 'properties)
(acons property new-value (slot-value c 'properties)))))
new-value))
new-value)
;;; This method survives from ASDF 1, but really it is superseded by action-description.
(with-upgradability ()
;; This method survives from ASDF 1, but really it is superseded by action-description.
(defgeneric explain (operation component)
(:documentation "Display a message describing an action.
DEPRECATED. Use ASDF:ACTION-DESCRIPTION and/or ASDF::FORMAT-ACTION instead."))
(defmethod explain ((o operation) (c component))
(asdf-message (compatfmt "~&~@<; ~@;~A~:>~%") (action-description o c)))
(progn
(define-convenience-action-methods explain (operation component)))
(defmethod explain ((o operation) (c component))
(asdf-message (compatfmt "~&~@<; ~@;~A~:>~%") (action-description o c))))
......@@ -7,7 +7,7 @@
(:export #:load-sysdef))
(in-package :asdf/backward-internals)
(with-upgradability ()
(with-asdf-deprecation (:style-warning "3.2")
(defun load-sysdef (name pathname)
(declare (ignore name pathname))
;; Needed for backward compatibility with swank-asdf from SLIME 2015-12-01 or older.
......
......@@ -23,7 +23,7 @@ our $file = $asdf_dir . "version.lisp-expr";
our @transform_ref =
(
[ "version.lisp-expr", "\"", "\"" ],
[ "uiop/version.lisp-expr", "\"", "\"" ],
[ "uiop/version.lisp", "(defparameter *uiop-version* \"", "\")" ],
[ "asdf.asd", " :version \"", "\" ;; to be automatically updated by make bump-version" ],
[ "header.lisp", "This is ASDF ", ": Another System Definition Facility." ],
[ "upgrade.lisp", "\\(asdf-version \"", "\"\\)" ],
......@@ -70,7 +70,7 @@ sub transform_files {
my $regex = "(" . $entry[1] . ")" . "(([0-9]+\.)+[0-9]+)" . "(" . $entry[2] .")";
my $filename = $asdf_dir . $file;
my $data = read_text($filename);
my $count = ($data =~ s/$regex/$1$new$4/);
my $count = ($data =~ s/$regex/$1$new$4/g);
if ($count == 0) {
die "Unable to replace $regex with $1$new$4";
}
......
......@@ -291,7 +291,7 @@ or of opaque libraries shipped along the source code."))
;;; a FASL, a statically linked library, a shared library, etc.
;;; The different targets are defined by specialization.
;;;
(when-upgrading (:version "3.1.9")
(when-upgrading (:version "3.2.0")
;; Cancel any previously defined method
(defmethod initialize-instance :after ((instance bundle-op) &rest initargs &key &allow-other-keys)
(declare (ignore initargs))))
......
......@@ -16,9 +16,9 @@
;;;; Register ASDF itself and all its subsystems as preloaded.
(with-upgradability ()
(dolist (s '("asdf" "uiop" "asdf-defsystem" "asdf-package-system"))
(dolist (s '("asdf" "uiop" "asdf-package-system"))
;; Don't bother with these system names, no one relies on them anymore:
;; "asdf-utils" "asdf-bundle" "asdf-driver"
;; "asdf-utils" "asdf-bundle" "asdf-driver" "asdf-defsystem"
(register-preloaded-system s :version *asdf-version*)))
......
......@@ -4,7 +4,7 @@
set here=%~dp0
set header_lisp=header.lisp
set driver_lisp=uiop\package.lisp + uiop\common-lisp.lisp + uiop\utility.lisp + uiop\os.lisp + uiop\pathname.lisp + uiop\filesystem.lisp + uiop\stream.lisp + uiop\image.lisp + uiop\lisp-build.lisp + uiop\launch-program.lisp + uiop\run-program.lisp + uiop\configuration.lisp + uiop\backward-driver.lisp + uiop\driver.lisp
set driver_lisp=uiop\package.lisp + uiop\common-lisp.lisp + uiop\utility.lisp + uiop\version.lisp + uiop\os.lisp + uiop\pathname.lisp + uiop\filesystem.lisp + uiop\stream.lisp + uiop\image.lisp + uiop\lisp-build.lisp + uiop\launch-program.lisp + uiop\run-program.lisp + uiop\configuration.lisp + uiop\backward-driver.lisp + uiop\driver.lisp
set defsystem_lisp=upgrade.lisp + cache.lisp + component.lisp + system.lisp + find-system.lisp + find-component.lisp + operation.lisp + action.lisp + lisp-action.lisp + plan.lisp + operate.lisp + parse-defsystem.lisp + bundle.lisp + concatenate-source.lisp + output-translations.lisp + source-registry.lisp + package-inferred-system.lisp + backward-interface.lisp + backward-internals.lisp + interface.lisp + user.lisp + footer.lisp
%~d0
......
......@@ -5,7 +5,7 @@
here="$(dirname $0)"
header_lisp="header.lisp"
driver_lisp="uiop/package.lisp uiop/common-lisp.lisp uiop/utility.lisp uiop/os.lisp uiop/pathname.lisp uiop/filesystem.lisp uiop/stream.lisp uiop/image.lisp uiop/lisp-build.lisp uiop/launch-program.lisp uiop/run-program.lisp uiop/configuration.lisp uiop/backward-driver.lisp uiop/driver.lisp"
driver_lisp="uiop/package.lisp uiop/common-lisp.lisp uiop/utility.lisp uiop/version.lisp uiop/os.lisp uiop/pathname.lisp uiop/filesystem.lisp uiop/stream.lisp uiop/image.lisp uiop/lisp-build.lisp uiop/launch-program.lisp uiop/run-program.lisp uiop/configuration.lisp uiop/backward-driver.lisp uiop/driver.lisp"
defsystem_lisp="upgrade.lisp cache.lisp component.lisp system.lisp find-system.lisp find-component.lisp operation.lisp action.lisp lisp-action.lisp plan.lisp operate.lisp parse-defsystem.lisp bundle.lisp concatenate-source.lisp output-translations.lisp source-registry.lisp package-inferred-system.lisp backward-interface.lisp backward-internals.lisp interface.lisp user.lisp footer.lisp"
all () {
......
......@@ -15,7 +15,7 @@ Some constraints:
(:export
#:asym #:acall #:asymval
#:*test-directory* #:*asdf-directory* #:*build-directory* #:*implementation*
#:deftest #:is #:signals #:errors #:with-expected-failure
#:deftest #:is #:signals #:does-not-signal #:errors #:with-expected-failure
#:assert-compare #:assert-equal #:assert-pathname-equal #:assert-pathnames-equal
#:hash-table->alist
#:load-asdf #:maybe-compile-asdf
......@@ -127,17 +127,27 @@ Some constraints:
(,condition (,x)
(format *error-output* "~&Received signal ~S~%" ,x)
(finish-output *error-output*)
t)
,x)
(:no-error (&rest ,x)
(error "Expression ~S fails to raise condition ~S, instead returning~{ ~S~}"
',sexp ',condition ,x))
(t (,x)
(error "Expression ~S raises signal ~S, not ~S" ',sexp ,x ',condition)))))
(defmacro errors (condition sexp)
',sexp ',condition ,x)))))
(defmacro does-not-signal (condition sexp &aux (x (gensym)))
`(progn
(format *error-output* "~&Checking that ~S does NOT signal ~S~%" ',sexp ',condition)
(finish-output *error-output*)
(handler-case
,sexp
(,condition (,x)
(error "~&Condition signaled: ~S~%" ,x))
(:no-error (&rest ,x)
t))))
(defmacro errors (condition sexp &aux (x (gensym)))
`(progn
(format *error-output* "~&Checking whether ~S signals error ~S~%" ',sexp ',condition)
(finish-output *error-output*)
(assert-equal ',condition (type-of (nth-value 1 (ignore-errors ,sexp))))))
(let ((,x (nth-value 1 (ignore-errors ,sexp))))
(assert-equal ',condition (type-of ,x))
,x)))
(defmacro with-expected-failure ((&optional condition) &body body)
`(call-with-expected-failure ,condition (lambda () ,@body)))
(defun call-with-expected-failure (condition thunk)
......
;;-*- Lisp -*-
(setf asdf::*asdf-version* "6.7.8")
(DBG "Check still-valid code")
(asdf::with-asdf-deprecation (:style-warning "7.0")
(defun still-valid () t))
(does-not-signal deprecated-function-condition (eval '(still-valid)))
(does-not-signal deprecated-function-condition (compile () '(lambda () (still-valid))))
(defmacro check-deprecation (condition name body)
`(let ((c (signals ,condition (eval ',body))))
(assert-equal (deprecated-function-name c) ',name)))
(defmacro check-deprecation-warning (condition name body)
`(progn
(check-deprecation ,condition ,name ,body)
(nest #+(or abcl (and ecl ecl-bytecmp) mkcl) (does-not-signal condition)
#+ccl (signals ccl::compiler-warning)
#-(or abcl ccl (and ecl ecl-bytecmp) mkcl)
(check-deprecation ,condition ,name)
(compile () '(lambda () ,body)))))
(defmacro check-deprecation-error (condition name body)
`(progn
(check-deprecation ,condition ,name ,body)
(nest #+allegro (signals style-warning)
#+(or cmucl (and ecl (not ecl-bytecmp))) (signals c::compiler-error)
#+(or (and ecl ecl-bytecmp) mkcl) (does-not-signal condition)
#+sbcl (signals simple-warning)
#-(or allegro cmucl ecl mkcl sbcl)
(check-deprecation ,condition ,name)
(compile () '(lambda () ,body)))))
(defmacro check-deprecation-delete (condition name body)
`(progn
(check-deprecation ,condition ,name ,body)
(nest #+(or cmucl (and ecl (not ecl-bytecmp))) (signals c::compiler-error)
#+mkcl (errors compiler:compiler-error)
#+sbcl (signals sb-c:compiler-error)
#-(or cmucl (and ecl (not ecl-bytecmp)) mkcl sbcl)
(check-deprecation ,condition ,name)
(compile () '(lambda () ,body)))))
(DBG "Check style-warning")
(asdf::with-asdf-deprecation (:style-warning "6")
(defun should-style-warn () t))
(check-deprecation-warning deprecated-function-style-warning should-style-warn (should-style-warn))
(DBG "Check warning")
(asdf::with-asdf-deprecation (:style-warning "5") ;; next-version 6 is warning...
(defun should-warn () t))
(check-deprecation-warning deprecated-function-warning should-warn (should-warn))
(DBG "Check warning")
(asdf::with-asdf-deprecation (:style-warning "6.5") ;; next- next-version 6.7 is error!
(defun should-error () t))
(check-deprecation-error deprecated-function-error should-error (should-error))
(DBG "Check delete")
(check-deprecation-delete
deprecated-function-should-be-deleted (past-due-f past-due-m)
(asdf::with-asdf-deprecation (:style-warning "6.7.1")
;; next- next- next-version 6.7.4 is delete!
(defun past-due-f () t)
(progn (foo))
(defgeneric past-due-gf ())
(defmethod past-due-m ())))
......@@ -41,7 +41,7 @@
(defparameter *versioned-files*
'(("version.lisp-expr" "\"" "\"")
("uiop/version.lisp-expr" "\"" "\"")
("uiop/version.lisp" "(defparameter *uiop-version* \"" "\")")
("asdf.asd" " :version \"" "\" ;; to be automatically updated by make bump-version")
("header.lisp" "This is ASDF " ": Another System Definition Facility.")
("upgrade.lisp" " (asdf-version \"" "\")")
......
;;;; -------------------------------------------------------------------------
;;; Hacks for backward-compatibility of the driver
;;; -------------------------------------------------------------------------
;;; Hacks for backward-compatibility with older versions of UIOP
(uiop/package:define-package :uiop/backward-driver
(:use :uiop/common-lisp :uiop/package :uiop/utility
(:recycle :uiop/backward-driver :asdf/backward-driver :uiop)
(:use :uiop/common-lisp :uiop/package :uiop/utility :uiop/version
:uiop/pathname :uiop/stream :uiop/os :uiop/image
:uiop/run-program :uiop/lisp-build :uiop/configuration)
(:export
#:coerce-pathname
#:user-configuration-directories #:system-configuration-directories
#:in-first-directory #:in-user-configuration-directory #:in-system-configuration-directory
))
#:version-compatible-p))
(in-package :uiop/backward-driver)
;;;; Backward compatibility with various pathname functions.
(eval-when (:compile-toplevel :load-toplevel :execute)
(with-deprecation ((version-deprecation *uiop-version* :style-warning "3.2.0" :warning "3.2.1"))
;; Backward compatibility with ASDF 2.000 to 2.26
(with-upgradability ()
(defun coerce-pathname (name &key type defaults)
;; For backward-compatibility only, for people using internals
;; Reported users in quicklisp 2015-11: hu.dwim.asdf (removed in next release)
;; Will be removed after 2015-12.
;;(warn "Please don't use ASDF::COERCE-PATHNAME. Use ASDF/PATHNAME:PARSE-UNIX-NAMESTRING.")
(defun coerce-pathname (name &key type defaults)
"DEPRECATED. Please use UIOP:PARSE-UNIX-NAMESTRING instead."
(parse-unix-namestring name :type type :defaults defaults))
;; Backward compatibility for ASDF 2.27 to 3.1.4
(defun user-configuration-directories ()
"Return the current user's list of user configuration directories
for configuring common-lisp.
DEPRECATED. Use uiop:xdg-config-pathnames instead."
DEPRECATED. Use UIOP:XDG-CONFIG-PATHNAMES instead."
(xdg-config-pathnames "common-lisp"))
(defun system-configuration-directories ()
"Return the list of system configuration directories for common-lisp.
DEPRECATED. Use uiop:config-system-pathnames instead."
DEPRECATED. Use UIOP:CONFIG-SYSTEM-PATHNAMES instead."
(system-config-pathnames "common-lisp"))
(defun in-first-directory (dirs x &key (direction :input))
"Finds the first appropriate file named X in the list of DIRS for I/O
in DIRECTION \(which may be :INPUT, :OUTPUT, :IO, or :PROBE).
If direction is :INPUT or :PROBE, will return the first extant file named
If direction is :INPUT or :PROBE, will return the first extant file named
X in one of the DIRS.
If direction is :OUTPUT or :IO, will simply return the file named X in the
If direction is :OUTPUT or :IO, will simply return the file named X in the
first element of DIRS that exists. DEPRECATED."
(find-preferred-file
(mapcar #'(lambda (dir) (subpathname (ensure-directory-pathname dir) x)) dirs)
......@@ -49,4 +51,18 @@ DEPRECATED."
(defun in-system-configuration-directory (x &key (direction :input))
"Return the pathname for the file named X under the system configuration directory
for common-lisp. DEPRECATED."
(find-preferred-file (system-config-pathnames "common-lisp" x) :direction direction)))
(find-preferred-file (system-config-pathnames "common-lisp" x) :direction direction))
;; Backward compatibility with ASDF 1 to ASDF 2.32
(defun version-compatible-p (provided-version required-version)
"Is the provided version a compatible substitution for the required-version?
If major versions differ, it's not compatible.
If they are equal, then any later version is compatible,
with later being determined by a lexicographical comparison of minor numbers.
DEPRECATED."
(let ((x (parse-version provided-version nil))
(y (parse-version required-version nil)))
(and x y (= (car x) (car y)) (lexicographic<= '< (cdr y) (cdr x)))))))
......@@ -10,7 +10,7 @@
;; that could cause potential conflicts for packages that would :use (cl uiop)
;; or :use (closer-common-lisp uiop), etc.
(:use-reexport
:uiop/package :uiop/utility
:uiop/package :uiop/utility :uiop/version
:uiop/os :uiop/pathname :uiop/filesystem :uiop/stream :uiop/image
:uiop/launch-program :uiop/run-program
:uiop/lisp-build :uiop/configuration :uiop/backward-driver))
......
......@@ -3,7 +3,7 @@
(uiop/package:define-package :uiop/run-program
(:nicknames :asdf/run-program) ; OBSOLETE. Used by cl-sane, printv.
(:use :uiop/common-lisp :uiop/package :uiop/utility
(:use :uiop/common-lisp :uiop/package :uiop/utility :uiop/version
:uiop/pathname :uiop/os :uiop/filesystem :uiop/stream :uiop/launch-program)
(:export
#:run-program
......
......@@ -27,16 +27,16 @@ It is transcluded into asdf.lisp together with ASDF/DEFSYSTEM, so if you did (re
you already have a matching UIOP loaded."
:author "Francois-Rene Rideau"
:licence "MIT"
:class #.(if (find-class 'package-system nil) 'package-system 'system)
#+asdf3 :version #+asdf3 (:read-file-form "version.lisp-expr")
#+asdf-unicode :encoding #+asdf-unicode :utf-8
:class #+asdf3.1 package-system #-asdf3.1 system
#+asdf3.1 :version #+asdf3.1 (:read-file-form "version.lisp" :at (2 2 2))
#+asdf3 :encoding #+asdf3 :utf-8
#+asdf3 :around-compile #+asdf3 call-without-redefinition-warnings
:components
((:static-file "version.lisp-expr")
(:static-file "contrib/debug.lisp")
((:static-file "contrib/debug.lisp")
(:file "package")
(:file "common-lisp" :depends-on ("package"))
(:file "utility" :depends-on ("common-lisp"))
(:file "version" :depends-on ("utility"))
(:file "os" :depends-on ("utility"))
(:file "pathname" :depends-on ("utility" "os"))
(:file "filesystem" :depends-on ("os" "pathname"))
......@@ -46,5 +46,5 @@ you already have a matching UIOP loaded."
(:file "launch-program" :depends-on ("stream"))
(:file "run-program" :depends-on ("launch-program"))
(:file "configuration" :depends-on ("image"))
(:file "backward-driver" :depends-on ("lisp-build" "run-program" "configuration"))
(:file "backward-driver" :depends-on ("lisp-build" "run-program" "configuration" "version"))
(:file "driver" :depends-on ("backward-driver"))))
......@@ -14,6 +14,7 @@
#:with-upgradability ;; (un)defining functions in an upgrade-friendly way
#:defun* #:defgeneric*
#:nest #:if-let ;; basic flow control
#:parse-body ;; macro definition helper
#:while-collecting #:appendf #:length=n-p #:ensure-list ;; lists
#:remove-plist-keys #:remove-plist-key ;; plists
#:emptyp ;; sequences
......@@ -22,7 +23,7 @@
#:base-string-p #:strings-common-element-type #:reduce/strcat #:strcat ;; strings
#:first-char #:last-char #:split-string #:stripln #:+cr+ #:+lf+ #:+crlf+
#:string-prefix-p #:string-enclosed-p #:string-suffix-p
#:standard-case-symbol-name #:find-standard-case-symbol
#:standard-case-symbol-name #:find-standard-case-symbol ;; symbols
#:coerce-class ;; CLOS
#:stamp< #:stamps< #:stamp*< #:stamp<= ;; stamps
#:earlier-stamp #:stamps-earliest #:earliest-stamp
......@@ -31,7 +32,7 @@
#:ensure-function #:access-at #:access-at-count ;; functions
#:call-function #:call-functions #:register-hook-function
#:lexicographic< #:lexicographic<= ;; version
#:parse-version #:unparse-version #:version< #:version<= #:version-compatible-p
#:simple-style-warning #:style-warn ;; simple style warnings
#:match-condition-p #:match-any-condition-p ;; conditions
#:call-with-muffled-conditions #:with-muffled-conditions
#:not-implemented-error #:parameter-error))
......@@ -117,6 +118,30 @@ to supersede any previous definition."
,then-form
,else-form)))))
;;; Macro definition helper
(with-upgradability ()
(defun parse-body (body &key documentation whole) ;; from alexandria
"Parses BODY into (values remaining-forms declarations doc-string).
Documentation strings are recognized only if DOCUMENTATION is true.
Syntax errors in body are signalled and WHOLE is used in the signal
arguments when given."
(let ((doc nil)
(decls nil)
(current nil))
(tagbody
:declarations
(setf current (car body))
(when (and documentation (stringp current) (cdr body))
(if doc
(error "Too many documentation strings in ~S." (or whole body))
(setf doc (pop body)))
(go :declarations))
(when (and (listp current) (eql (first current) 'declare))
(push (pop body) decls)
(go :declarations)))
(values body (nreverse decls) doc))))
;;; List manipulation
(with-upgradability ()
(defmacro while-collecting ((&rest collectors) &body body)
......@@ -153,7 +178,7 @@ Returns two values: \(A B C\) and \(1 2 3\)."
(if (listp x) x (list x))))
;;; remove a key from a plist, i.e. for keyword argument cleanup
;;; Remove a key from a plist, i.e. for keyword argument cleanup
(with-upgradability ()
(defun remove-plist-key (key plist)
"Remove a single key from a plist"
......@@ -503,39 +528,8 @@ up to the given equality TEST"
(dolist (x list h) (setf (gethash x h) t))))
;;; Version handling
;;; Lexicographic comparison of lists of numbers
(with-upgradability ()
(defun unparse-version (version-list)
"From a parsed version (a list of natural numbers), compute the version string"
(format nil "~{~D~^.~}" version-list))
(defun parse-version (version-string &optional on-error)
"Parse a VERSION-STRING as a series of natural numbers separated by dots.
Return a (non-null) list of integers if the string is valid;
otherwise return NIL.
When invalid, ON-ERROR is called as per CALL-FUNCTION before to return NIL,
with format arguments explaining why the version is invalid.
ON-ERROR is also called if the version is not canonical