follow-up about handling .info file and index
Robert Goldman
rpgoldman at sift.info
Thu Mar 22 15:30:28 UTC 2018
On 21 Mar 2018, at 14:09, Robert Dodier wrote:
> Thanks for your comments, Robert. I've revised the INFO-INDEX class
> and made it a lot simpler (and still working the same). For what it's
> worth, I've pasted it below.
>
> I noticed that UIOP:COPY-FILE doesn't seem to behave well if told to
> copy a file to itself -- it clobbers the file. That seems like
> unfriendly behavior; it seems better that either it should complain or
> do nothing.
My guess (Faré's is the authorized word) is that it's difficult to tell
when you are copying a file onto itself, the reason being that telling
when two pathnames co-refer is problematic.
I guess we could add an :if-exists argument (defaulting to :overwrite
for backwards compatibility), and make :supersede and :error be options.
We can't do :append, because Faré has used some implementations'
built-ins for efficiency. If you add a feature request to the
launchpad, or (even better) a merge request to the common-lisp.net
gitlab, I'll see about getting it in there.
Best,
r
>
> Thanks for your help, I think I'm in good shape on this front now.
>
> best,
> Robert Dodier
>
> PS.
> ;; info-index.lisp -- ASDF component type for Maxima documentation
> index
> ;; copyright 2018 by Robert Dodier
> ;; I release this work under terms of the GNU General Public License
>
> (require 'asdf)
> (require 'uiop)
>
> (in-package :asdf)
>
> (defclass info-index (cl-source-file) ())
>
> ;; An info index file is a Lisp source file, which is compiled
> ;; just the same as an ordinary Lisp file, with the additional
> ;; step of copying the .info to the same location to where the
> ;; compiler output will go.
>
> (defmethod perform ((o compile-op) (c info-index))
> (let*
> ((system-name (component-name (component-system c)))
> (info-name (make-pathname :name system-name :type "info"))
> (info-in-file (merge-pathnames info-name (first (input-files o
> c))))
> (info-out-file (merge-pathnames info-name (first (output-files o
> c)))))
> ;; INFO-IN-FILE and INFO-OUT-FILE should be different,
> ;; but just to be safe, silently refuse to copy file to itself.
> (unless (uiop:pathname-equal info-in-file info-out-file)
> (uiop:copy-file info-in-file info-out-file))
> (call-next-method)))
More information about the asdf-devel
mailing list