Relativising FASL Cache Paths

Faré fahree at gmail.com
Fri Dec 15 10:44:48 UTC 2017


The design of ASDF is that you should properly initialize the
output-translations. The usual way is to use
~/.config/common-lisp/asdf-output-translations.conf, but since in your
case you support the directory moving from one instantiation to the
next, it is probably better to call
asdf:initialize-output-translations at startup with a proper argument
(using properly computed absolute pathnames), just after you (require
"asdf") (which I assume is possible and yielding no older than 3.1.2)
but before you compile anything with it. Untested template that might
work:

(asdf:initialize-output-translations
  `(:output-translations
      (,(uiop:wilden *portacle-directory*) ,(uiop:wilden
(uiop:subpathname *cache-top* "portacle/")))
      (t (uiop:wilden (uiop:subpathname *cache-top* "other/")))
    :ignore-inherited-configuration))

Note that you may choose to use the :inherit-configuration instead.

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
If soldiers are not to cross international boundaries, goods must do so. Unless
the Shackles can be dropped from trade, bombs will be dropped from the sky.
        — Otto T. Mallery


On Fri, Dec 15, 2017 at 4:41 AM, Nicolas Hafner <shinmera at tymoon.eu> wrote:
> Hello everyone.
>
> I have a rather particular problem that I have so far not been able to solve
> on my own without brittle workarounds. Specifically, I'm looking for a way
> to ensure that the directory paths stored in the FASL cache directory are,
> if possible, truncated according to some other path (by enough-pathname or a
> similar facility).
>
> The reason I want this is for Portacle. The Portacle directory should be
> relocatable and you should even be able to take it with you on a flash drive
> to run on other machines. However, this usually means that the absolute
> position of the directory on the file system will change, even if the Lisp
> files and FASLs within it remain at the same relative locations.
>
> I would thus like to stop ASDF from recompiling everything when the
> directory is moved absolutely, and instead rely on paths relative to
> Portacle's own "root" directory if possible.
>
> My current approach involves setting
> asdf/output-translations::*output-translation-function* to a modified
> version that attempts to relativise the path as seen here. However, this
> sometimes leads to issues as the translated path might be relative and other
> components down the line seem to expect absolute paths.
>
> Any advice on how to proceed on this would be appreciated.
>
> Sincerely, Nicolas Hafner



More information about the asdf-devel mailing list