[PATCH] add `files-tree' data source

Sean Whitton spwhitton at spwhitton.name
Thu Dec 9 06:35:36 GMT 2021


Hello David,

On Wed 08 Dec 2021 at 09:00pm -04, David Bremner wrote:

> +(defmethod register-data-source ((type (eql :files-tree)) &key location)
> +  "Provide the contents of a local directory on the machine running the root
> +Lisp.  Register this data source multiple times to provide multiple trees.
> +LOCATION is either a string defining the path to the root of the file tree, or

"a designator for a pathname representing the root of the tree of files"
or similar as presumably #P"/foo/", a non-string, would be fine too.

> +a symbol defining an `asdf' package where the tree is contained in the

"a symbol which designates an ASDF system" would be more precise -- in
particular, it's not a package.

> +subdirectory `data/'.  Individual data items (files) are specified by string
> +IDEN1 as one or more levels of subdirectory and IDEN2 as file name.  The
> +version of the data provided is the file's last modification time."

If IDEN2 is meant to name only the file and not any subdirectories, then
the (file:host-data-uploaded "/etc/conf.conf") example is invalid, I
think?  Is that your intention?

> +    (labels ((%make-path (iden1 iden2)
> +               ;; cdr drops symbol distinguishing absolute and relative paths.

I think this is okay but could you confirm that format is in the CL spec
and not just an SBCL thing?

Possibly PATHNAME-DIRECTORY-PATHNAME, which is already imported, would
be easier -- but happy to apply the patch with your way of manipulating
pathname objects.  (I've been relying on UIOP functions and never
extracting components.  For an example see PATHNAME-FILE in util.lisp.)

> +               (let ((subdir
> +                       (cdr (pathname-directory
> +                             (ensure-directory-pathname iden1)))))
> +                 (make-pathname
> +                  :directory (append base-dir subdir)
> +                  :name iden2)))

I think in our IRC discussion you liked the idea of the
FILE:HOST-DATA-UPLOADED example so could you say why you now want to
limit IDEN2 to file names?  Thanks!

-- 
Sean Whitton



More information about the sgo-software-discuss mailing list