From: Darmac
Subject: Trouble with ASDF
Date: 
Message-ID: <1148932090.354151.108900@j73g2000cwa.googlegroups.com>
Hi, I just change my version of CLisp and now when I load an
application with asdf it complaint that some file were compiled with an
earlier version.

If I delete the .fas and .lib files and then load it again the
application works perfect.

I have to delete thats files or is there a way to "overwrite" them with
the compiled code from the new version?

Thanks in advance

Darío Macchi

From: Pascal Bourguignon
Subject: Re: Trouble with ASDF
Date: 
Message-ID: <87bqtg1s52.fsf@thalassa.informatimago.com>
"Darmac" <········@gmail.com> writes:

> Hi, I just change my version of CLisp and now when I load an
> application with asdf it complaint that some file were compiled with an
> earlier version.
>
> If I delete the .fas and .lib files and then load it again the
> application works perfect.
>
> I have to delete thats files or is there a way to "overwrite" them with
> the compiled code from the new version?

You need to tell asdf where to store the binaries for each version:

(defclass pjb-cl-source-file (asdf::cl-source-file) ())

(flet ((output-files (c)
         (flet ((implementation-id ()
                  (flet ((first-word (text)
                           (let ((pos (position (character " ")
                                                text)))
                             (remove (character ".")
                                     (if pos
                                         (subseq text 0 pos)
                                         text)))))
                    (format nil "~A-~A-~A"
                            (first-word (lisp-implementation-type))
                            (first-word (lisp-implementation-version))
                            (first-word (machine-type))))))
           (let* ((object (compile-file-pathname
                           (asdf::component-pathname c)))
                  (path (merge-pathnames
                         (make-pathname
                          :directory
                          (list :relative
                                (format nil ·······@(~A~)"
                                        (implementation-id)))
                          :name (pathname-name object)
                          :type (pathname-type object))
                         object)))
             (ensure-directories-exist path)
             (list path)))))
  (defmethod asdf::output-files ((operation asdf::compile-op)
                                 (c pjb-cl-source-file))
    (output-files c))
  (defmethod asdf::output-files ((operation asdf::load-op)
                                 (c pjb-cl-source-file))
    (output-files c)))


and add:

   :component-class :pjb-cl-source-file

to your asdf systems.



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

This universe shipped by weight, not volume.  Some expansion may have
occurred during shipment.
From: Darmac
Subject: Re: Trouble with ASDF
Date: 
Message-ID: <1149016332.663060.216470@i39g2000cwa.googlegroups.com>
When you said "and add: :component-class :pjb-cl-source-file to your
asdf systems." what do you mean?

