better env support.

This commit is contained in:
SANO Masatoshi 2017-07-30 17:27:29 +09:00
parent f74124e538
commit df80111844
7 changed files with 43 additions and 23 deletions

View file

@ -34,7 +34,7 @@ exec ros -- $0 "$@"
((and (equal (first params) "-o"))
(format *error-output* "Missing the pathname for an image.~%"))
(t (let ((path (merge-pathnames (format nil "~A.~A" (first params) (core-extention))
(dump-dir))))
(dump-dir (equal (first params) "roswell")))))
(%dump (ensure-directories-exist path) :normal))))))
(defun executable (func params)

View file

@ -168,7 +168,7 @@ have the latest asdf, and this file has a workaround for this.
".roswell/local-projects/"
*default-pathname-defaults*)))))
(when (probe-file path)
(cl:load path)
(cl:load path :verbose (verbose))
(loop with symbol = (read-from-string "ql:*local-project-directories*")
for path in `(,local ,@(and (or path (and environment (getenv environment)))
`(,(merge-pathnames "local-projects/" (opt "homedir")))))

View file

@ -5,8 +5,16 @@ exec ros -Q -m roswell -L sbcl-bin -- $0 "$@"
|#
(progn
(roswell:quicklisp :environment nil)
(roswell:include "util"))
(roswell:include "util")
(let ((script (read-from-string (format nil "(~A)" (ros:opt "script")))))
(roswell:quicklisp
:environment nil
:path (when (and (equal (file-namestring (first script)) "dump.ros")
(equal (second script) "output")
(equal (third script) "-f")
(equal (fourth script) "roswell"))
(merge-pathnames "lisp/quicklisp/"
(funcall (read-from-string "roswell.util:homedir")))))))
(defpackage :ros.script.init.3672012201
(:use :cl :roswell.util))

View file

@ -1,3 +1,5 @@
(roswell:include "util-config")
(defpackage :roswell.list.env
(:use :cl)
(:export :env :env-list))
@ -8,6 +10,7 @@
(directory (merge-pathnames "env/*/config" (roswell:opt "homedir")))))
(defun env (&rest r)
(cond ((null r)
(dolist (i (env-list))
(format t "~A~A~%" (if (equal (roswell:opt "roswellenv") i) :* " ") i)))))
(let ((name (third (assoc "roswellenv" (roswell.util.config:load-config ".roswellenv") :test 'equal))))
(cond ((null r)
(dolist (i (env-list))
(format t "~A~A~%" (if (equal name i) :* " ") i))))))

View file

@ -71,30 +71,34 @@ exec ros -Q -L sbcl-bin -- $0 "$@"
(when (roswell:verbose)
(format *error-output* "Parameter for install quicklisp '~{~A ~}'~%" params))
(roswell:roswell params :interactive nil))))
(let ((dir (sort
(let* ((dir (sort
(delete-if-not
(dump-filter dump)
(append (directory (make-pathname :defaults *load-pathname* :name :wild :type "ros"))
(directory (merge-pathnames "cmds/*.ros" (homedir)))
(directory (merge-pathnames "lisp/*.lisp" (homedir)))
(directory (merge-pathnames "bin/*" (homedir))))) #'string< :key 'pathname-name)))
(directory (merge-pathnames "bin/*" (homedir))))) #'string< :key 'pathname-name))
(dir (cons (find "init.ros" dir :key #'file-namestring :test 'equal)
(remove "init.ros" dir :key #'file-namestring :test 'equal)))
(use-env (equal dump "roswell")))
(when (roswell:verbose)
(format *error-output* "Targets for dump:~%~{~A~%~}~%" dir))
(unless (equal dump "roswell")
(format *error-output* "building dump:~A~%" dump))
(when (or (not (equal dump "roswell"))
(roswell:verbose))
(format *error-output* "building dump:~A~%" (make-pathname :defaults (dump-dir use-env) :name dump :type "core")))
(force-output *error-output*)
(unless (ignore-errors
(when (> (file-write-date
(make-pathname :defaults (dump-dir) :name "hage" :type "core"))
(make-pathname :defaults (dump-dir use-env) :name dump :type "core"))
(loop for i in dir
maximize (file-write-date i)))
(format *error-output* "up to date. stop~%")
t))
(roswell:roswell `("+R " ,(if (roswell:verbose) "-v" "") " -L " "sbcl-bin"
" --eval " #-win32 "'" "(roswell:ignore-shebang)" #-win32 "'" " "
,@(loop for i in dir
collect "--load "
(roswell:roswell `(,(if (roswell:verbose) "-v" "") " +R" " +Q" " -L " "sbcl-bin"
" --eval " #-win32 "'" "(roswell:ignore-shebang)" #-win32 "'" " "
,@(loop for i in dir
collect "--load "
collect (format nil "~A " i))
"dump output -f " ,dump)
"dump output -f " ,dump)
t nil))))
;;; vim: set ft=lisp lisp:

View file

@ -31,9 +31,10 @@ The default value contains the minimal blacklist.")
These are appended to the blacklist before destroying the package system.
Notably, it must include all nicknames.")
(defun dump-dir ()
(defun dump-dir (use-env)
(merge-pathnames (format nil "~Aimpls/~A/~A/~A/dump/"
(if (opt "roswellenv")
(if (and (not use-env)
(opt "roswellenv"))
(format nil "env/~A/" (opt "roswellenv"))
"")
(uname-m) (uname) (opt "impl"))

View file

@ -107,7 +107,7 @@ void set_env_opt(char* path) {
case 2:
value=subseq(buf,last,i);
if(strcmp("quicklisp",name)==0) {
set_opt(&local_opt,"quicklisp",s_escape_string(cat(configdir(),"env"SLASH"lisp",SLASH,value,SLASH,"quicklisp",SLASH,NULL)));
set_opt(&local_opt,"quicklisp",s_escape_string(cat(configdir(),"env"SLASH,value,SLASH,"lisp",SLASH,"quicklisp",SLASH,NULL)));
}else if(strcmp("dists",name)==0) {
}else
set_opt(&local_opt,name,q(value));
@ -124,9 +124,13 @@ void set_env_opt(char* path) {
void star_set_opt(void) {
char* config=configdir();
char*lisp=get_opt("lisp",1);
set_env_opt("."PACKAGE_NAME"env");
/*If 'roswellenv' not set the below would endup fail to open cause it will be taken as a directory.*/
set_env_opt(s_escape_string(cat(configdir(),"env",SLASH,get_opt(PACKAGE_NAME"env",1),SLASH,"config",NULL)));
char*image=get_opt("image",0);
if(!image ||
strcmp("roswell",image)!=0) {
set_env_opt("."PACKAGE_NAME"env");
/*If 'roswellenv' not set the below would endup fail to open cause it will be taken as a directory.*/
set_env_opt(s_escape_string(cat(configdir(),"env",SLASH,get_opt(PACKAGE_NAME"env",1),SLASH,"config",NULL)));
}
lisp=lisp?lisp:get_opt("*lisp",0);
set_opt(&local_opt,"impl",determin_impl(lisp));
if(!get_opt("quicklisp",0))