Patchwork [0/12] : Add asdf-build-system.

login
register
mail settings
Submitter Andy Patterson
Date Sept. 29, 2016, 2:30 a.m.
Message ID <20160928223005.3efee184@uwaterloo.ca>
Download mbox | patch
Permalink /patch/16136/
State New
Headers show

Comments

Andy Patterson - Sept. 29, 2016, 2:30 a.m.
On Tue, 27 Sep 2016 00:15:20 -0400
Andy Patterson <ajpatter@uwaterloo.ca> wrote:

> Getting things to work "out of the box": I'd like to set up an
> environment variable to allow implementations to find installed
> libraries, but it's a bit tricky:

After having thought about it some more, and having tried some things, I
came up with another solution which is able to integrate with guix's
existing environment variable handling. I've attached it as patches,
which would probably best be applied right after the first patch in
the main series, but could really go anywhere.

With these changes, the system is functionally complete, so I'm just
waiting for comments. Any suggestions are welcome.

Thanks,

--
Andy
=?utf-8?B?5a6L5paH5q2m?= - Sept. 30, 2016, 11:45 a.m.
Andy Patterson <ajpatter@uwaterloo.ca> writes:

> On Tue, 27 Sep 2016 00:15:20 -0400
> Andy Patterson <ajpatter@uwaterloo.ca> wrote:
>
>> Getting things to work "out of the box": I'd like to set up an
>> environment variable to allow implementations to find installed
>> libraries, but it's a bit tricky:
>
> After having thought about it some more, and having tried some things, I
> came up with another solution which is able to integrate with guix's
> existing environment variable handling. I've attached it as patches,
> which would probably best be applied right after the first patch in
> the main series, but could really go anywhere.
>
> With these changes, the system is functionally complete, so I'm just
> waiting for comments. Any suggestions are welcome.

Amazing works, thanks!


I'd like to suggest 2 changes:

- Name generic (source) packages with 'cl-...', and specified (compiled)
  packages with 'sbcl-...', 'ecl-...', etc.  Same with our python and
  perl packages, etc.
  
- Put the source-registry customization 'GUIX_SBCL_SOURCE_REGISTRY'
  below the 'asdf/source-registry:default-user-source-registry' in
  'asdf/source-registry:*default-source-registries*'.  IIUC, otherwise
  CL systems installed from Guix will be prefered over user managed
  systems by quicklisp or under ~/common-lisp, etc.


Also, I find that ASDF already knowing the source systems well without
any additional evironment variable.  Due to XDG_DATA_DIRS is honored by

  'asdf/source-registry:default-system-source-registry'

So, I think we can change this:
--8<---------------cut here---------------start------------->8---
    (defun default-system-source-registry ()
    `(:source-registry
      ,@(loop :for dir :in (xdg-data-dirs "common-lisp/")
              :collect `(:directory (,dir "systems/"))
              :collect `(:tree (,dir "source/")))
      :inherit-configuration))
--8<---------------cut here---------------end--------------->8---

To:
--8<---------------cut here---------------start------------->8---
    (defun default-system-source-registry ()
    `(:source-registry
      ,@(loop :for dir :in (xdg-data-dirs "common-lisp/")
              :collect `(:directory (,dir "@LISP@-bundle-systems/")))
              
      ,@(loop :for dir :in (xdg-data-dirs "common-lisp/")
              :collect `(:directory (,dir "systems/"))
              :collect `(:tree (,dir "source/")))
      :inherit-configuration))
--8<---------------cut here---------------end--------------->8---

For the same effects.


Last, I guess the use of 'CL_SOURCE_REGISTRY' in asdf-build-system can
be removed safely (for either way, with GUIX_SBCL_SOURCE_REGISTRY or
XDG_DATA_DIRS).  Those environment variables should work in both the
builder (concatenated from directories from inputs) and profile.


What do you think?
Andy Patterson - Oct. 3, 2016, 2:41 a.m.
Hi 宋文武. Thanks for your suggestions!

On Fri, 30 Sep 2016 19:45:18 +0800
iyzsong@member.fsf.org (宋文武) wrote:

> I'd like to suggest 2 changes:
> 
> - Name generic (source) packages with 'cl-...', and specified
> (compiled) packages with 'sbcl-...', 'ecl-...', etc.  Same with our
> python and perl packages, etc.
>

Ok.
   
> - Put the source-registry customization 'GUIX_SBCL_SOURCE_REGISTRY'
>   below the 'asdf/source-registry:default-user-source-registry' in
>   'asdf/source-registry:*default-source-registries*'.  IIUC, otherwise
>   CL systems installed from Guix will be prefered over user managed
>   systems by quicklisp or under ~/common-lisp, etc.
>

The main concern was that there was no way to add an empty string into
the configuration (all files have some directory pre-pended), and asdf
uses an empty string to specify the inherited configuration. This
would have meant any preceding configurations being ignored,
unfortunately.
 
> 
> Also, I find that ASDF already knowing the source systems well without
> any additional evironment variable.  Due to XDG_DATA_DIRS is honored
> by
> 
>   'asdf/source-registry:default-system-source-registry'
> 
> So, I think we can change this:
> --8<---------------cut here---------------start------------->8---
>     (defun default-system-source-registry ()
>     `(:source-registry
>       ,@(loop :for dir :in (xdg-data-dirs "common-lisp/")
>               :collect `(:directory (,dir "systems/"))
>               :collect `(:tree (,dir "source/")))
>       :inherit-configuration))
> --8<---------------cut here---------------end--------------->8---
> 
> To:
> --8<---------------cut here---------------start------------->8---
>     (defun default-system-source-registry ()
>     `(:source-registry
>       ,@(loop :for dir :in (xdg-data-dirs "common-lisp/")
>               :collect `(:directory (,dir "@LISP@-bundle-systems/")))
>               
>       ,@(loop :for dir :in (xdg-data-dirs "common-lisp/")
>               :collect `(:directory (,dir "systems/"))
>               :collect `(:tree (,dir "source/")))
>       :inherit-configuration))
> --8<---------------cut here---------------end--------------->8---
> 
> For the same effects.
>

