[PATCH consfigurator] DATA.ASDF:SYSTEM-VERSION-FILES support systems with version files
Russell Sim
rsl at simopolis.xyz
Tue Sep 27 23:31:33 BST 2022
Sean Whitton <spwhitton at spwhitton.name> writes:
> On Mon 26 Sep 2022 at 10:48PM +02, Russell Sim wrote:
>
>> Some systems use READ-FILE-FORM or READ-FILE-LINE in their definitions to
>> declare how to read the version of the project they contain.
>>
>> (defsystem usocket
>> :version (:read-file-form "version.sexp")
>>
>> This file isn't included in the component files, instead they are added
>> to the ADDITIONAL-INPUT-FILES and declared under DEFINE-OP.
>
> Thanks. Can you point me to the relevant ASDF docs, or code, to confirm
> that your patch fixes the issue, please?
This is the documentation for the ASDF generic function
ADDITIONAL-INPUT-FILES[1], but it's a bit vague. There is also the
version specifiers documentation[2], that explains what valid `:version`
values are within DEFSYSTEM[3].
The simplest way to confirm that the patch works is to execute something
like this. The output below is with the patch applied.
CONSFIG> (consfigurator.data.asdf::system-version-files 'usocket)
3873295152
(#P"/home/russell/.roswell/lisp/quicklisp/dists/quicklisp/software/usocket-0.8.4/usocket.asd"
#P"/home/russell/.roswell/lisp/quicklisp/dists/quicklisp/software/usocket-0.8.4/version.sexp"
#P"/home/russell/.roswell/lisp/quicklisp/dists/quicklisp/software/usocket-0.8.4/package.lisp"
#P"/home/russell/.roswell/lisp/quicklisp/dists/quicklisp/software/usocket-0.8.4/usocket.lisp"
#P"/home/russell/.roswell/lisp/quicklisp/dists/quicklisp/software/usocket-0.8.4/condition.lisp"
#P"/home/russell/.roswell/lisp/quicklisp/dists/quicklisp/software/usocket-0.8.4/backend/sbcl.lisp"
#P"/home/russell/.roswell/lisp/quicklisp/dists/quicklisp/software/usocket-0.8.4/option.lisp")
The code in ASDF is that record this extra file is executed during the
parsing of defsystem[4]. When I first read it I thought it was
discarding the version file, but it's recorded during the
RECORD-ADDITIONAL-SYSTEM-INPUT-FILE function call declared on lines 170
and 176 respectively in the block I mentioned[4].
Within the RECORD-ADDITIONAL-SYSTEM-INPUT-FILE function, you can find
the operation name[5]. This operation name can also be confirmed by
inspecting the system after evaluating (asdf:find-system 'usocket) in a
SLIME repl.
But the smallest code to extract this value is
CONSFIG> (asdf:additional-input-files 'asdf:define-op (asdf:find-system 'usocket))
(#P"/home/russell/.roswell/lisp/quicklisp/dists/quicklisp/software/usocket-0.8.4/version.sexp")
>From what I can see, the only valid operation value is ASDF:DEFINE-OP, I
can't find any other references in the ASDF code base.
1. https://quickref.common-lisp.net/asdf.html#index-additional_002dinput_002dfiles
2. https://asdf.common-lisp.dev/asdf/The-defsystem-grammar.html#Version-specifiers
3. https://asdf.common-lisp.dev/asdf/The-defsystem-form.html
4. https://gitlab.common-lisp.net/asdf/asdf/-/blob/master/parse-defsystem.lisp#L166-178
5. https://gitlab.common-lisp.net/asdf/asdf/-/blob/master/parse-defsystem.lisp#L140
More information about the sgo-software-discuss
mailing list