From: Andreas Yankopolus
Subject: Plea for help on creating a multi-file project
Date: 
Message-ID: <m2psftav6q.fsf@stubb.yank.to>
I'm attempting to split a large source file into multiple managable
chunks. This is proving more difficult than I thought possible. I'm
using Peter Siebel's excellent Lispbox with SBCL on OS X.

My project lives in ~/Documents/programming/lisp/code and is called
gallery (it creates a web gallery of photos). I started off by
creating two files: gallery.lisp and html-tools.lisp where the former
depends on the latter. I'm attempting to follow the example in
http://common-lisp.net/~mmommer/asdf-howto.shtml

gallery.asd contains the following:

*****

;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-

(defpackage #:gallery-asd
  (:use :cl :asd))

(in-package :gallery-asd)

(defsystem gallery
  :components ((:file "html-tools")
               (:file "gallery" :depends-on ("html-tools"))))

*****

Once SLIME, etc. initialize, I type the following to add my working
directory to ASDF's path:

CL-USER> (pushnew (merge-pathnames "Documents/programming/lisp/code" 
                                   (user-homedir-pathname))
                  *central-registry*)

The returned path looks correct. 

The following should get things rolling:

CL-USER> (asdf:operate 'asdf:load-op :gallery)

Unfortunately, this just returns an error that the component
"gallery" was not found.

Any suggestions on where I'm getting off to an incorrect start? I've
been digging around online looking for a simple packaged example to
copy without success.

Thanks,

Andreas

From: Nathan Baum
Subject: Re: Plea for help on creating a multi-file project
Date: 
Message-ID: <1153891954.768088.223140@m79g2000cwm.googlegroups.com>
Andreas Yankopolus wrote:
> I'm attempting to split a large source file into multiple managable
> chunks. This is proving more difficult than I thought possible. I'm
> using Peter Siebel's excellent Lispbox with SBCL on OS X.
>
> My project lives in ~/Documents/programming/lisp/code and is called
> gallery (it creates a web gallery of photos). I started off by
> creating two files: gallery.lisp and html-tools.lisp where the former
> depends on the latter. I'm attempting to follow the example in
> http://common-lisp.net/~mmommer/asdf-howto.shtml
>
> gallery.asd contains the following:
>
> *****
>
> ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
>
> (defpackage #:gallery-asd
>   (:use :cl :asd))
>
> (in-package :gallery-asd)
>
> (defsystem gallery
>   :components ((:file "html-tools")
>                (:file "gallery" :depends-on ("html-tools"))))
>
> *****
>
> Once SLIME, etc. initialize, I type the following to add my working
> directory to ASDF's path:
>
> CL-USER> (pushnew (merge-pathnames "Documents/programming/lisp/code"
>                                    (user-homedir-pathname))
>                   *central-registry*)
>
> The returned path looks correct.
>
> The following should get things rolling:
>
> CL-USER> (asdf:operate 'asdf:load-op :gallery)
>
> Unfortunately, this just returns an error that the component
> "gallery" was not found.
>
> Any suggestions on where I'm getting off to an incorrect start? I've
> been digging around online looking for a simple packaged example to
> copy without success.

Testing locally, what you're doing works fine if either:

1. The .asd file is directly in ~/Documents/programming/lisp/code.
2. A symbolic link to the .asd file is directly in
~/Documents/programming/lisp/code.

Testing locally, I added ~/lisp/gallery to the registry and the load-op
found ~/lisp/gallery/gallery.asd.

I then symlinked and added ~/lisp to the register and it found
~/lisp/gallery.asd. In this latter case, it recognised it as a symlink
and knew to look for the lisp files in ~/lisp/gallery.

If the problem isn't that you don't have gallery.asd directly in
~/Documents/programming/lisp/code, then I've no idea.

> Thanks,
> 
> Andreas
From: Raffael Cavallaro
Subject: Re: Plea for help on creating a multi-file project
Date: 
Message-ID: <2006072601203243658-raffaelcavallaro@pasdespamsilvousplaitmaccom>
On 2006-07-25 23:42:21 -0400, Andreas Yankopolus <·······@xxx.yank.to> said:

> CL-USER> (pushnew (merge-pathnames "Documents/programming/lisp/code"    
>                                 (user-homedir-pathname))
>                   *central-registry*)
> 
> The returned path looks correct.
> The following should get things rolling:
> 
> CL-USER> (asdf:operate 'asdf:load-op :gallery)

May not be your problem, but I'm often bitten by the need to do:

ln -s /path/to/asdf/directory/site/foo/foo.asd 
/path/to/asdf/directory/systems/foo.asd

before asdf can find the system foo.
From: Pascal Bourguignon
Subject: Re: Plea for help on creating a multi-file project
Date: 
Message-ID: <87hd14ykwx.fsf@thalassa.informatimago.com>
Raffael Cavallaro <················@pas-d'espam-s'il-vous-plait-mac.com> writes:

> On 2006-07-25 23:42:21 -0400, Andreas Yankopolus <·······@xxx.yank.to> said:
>
>> CL-USER> (pushnew (merge-pathnames "Documents/programming/lisp/code"
>> (user-homedir-pathname))
>>                   *central-registry*)
>> The returned path looks correct.
>> The following should get things rolling:
>> CL-USER> (asdf:operate 'asdf:load-op :gallery)
>
> May not be your problem, but I'm often bitten by the need to do:
>
> ln -s /path/to/asdf/directory/site/foo/foo.asd
> /path/to/asdf/directory/systems/foo.asd
>
> before asdf can find the system foo.

Well, if you lack a final slash like Andreas, that may explain it.

In Common Lisp, pathnames to directories must in general have a final
slash to distringuish them from pathnames to files.


Compare:

(merge-pathnames
  (make-pathname :name "FILE" :type "TXT" :case :common)
  (merge-pathnames "Documents/programming/lisp/code" (user-homedir-pathname))
  nil)
--> #P"/home/pjb/Documents/programming/lisp/file.txt"


(merge-pathnames
  (make-pathname :name "FILE" :type "TXT" :case :common)
  (merge-pathnames "Documents/programming/lisp/code/" (user-homedir-pathname))
  nil)
--> #P"/home/pjb/Documents/programming/lisp/code/file.txt"

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay
From: Raffael Cavallaro
Subject: Re: Plea for help on creating a multi-file project
Date: 
Message-ID: <2006072613024543042-raffaelcavallaro@pasdespamsilvousplaitmaccom>
On 2006-07-26 01:50:22 -0400, Pascal Bourguignon <···@informatimago.com> said:

> Well, if you lack a final slash like Andreas, that may explain it.

actually it's because doing:
 (pushnew blah blah blah ...
will not persist from one lisp session to the next unless you save an 
image or put each individual pushnew form in some sort of init file, 
etc.

For me the easier long term solution is to have the sole form (pushnew 
"/path/to/asdf-directory/systems/" asdf:*central-registry*) in your 
init file. Then make a symlink from the new package's .asd file to 
/systems/whatever-its-called.asd.

This is what asdf-install does - it creates this symlink for each 
package it installs. This means, however that when installing by some 
means other than asdf-install you need to create that symlink yourself.
From: Andreas Yankopolus
Subject: Re: Plea for help on creating a multi-file project
Date: 
Message-ID: <HtadnUH7PZfdgVXZnZ2dnUVZ_oednZ2d@speakeasy.net>
I added the final slash to my directory name, but the real problem 
turned out to be some strangeness regarding Lispbox's asdf 
configuration. I moved my files into Lispbox's project directory, and 
asdf's startup scan now picks up my project's .asd file. That's not to 
say that everything works, but I'm at least unstuck. The main reason I'm 
  using Lispbox is because Fink has not yet picked up the Intel version 
of SBCL.

Thanks for the help!

Cheers,

Andreas
From: Christophe Rhodes
Subject: Re: Plea for help on creating a multi-file project
Date: 
Message-ID: <sqfygorctj.fsf@cam.ac.uk>
Andreas Yankopolus <·······@xxx.yank.to> writes:

> CL-USER> (pushnew (merge-pathnames "Documents/programming/lisp/code" 
>                                    (user-homedir-pathname))
>                   *central-registry*)

Just in case the replies upthread are not explicit enough: you want
"Documents/programming/lisp/code/" here, including the final trailing
slash.

Christophe