Commit 95b40994 authored by Peter Van Eynde's avatar Peter Van Eynde
Browse files

Merge branch 'upstream'

parents 7938258f dc3e41aa
......@@ -7,6 +7,11 @@ website/changelog.xml
# Test stuff
test/results/
test/tmp/
test/conf.d/
test/dir1/
test/dir2/
# We build these at various stages in the make process
LICENSE
......@@ -22,3 +27,4 @@ lift-local.config
*.lib
*.o
*.*fsl
*.bak
......@@ -174,7 +174,7 @@
;;;;
(defparameter *asdf-version*
;; the 1+ hair is to ensure that we don't do an inadvertent find and replace
(subseq "VERSION:1.501" (1+ (length "VERSION"))))
(subseq "VERSION:1.502" (1+ (length "VERSION"))))
(defun asdf-version ()
*asdf-version*)
......@@ -816,7 +816,7 @@ to `~a` which is not a directory.~@:>"
;; ON-DISK), but CMUCL barfs on that.
on-disk
*package*)
(load asd))
(load on-disk))
(error 'missing-definition :name name :pathname on-disk)))
(delete-package package))))
(let ((in-memory (system-registered-p name)))
......@@ -1110,7 +1110,7 @@ to `~a` which is not a directory.~@:>"
(error nil))
(dolist (kid (module-components c))
(handler-case
(appendf forced (traverse operation kid ))
(appendf forced (traverse operation kid))
(missing-dependency (condition)
(if (eq (module-if-component-dep-fails c)
:fail)
......@@ -1736,9 +1736,8 @@ output to `*verbose-out*`. Returns the shell's exit code."
;;; ---------------------------------------------------------------------------
;;; Portions of this code were once from SWANK / SLIME
(defparameter *centralize-lisp-binaries*
nil "
If true, compiled lisp files without an explicit mapping (see
(defparameter *centralize-lisp-binaries* nil
"If true, compiled lisp files without an explicit mapping (see
\\*source-to-target-mappings\\*) will be placed in subdirectories of
\\*default-toplevel-directory\\*. If false, then compiled lisp files
without an explicitly mapping will be placed in subdirectories of
......@@ -1753,7 +1752,7 @@ See [implementation-specific-directory-name][] for details.")
(defparameter *default-toplevel-directory*
(merge-pathnames
(make-pathname :directory '(:relative ".fasls"))
(make-pathname :directory '(:relative ".cache" "common-lisp"))
(truename (user-homedir-pathname)))
"If \\*centralize-lisp-binaries\\* is true, then compiled lisp files without an explicit mapping \(see \\*source-to-target-mappings\\*\) will be placed in subdirectories of \\*default-toplevel-directory\\*.")
......@@ -1955,7 +1954,7 @@ applied by the plain `*source-to-target-mappings*`."
(typecase component
(cl-source-file t)
(t nil)))
(let ((source (component-pathname component ))
(let ((source (component-pathname component))
(paths (call-next-method)))
(output-files-for-system-and-operation
(component-system component) operation component source paths))
......@@ -2197,7 +2196,9 @@ with a different configuration, so the configuration would be re-read then."
(defparameter *default-source-registries*
'(process-environment-source-registry
process-user-source-registry
process-user-source-registry-directory
process-system-source-registry
process-system-source-registry-directory
process-default-source-registry))
(defun user-configuration-pathname ()
......@@ -2223,9 +2224,15 @@ with a different configuration, so the configuration would be re-read then."
(defun process-user-source-registry (&key inherit collect)
(process-source-registry (user-source-registry-pathname)
:inherit inherit :collect collect))
(defun process-user-source-registry-directory (&key inherit collect)
(process-source-registry (user-source-registry-directory-pathname)
:inherit inherit :collect collect))
(defun process-system-source-registry (&key inherit collect)
(process-source-registry (system-source-registry-pathname)
:inherit inherit :collect collect))
(defun process-system-source-registry-directory (&key inherit collect)
(process-source-registry (system-source-registry-directory-pathname)
:inherit inherit :collect collect))
(defun process-default-source-registry (&key inherit collect)
(declare (ignore inherit collect))
nil)
......
......@@ -5,7 +5,7 @@
# - quit with exit status 0 on getting eof
# - quit with exit status >0 if an unhandled error occurs
export CL_SOURCE_REGISTRY=$PWD
export CL_SOURCE_REGISTRY="$PWD"
if [ x"$1" = "xhelp" ]; then
echo "$0 [lisp invocation] [scripts-regex]"
......@@ -71,47 +71,67 @@ if [ -z $1 ] ; then
lisp="sbcl"
fi
if [ "$lisp" = "sbcl" ] ; then
case "$lisp" in
sbcl)
if type sbcl ; then
fasl_ext="fasl"
command="sbcl --userinit /dev/null --sysinit /dev/null --noinform --noprogrammer"
fi
elif [ "$lisp" = "clisp" ] ; then
fi ;;
clisp)
if type clisp ; then
fasl_ext="fas"
command=`which clisp`
command="$command -norc -ansi -I - "
fi
elif [ "$lisp" = "allegro" ] ; then
fi ;;
allegro)
if type alisp ; then
fasl_ext="fasl"
command="alisp -q -batch "
fi
elif [ "$lisp" = "allegromodern" ] ; then
fi ;;
allegromodern)
if type mlisp ; then
fasl_ext="fasl"
command="mlisp -q -batch "
fi
elif [ "$lisp" = "ccl" ] ; then
fi ;;
ccl)
if type ccl ; then
fasl_ext="dx32fsl"
case `uname -s` in
Linux) fasl_os=lx ;;
Darwin) fasl_os=dx ;;
esac
case `uname -m` in
x86_64|ppc64) fasl_bits=64 ;;
i?86|ppc) fasl_bits=32 ;;
esac
fasl_ext="${fasl_os}${fasl_bits}fsl"
command="ccl --no-init --quiet --batch "
fi
fi
fi ;;
cmucl)
if type lisp ; then
fasl_ext="x86f"
command="lisp -batch -noinit"
fi ;;
esac
create_asds () {
mkdir -p {conf.d,dir1,dir2/{dir3,dir4}}
for i in dir1 dir2; do touch "$i"/test.asd; done
for i in dir3 dir4; do (cd dir2/$i; touch test.asd); done
}
#if [ -x /usr/bin/lisp ]
#then
# do_tests "/usr/bin/lisp -batch -noinit" x86f
#fi
clean_up () {
rm -rf {conf.d,dir?}
}
if [ -z "$command" ] ; then
echo "Error: cannot find or do not know how to run Lisp named $lisp"
else
create_asds
mkdir -p results
echo $command
thedate=`date "+%Y-%m-%d"`
do_tests "$command" $fasl_ext 2>&1 | tee "results/${lisp}.text" "results/${lisp}-${thedate}.save"
clean_up
fi
(load "script-support")
(load "../asdf")
;; TODO:
;; - test for conditions
;; - use with-env for CL_SOURCE_REGISTRY
;; - write clean-up procedures, if needed
(eval-when (:execute :compile-toplevel :load-toplevel)
(require :sb-posix))
(defpackage :test-source-registry
(:use #:cl #:asdf))
(in-package :test-source-registry)
(defun getenv (x)
#+sbcl
(sb-posix:getenv x))
(defun setenv (x v)
#+sbcl
(sb-posix:putenv
(concatenate 'string x "=" v))
v)
(defmacro with-gensyms ((&rest names) &body body)
`(let ,(loop for n in names collect `(,n (gensym)))
,@body))
(defmacro with-env ((&rest kv) &body body)
(let ((temps (loop :for i :upto (length kv) :collect (gensym)))
(keys (mapcar #'(lambda (x) (first x)) kv)))
(flet ((gen-getenvs ()
(mapcar #'(lambda (x y)
`(,y (getenv ,x)))
keys temps))
(gen-setenvs ()
(mapcar #'(lambda (x y) `(setenv ,y ,x))
temps keys)))
`(let ,(gen-getenvs)
(unwind-protect
(progn
,@(loop :for (k v) :in kv :collect `(setenv ,k ,v))
,@body)
(progn ,@(gen-setenvs)))))))
(defun make-temporary-directory ()
(let ((str (with-output-to-string (s)
(sb-ext:run-program "mktemp" '("-d" "-u") :search t :output s))))
(concatenate 'string
(string-trim '(#\newline) str) "/")))
(defvar *base-directory* (make-temporary-directory))
(defun home-directory (&optional (base *base-directory*))
(let ((s (namestring (user-homedir-pathname))))
(merge-pathnames (subseq s 1 (length s)) base)))
(defun system-directory (&optional (base *base-directory*))
(merge-pathnames "etc/" base))
(defun tmp-directory (&optional (base *base-directory*))
(merge-pathnames "tmp/" base))
(defun home-source-registry ()
(asdf::source-registry-under (merge-pathnames ".config/" (home-directory))))
(defun system-source-registry ()
(asdf::source-registry-under (system-directory)))
(defun merge-temp-under (path)
(namestring
(merge-pathnames
(let ((s (string-downcase
(prin1-to-string (gentemp)))))
(concatenate 'string s "/"))
path)))
(defvar *asd-temp-path-1*
(merge-temp-under
(merge-temp-under (tmp-directory))))
(defvar *system-source-registry-config*
(defvar *test-directory*
(ensure-directory-pathname
(getenv "PWD")))
(defvar *test-conf-directory*
(merge-pathnames "conf.d/" (getenv "PWD")))
(defun under-test-directory (path &optional (defaults *test-directory*))
(merge-pathnames path defaults))
(defun ensure-recursive-directory (path)
(concatenate
'string
(namestring
(ensure-directory-pathname path))
"/"))
(defun create-conf-files (&optional (path *test-conf-directory*))
(let ((v `(("conf1.conf"
((:directory ,(namestring (under-test-directory "dir1/")))))
("conf2.conf"
((:tree ,(namestring (under-test-directory "dir2/"))))))))
(loop
:for (file contents) :in v :do
(with-open-file (out (merge-pathnames file path)
:direction :output
:if-exists :supersede)
(with-standard-io-syntax
(format out "~{~S~}" contents))))))
(defvar *test-config-1*
`(:source-registry
(:inherit-configuration)
(:tree ,*asd-temp-path-1*)))
(defvar *asd-temp-path-2*
(namestring (tmp-directory)))
(defvar *home-source-registry-config*
`(:source-registry
(:inhert-configuration)
(:directory ,(namestring (tmp-directory)))))
(defun write-registry-file (path contents)
(ensure-directories-exist path)
(with-open-file (out path
:direction :output
:if-exists :supersede)
(with-standard-io-syntax
(format out "~S" contents))))
(defun write-system-source-registry-config
(&key (path (system-source-registry)) (contents *system-source-registry-config*))
(write-registry-file path contents))
(defun write-home-source-registry-config
(&key (path (home-source-registry)) (contents *home-source-registry-config*))
(write-registry-file path contents))
;; use *asd-temp-path-X*?
(defun create-asd-file (&optional (directory *default-pathname-defaults*))
(let ((*default-pathname-defaults* directory))
(with-open-file (out
;; test environment variable
(defun test-environment ()
(with-env-var (("CL_SOURCE_REGISTRY"
(format nil "~A:~A" (home-directory) (system-directory))))
...))
;; test files
(defun test-files ()
...)
;; (cl-user::quit-on-error
;; ...)
\ No newline at end of file
(:tree ,(getenv "PWD"))
(:ignore-inherited-configuration)))
(defvar *test-expect-1*
(append
(loop
:for dir
:in '("dir1/" "dir2/dir3/" "dir2/dir4/" "dir2/")
:collect (merge-pathnames dir *test-directory*))
(list *test-directory*)))
(defvar *test-source-registries*
'(test-environment-source-registry
test-environment-source-registry-recursive
test-something-3))
(defun test-environment-source-registry ()
(process-source-registry (getenv "CL_SOURCE_REGISTRY")
:inherit *test-source-registries*))
(defun test-environment-source-registry-recursive ()
(process-source-registry
(ensure-recursive-directory
(getenv "CL_SOURCE_REGISTRY"))
:inherit *test-source-registries*))
(defun test-directory-source-registry
(&optional (directory *test-conf-directory*))
(process-source-registry
(validate-source-registry-directory directory)))
(defun test-something-3 () nil)
(cl-user::quit-on-error
(create-conf-files)
(assert (every #'pathname (test-environment-source-registry)))
(assert (every #'pathname (test-environment-source-registry-recursive)))
(assert (equal (test-directory-source-registry) *test-expect-1*))
;; FIXME:
;; (assert (equal (process-source-registry
;; *test-config-1*)
;; *test-expect-1*))
;; FIXME: add more tests
;; (assert (equal ...))
)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment