[asdf-devel] how to add one more directory to an initialized registry?

Faré fahree at gmail.com
Mon Feb 17 16:40:52 UTC 2014


On Mon, Feb 17, 2014 at 9:47 AM, Robert P. Goldman <rpgoldman at sift.info> wrote:
> Attila Lendvai wrote:
>> so, let's say i have an already initialized source registry, and from
>> my .sbclrc i want to add one more directory to it.
>>
>> currently this is what i kludged together, but it stinks:
>>
>> (asdf:initialize-source-registry
>>  (append
>>   '(:source-registry)
>>   (butlast asdf:*source-registry-parameter*)
>>   `((:directory ,(merge-pathnames "whatever" (user-homedir-pathname))))
>>   '(:inherit-configuration)))
>>
1- You seem to be repeating the :source-registry from the parameter
 (when not null), which cannot be good. Also, unless you specifically
 set it previously (which you probably did), the parameter needs not
 have :inherit-configuration (or its negation) last, and might be
 a string rather than a list.

2- In this context, you can use (:home "whatever")
 instead of this merge-pathnames form.
 You should get out of the habit of using merge-pathnames,
 the straightforward use of which is not portable to non-Unix pathnames
 (i.e. Windows, logical or URL pathnames).
 THOU SHALT NOT USE MERGE-PATHNAMES is a good style guide.
 Use instead UIOP:SUBPATHNAME, UIOP:MERGE-PATHNAMES*, UIOP:SUBPATHNAME*, etc.

>> or am i completely backwards with the cart, and i should just forget
>> .sbclrc and use ~/.config/common-lisp/source-registry.conf.d/ for
>> this?
>>
That's an option: you could provide a file to copy and/or link
into the source-registry.conf.d, and that would work for all implementations,
not just SBCL.

>> the reason i prefer calling initialize-source-registry because then we
>> can commit the right form into our env repo and the team members can
>> have the exact same environment with less effort (just loading one
>> repo-tracked file from .sbclrc).
>
For personal development, I'd recommend the file in source-registry.conf.d,
and for deployment, I'd recommend a script that sets the CL_SOURCE_REGISTRY
and/or has its own controlled parameter to initialize-source-registry.

> Sorry, why is it that you put in the line with
> *source-registry-parameter* instead of simply adding the new directory?
>
> BTW, for exactly your use case -- making it easy for people to put
> configurations in a revision control system, and have an entire team get
> their configuration that way, we added :HERE to the DSL for initializing
> the source registry.
>
Yes: if you symlink to a file that has a :here in it,
*and* you didn't setf *resolve-symlinks* to nil,
then pathnames in it will be relative to the true directory.

> [I feel compelled to disclose that because we have so much legacy code
> in that form, I still use the variable asdf:*central-registry* for my
> own configuration purposes, with an in-house library that essentially
> duplicates the function of Faré's directory traversal.]
>
I still use the *central-directory* in many small tests, though
I much prefer the *source-registry* for a well-managed source code.

> Faré, why is it that *source-registry-parameter* is exported?  It seems
> like a cache, and I don't understand why the user would need access to it.
>
You must be confusing *source-registry* and *source-registry-parameter*.
The former is the cache after searching the various paths, and is private.
The latter is the parameter provided to initialize-source-registry,
and is exported specifically so that users may introspect what a another
part of the program previous provided, and incrementally modify it.
That's a feature that was requested by several users
before I implemented it and exported the variable.

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Austrian economics is the second law of thermodynamics to every other
economist's perpetual motion machines. — Faré



More information about the asdf-devel mailing list