ASDF & symlinks, not Windows

"Nikodemus Siivola" <[email protected]> Sat, 16 Feb 2008 16:47:03 +0200
Newsgroups gmane.lisp.cclan.general
Message-ID <[email protected]>
Separating this into a different thread.

I agree that it should be possible to use ASDF to build with a symlink
tree like you describe. That you can't do it right now is bad.

While rehashing the design decisions and the advisability of the
current symlink praxis is entertaining, I think it is better reserved
for YASDF design discussions. There are other design issues in ASDF
that I would love to revisit, but... I don't have time to work on
YASDF right now.

So, from my POV the question is how to make it work inside the current
ASDF design in a manner that is at least somewhat harmonious with the
rest of ASDF -- no matter how good or bad the current design is.

The earlier :resolve-symlinks solution is works for your case, but it
is wrong from the ASDF design perspective: the decision to resolve a
symlink or not is not a property of the system, but a property of the
installation where the system is used. "Pristine files" is the guiding
principle here: it should not be necessary to edit a .asd file to make
it work in a particular installation. (Or it might be that the right
way to state this is to say that the symlink resolution is a property
of the operation, not the system.)

The attached patch (untested) is a kludgy, but IMO semi-reasonable way
to do handle this. Virtually the same as the :resolve-symlinks patch,
but using a special variable instead of a defsystem keyword: (let
((asdf:*resolve-symlinks* nil)) (build-world)) does the trick, and
defsystem files themselves don't need to be edited to support a
certain way of building.

(Making this non-kludgy would require moving symlink resolution to
actual operation time instead of the defsystem processing time, I
think.)

Cheers,

 -- Nikodemus

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
cclan-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cclan-list
star-resolve-symlinks-star.patch (application/octet-stream, 2.6 KB)
diff --git a/contrib/asdf/asdf.lisp b/contrib/asdf/asdf.lisp
index bcd0410..4c3e169 100644
--- a/contrib/asdf/asdf.lisp
+++ b/contrib/asdf/asdf.lisp
@@ -91,6 +91,7 @@
            #:*compile-file-warnings-behaviour*
            #:*compile-file-failure-behaviour*
            #:*asdf-revision*
+           #:*resolve-symlinks*
 
            #:operation-error #:compile-failed #:compile-warned #:compile-error
            #:error-component #:error-operation
@@ -131,6 +132,8 @@
 
 (defvar *verbose-out* nil)
 
+(defvar *resolve-symlinks* t)
+
 (defparameter +asdf-methods+
   '(perform explain output-files operation-done-p))
 
@@ -979,8 +982,7 @@ method.")
     (aux key arglist)))
 
 (defmacro defsystem (name &body options)
-  (destructuring-bind (&key (pathname nil pathname-arg-p) (class 'system)
-                            &allow-other-keys)
+  (destructuring-bind (&key pathname (class 'system) &allow-other-keys)
       options
     (let ((component-options (remove-keyword :class options)))
       `(progn
@@ -998,20 +1000,19 @@ method.")
                  (t
                   (register-system (quote ,name)
                                    (make-instance ',class :name ',name)))))
-         (parse-component-form nil (apply
-                                    #'list
-                                    :module (coerce-name ',name)
-                                    :pathname
-                                    ;; to avoid a note about unreachable code
-                                    ,(if pathname-arg-p
-                                         pathname
-                                         `(or (when *load-truename*
-                                                (pathname-sans-name+type
-                                                 (resolve-symlinks
-                                                  *load-truename*)))
-                                              *default-pathname-defaults*))
-                                    ',component-options))))))
-
+         (parse-component-form
+          nil (apply
+               #'list
+               :module (coerce-name ',name)
+               :pathname
+               (or ,pathname
+                   (and *load-pathname*
+                        (if *resolve-symlinks*
+                            (pathname-sans-name+type
+                             (resolve-symlinks *load-truename*))
+                            (pathname-sans-name+type *load-pathname*)))
+                   *default-pathname-defaults*)
+               ',component-options))))))
 
 (defun class-for-type (parent type)
   (let* ((extra-symbols (list (find-symbol (symbol-name type) *package*)