From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPE7t-0000Vh-Ja for guix-patches@gnu.org; Tue, 20 Nov 2018 17:04:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPE7o-0001L3-Ht for guix-patches@gnu.org; Tue, 20 Nov 2018 17:04:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:33258) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gPE7l-0001I7-Tl for guix-patches@gnu.org; Tue, 20 Nov 2018 17:04:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gPE7l-000269-NJ for guix-patches@gnu.org; Tue, 20 Nov 2018 17:04:01 -0500 Subject: [bug#33215] [PATCH 06/11] build-system: Add 'clojure-build-system'. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87muquhcw3.fsf@gmail.com> <87wopyfxyl.fsf@gmail.com> Date: Tue, 20 Nov 2018 23:03:00 +0100 In-Reply-To: <87wopyfxyl.fsf@gmail.com> (Alex Vong's message of "Wed, 31 Oct 2018 14:10:26 +0800") Message-ID: <87in0rv23v.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Alex Vong Cc: 33215@debbugs.gnu.org Alex Vong skribis: > From c7a763cfa2543119cc707b434efc8680f73f6367 Mon Sep 17 00:00:00 2001 > From: Alex Vong > 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 =E2=80=9Crelative file name canonicalization=E2=80=9D, s= ee =E2=80=98%file-port-name-canonicalization=E2=80=99. Could it be used here? I think the use of =E2=80=98compose=E2=80=99 above is abusive, as explained= at (info "(guix) Formatting Code"). Also I=E2=80=99m not too keen on identifiers that happen to be recognized b= ut are not quite R5RS: =E2=80=98remove..=E2=80=99, =E2=80=98include-list\exclu= de-list=E2=80=99, etc. It would be safer to just stick to the same conventions as elsewhere. Ludo=E2=80=99.