Supose that this is my configuration file:
(pushnew "apps/araneida-0.9/" asdf:*central-registry* :test #'equal)
(pushnew "lib/net-telent-date/" asdf:*central-registry* :test #'equal)
(pushnew "lib/split-sequence/" asdf:*central-registry* :test #'equal)
(asdf:operate 'asdf:load-op 'araneida)

What I have to do to use your solution?
From: Pascal Bourguignon
Subject: Re: Trouble with ASDF
Date: 
Message-ID: <877j41yk2c.fsf@thalassa.informatimago.com>
"Darmac" <········@gmail.com> writes:

> When you said "and add: :component-class :pjb-cl-source-file to your
> asdf systems." what do you mean?

Sorry, seems to be :default-component-class
not :component-class
But this is nothing that your implementation couldn't tell you.

With: 


[1]> (load"/usr/local/share/lisp/packages/net/sourceforge/cclan/asdf/asdf.lisp")
;; Loading file /usr/local/share/lisp/packages/net/sourceforge/cclan/asdf/asdf.lisp ...
;; Loaded file /usr/local/share/lisp/packages/net/sourceforge/cclan/asdf/asdf.lisp
T
[2]> (ext:cd "/home/pjb/src/public/common/common-lisp/")
#P"/local/users/pjb/src/public/common/common-lisp/"
[3]> (defclass pjb-cl-source-file (asdf::cl-source-file) ())
#<STANDARD-CLASS PJB-CL-SOURCE-FILE>
[4]> (flet ((output-files (c)
         (flet ((implementation-id ()
                  (flet ((first-word (text)
                           (let ((pos (position (character " ")
                                                text)))
                             (remove (character ".")
                                     (if pos
                                         (subseq text 0 pos)
                                         text)))))
                    (format nil "~A-~A-~A"
                            (first-word (lisp-implementation-type))
                            (first-word (lisp-implementation-version))
                            (first-word (machine-type))))))
           (let* ((object (compile-file-pathname
                           (asdf::component-pathname c)))
                  (path (merge-pathnames
                         (make-pathname
                          :directory
                          (list :relative
                                (format nil ·······@(~A~)"
                                        (implementation-id)))
                          :name (pathname-name object)
                          :type (pathname-type object))
                         object)))
             (ensure-directories-exist path)
             (list path)))))
  (defmethod asdf::output-files ((operation asdf::compile-op)
                                 (c pjb-cl-source-file))
    (output-files c))
  (defmethod asdf::output-files ((operation asdf::load-op)
                                 (c pjb-cl-source-file))
    (output-files c)))
#<STANDARD-METHOD
  (#<STANDARD-CLASS ASDF:LOAD-OP> #<STANDARD-CLASS PJB-CL-SOURCE-FILE>)>

[5]> (push #P"./" asdf:*central-registry*) 
[6]> (asdf:oos 'asdf:load-op :com.informatimago.test)
; loading system definition from ./com.informatimago.test.asd into #<PACKAGE ASDF4335>
;; Loading file ./com.informatimago.test.asd ...
*** - Illegal keyword/value pair :COMPONENT-CLASS, PJB-CL-SOURCE-FILE in
      argument list.
      The allowed keywords are
       (:NAME :VERSION :IN-ORDER-TO :DO-FIRST :PARENT :PATHNAME :PROPERTIES
        :COMPONENTS :IF-COMPONENT-DEP-FAILS :DEFAULT-COMPONENT-CLASS
        :DESCRIPTION :LONG-DESCRIPTION :AUTHOR :MAINTAINER :LICENCE)

The following restarts are available:
SKIP           :R1      skip (DEFSYSTEM COM.INFORMATIMAGO.TEST DESCRIPTION ...)
STOP           :R2      stop loading file /local/users/pjb/src/public/common/common-lisp/com.informatimago.test.asd
ABORT          :R3      ABORT
Break 1 ASDF4335[7]> :q

[8]> (asdf:oos 'asdf:load-op :com.informatimago.test)
; loading system definition from ./com.informatimago.test.asd into #<PACKAGE ASDF4677>
;; Loading file ./com.informatimago.test.asd ...
;; Loaded file ./com.informatimago.test.asd
;; Loading file /local/users/pjb/src/public/common/common-lisp/OBJ-CLISP-238-I686/package.fas ...
;; Loaded file /local/users/pjb/src/public/common/common-lisp/OBJ-CLISP-238-I686/package.fas
;; Loading file /local/users/pjb/src/public/common/common-lisp/OBJ-CLISP-238-I686/source.fas ...
[...]
[9]> 


Now, this has the inconvenient of being applied only on your own systems.


> Supose that this is my configuration file:
> (pushnew "apps/araneida-0.9/" asdf:*central-registry* :test #'equal)
> (pushnew "lib/net-telent-date/" asdf:*central-registry* :test #'equal)
> (pushnew "lib/split-sequence/" asdf:*central-registry* :test #'equal)
> (asdf:operate 'asdf:load-op 'araneida)
>
> What I have to do to use your solution?

To apply to other systems too, you can just overwrite the output-file
methods for the normal cl-source-file class. Here is what I have in my
~/.common-lisp (which is loaded from ~/.clisprc, ~/.sbclrc, etc):


(in-package "ASDF")
(handler-bind ((warning (function muffle-warning)))
  ;; TODO: we should keep the error message in a string
  ;;       and check it's only the warnings.
  (FLET ((F-OUTPUT-FILES (C)
           (FLET ((IMPLEMENTATION-ID ()
                    (FLET ((FIRST-WORD (TEXT)
                             (LET ((POS (POSITION (CHARACTER " ") TEXT)))
                               (REMOVE (CHARACTER ".")
                                       (IF POS (SUBSEQ TEXT 0 POS) TEXT)))))
                      (FORMAT NIL
                        "~A-~A-~A"
                        (FIRST-WORD (LISP-IMPLEMENTATION-TYPE))
                        (FIRST-WORD (LISP-IMPLEMENTATION-VERSION))
                        (FIRST-WORD (MACHINE-TYPE))))))
             (LET* ((OBJECT (COMPILE-FILE-PATHNAME (COMPONENT-PATHNAME C)))
                    (PATH
                     (MERGE-PATHNAMES
                      (MAKE-PATHNAME :DIRECTORY
                                     (LIST :RELATIVE
                                           (FORMAT NIL
                                             ·······@(~A~)"
                                             (IMPLEMENTATION-ID)))
                                     :NAME
                                     (PATHNAME-NAME OBJECT)
                                     :TYPE
                                     (PATHNAME-TYPE OBJECT))
                      OBJECT)))
               (ENSURE-DIRECTORIES-EXIST PATH)
               (LIST PATH)))))
    (DEFMETHOD OUTPUT-FILES ((OPERATION COMPILE-OP) (C CL-SOURCE-FILE))
      (F-OUTPUT-FILES C))
    (DEFMETHOD OUTPUT-FILES ((OPERATION LOAD-OP)    (C CL-SOURCE-FILE))
      (F-OUTPUT-FILES C))))


Once you've modified these two methods, the output files for
compile-op and load-op will go into an implementation/version specific
directory.  Perhaps we could put just one method for all the
operations? 

    (DEFMETHOD OUTPUT-FILES ((OPERATION T) (C CL-SOURCE-FILE))
      (F-OUTPUT-FILES C))

Try it.  If there is no methods per operations already, otherwise
you'd have to remove these methods.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Pour moi, la grande question n'a jamais �t�: �Qui suis-je? O� vais-je?� 
comme l'a formul� si adroitement notre ami Pascal, mais plut�t: 
�Comment vais-je m'en tirer?� -- Jean Yanne
From: Darmac.uy
Subject: Re: Trouble with ASDF
Date: 
Message-ID: <1149254660.177485.180320@y43g2000cwc.googlegroups.com>
Thank you very much!!!.

That was a very good explanation. Now it's working good.

Thanks again.