I really like this idea. It will give system priority to
system-installed packages, as expected. I decided to do this and scrap
the other environment variables. Thanks!
 
> 
> Last, I guess the use of 'CL_SOURCE_REGISTRY' in asdf-build-system can
> be removed safely (for either way, with GUIX_SBCL_SOURCE_REGISTRY or
> XDG_DATA_DIRS).  Those environment variables should work in both the
> builder (concatenated from directories from inputs) and profile.
> 

This is now true; although the registry still needs to be set for the
system which is being compiled. I removed any inputs from being added
to that variable, as you suggest.

> 
> What do you think?

Thanks for the good ideas =). I made some other changes as well which
I'll describe in the updated patch-set.

--
Andy

Patch

From aa81b363dfcaec8b82e66dd9db9f0c4fa0ef52f8 Mon Sep 17 00:00:00 2001
From: Andy Patterson <ajpatter@uwaterloo.ca>
Date: Wed, 28 Sep 2016 19:06:22 -0400
Subject: [PATCH 2/2] gnu: ecl: Honour GUIX_ECL_SOURCE_REGISTRY.

* gnu/packages/lisp.scm (ecl)[source]: Add snippet.
[native-search-paths]: Add GUIX_ECL_SOURCE_REGISTRY.
---
 gnu/packages/lisp.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 4564549..4ec163a 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -126,7 +126,12 @@  interface to the Tk widget system.")
              "https://common-lisp.net/project/ecl/static/files/release/"
              name "-" version ".tgz"))
        (sha256
-        (base32 "16ab8qs3awvdxy8xs8jy82v8r04x4wr70l9l2j45vgag18d2nj1d"))))
+        (base32 "16ab8qs3awvdxy8xs8jy82v8r04x4wr70l9l2j45vgag18d2nj1d"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; Add $GUIX_ECL_SOURCE_REGISTRY to *default-source-registries*
+        `(substitute* "contrib/asdf/asdf.lisp"
+           ,@(asdf-substitutions name)))))
     (build-system gnu-build-system)
     ;; src/configure uses 'which' to confirm the existence of 'gzip'.
     (native-inputs `(("which" ,which)))
@@ -167,6 +172,11 @@  interface to the Tk widget system.")
                  `("LIBRARY_PATH" suffix ,library-directories)
                  `("LD_LIBRARY_PATH" suffix ,library-directories)))))
          (add-after 'wrap 'check (assoc-ref %standard-phases 'check)))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GUIX_ECL_SOURCE_REGISTRY")
+            (files '("share/common-lisp/ecl-bundle-systems"
+                     "share/common-lisp/systems")))))
     (home-page "http://ecls.sourceforge.net/")
     (synopsis "Embeddable Common Lisp")
     (description "ECL is an implementation of the Common Lisp language as
-- 
2.10.0