guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#33215] [PATCH 06/11] build-system: Add 'clojure-build-system'.


From: Ludovic Courtès
Subject: [bug#33215] [PATCH 06/11] build-system: Add 'clojure-build-system'.
Date: Tue, 20 Nov 2018 23:03:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Alex Vong <address@hidden> skribis:

> From c7a763cfa2543119cc707b434efc8680f73f6367 Mon Sep 17 00:00:00 2001
> From: Alex Vong <address@hidden>
> Date: Thu, 25 Oct 2018 05:44:01 +0800
> Subject: [PATCH 06/11] build-system: Add 'clojure-build-system'.
>
> * guix/build-system/clojure.scm, guix/build/clojure-build-system.scm: New
> files.
> * guix/build/clojure-utils.scm (@*, @@*): New macros.
> (%source-dirs, %test-dirs, %compile-dir, %main-class, %omit-source?,
> %aot-include, %aot-exclude, %tests?, %test-include, %test-exclude,
> %clojure-regex): New variables.
> (package-name->jar-names, canonicalize-relative-path, find-files*,
> file-sans-extension, relative-path->clojure-lib-string, find-clojure-libs,
> compiled-from?, include-list\exclude-list, eval-with-clojure, create-jar):
> New procedures.
> * Makefile.am (MODULES): Add them.
> * doc/guix.texi (Build Systems): Document 'clojure-build-system'.

[...]

> +(define-with-docs canonicalize-relative-path
> +  "Like 'canonicalize-path', but for relative paths.
> +Canonicalizations requiring the path to exist are omitted."
> +  (let ((remove.. (lambda (ls)
> +                    (fold-right (match-lambda*
> +                                  (((and comp (not "..")) (".." comps ...))
> +                                   comps)
> +                                  ((comp (comps ...))
> +                                   (cons comp comps)))
> +                                '()
> +                                ls))))
> +    (compose (match-lambda
> +               (() ".")
> +               (ls (string-join ls "/")))
> +             remove..
> +             (cut remove (cut member <> '("" ".")) <>)

Guile has built-in “relative file name canonicalization”, see
‘%file-port-name-canonicalization’.  Could it be used here?

I think the use of ‘compose’ above is abusive, as explained at
<http://mumble.net/~campbell/scheme/style.txt> (info "(guix) Formatting
Code").

Also I’m not too keen on identifiers that happen to be recognized but
are not quite R5RS: ‘remove..’, ‘include-list\exclude-list’, etc.  It
would be safer to just stick to the same conventions as elsewhere.

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]