gnu: cl-asdf: Improve priorities of configuration file search.

* gnu/packages/patches/cl-asdf-config-directories.patch: New file.
* gnu/local.mk (dist_PATCH_DATA): Add it.
* gnu/packages/lisp.scm (cl-asdf)[native-inputs]: Add it.
  [arguments]: Apply the new patch.

Co-authored-by: Pierre Neidhardt <mail@ambrevar.xyz>
This commit is contained in:
Guillaume Le Vaillant 2020-12-03 14:52:02 +01:00
parent 1ab631d4c0
commit 031fbebafe
No known key found for this signature in database
GPG key ID: 6BE8208ADF21FE3F
3 changed files with 53 additions and 20 deletions

View file

@ -868,6 +868,7 @@ dist_patch_DATA = \
%D%/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch \
%D%/packages/patches/ceph-disable-cpu-optimizations.patch \
%D%/packages/patches/chmlib-inttypes.patch \
%D%/packages/patches/cl-asdf-config-directories.patch \
%D%/packages/patches/clamav-config-llvm-libs.patch \
%D%/packages/patches/clamav-system-tomsfastmath.patch \
%D%/packages/patches/clang-3.5-libc-search-path.patch \

View file

@ -90,6 +90,9 @@ (define-public cl-asdf
(sha256
(base32 "1hpx30f6yrak15nw992k7x3pn75ahvjs04n4f134k68mhgs62km2"))))
(build-system trivial-build-system)
(native-inputs
`(("config-patch" ,@(search-patches "cl-asdf-config-directories.patch"))
("patch" ,patch)))
(arguments
`(#:modules ((guix build utils)
(guix build lisp-utils))
@ -101,28 +104,13 @@ (define-public cl-asdf
(asdf-install (string-append out %source-install-prefix
"/source/asdf/"))
(src-asdf (string-append (assoc-ref %build-inputs "source")))
(dst-asdf (string-append asdf-install "asdf.lisp")))
(dst-asdf (string-append asdf-install "asdf.lisp"))
(patch (string-append (assoc-ref %build-inputs "patch")
"/bin/patch"))
(config-patch (assoc-ref %build-inputs "config-patch")))
(mkdir-p asdf-install)
(copy-file src-asdf dst-asdf)
;; Patch ASDF to make it read the configuration files in all
;; the direcories listed in '$XDG_CONFIG_DIRS' instead of just
;; the first.
(substitute* dst-asdf
(("\\(xdg-config-pathname \\*source-registry-directory\\* direction\\)")
"`(:source-registry
,@(loop
for dir in (xdg-config-dirs
\"common-lisp/source-registry.conf.d/\")
collect `(:include ,dir))
:inherit-configuration)")
(("\\(xdg-config-pathname \\*output-translations-directory\\* direction\\)")
"`(:output-translations
,@(loop
for dir in (xdg-config-dirs
\"common-lisp/asdf-output-translations.conf.d/\")
collect `(:include ,dir))
:inherit-configuration)")))
#t)))
(invoke patch "-p1" "-i" config-patch dst-asdf)))))
(home-page "https://common-lisp.net/project/asdf/")
(synopsis "Another System Definition Facility")
(description

View file

@ -0,0 +1,44 @@
Search for ASDF configuration files first in user directories, and then in
Guix profiles.
diff -ru a/asdf-3.3.4.lisp b/asdf-3.3.4.lisp
--- a/asdf-3.3.4.lisp 2020-02-14 20:16:22.000000000 +0100
+++ b/asdf-3.3.4.lisp 2020-12-05 11:09:56.066229482 +0100
@@ -12535,10 +12535,15 @@
(find-preferred-file (system-config-pathnames *output-translations-file*)
:direction direction))
(defun user-output-translations-directory-pathname (&key (direction :input))
- (xdg-config-pathname *output-translations-directory* direction))
- (defun system-output-translations-directory-pathname (&key (direction :input))
- (find-preferred-file (system-config-pathnames *output-translations-directory*)
+ (find-preferred-file (list (xdg-config-home *output-translations-directory*))
:direction direction))
+ (defun system-output-translations-directory-pathname (&key (direction :input))
+ `(:output-translations
+ ,@(loop :for dir :in (filter-pathname-set
+ (xdg-config-dirs
+ "common-lisp/asdf-output-translations.conf.d/"))
+ :collect `(:include ,dir))
+ :inherit-configuration))
(defun environment-output-translations ()
(getenv "ASDF_OUTPUT_TRANSLATIONS"))
@@ -12921,10 +12926,15 @@
(find-preferred-file (system-config-pathnames *source-registry-file*)
:direction direction))
(defun user-source-registry-directory (&key (direction :input))
- (xdg-config-pathname *source-registry-directory* direction))
- (defun system-source-registry-directory (&key (direction :input))
- (find-preferred-file (system-config-pathnames *source-registry-directory*)
+ (find-preferred-file (list (xdg-config-home *source-registry-directory*))
:direction direction))
+ (defun system-source-registry-directory (&key (direction :input))
+ `(:source-registry
+ ,@(loop :for dir :in (filter-pathname-set
+ (xdg-config-dirs
+ "common-lisp/source-registry.conf.d/"))
+ :collect `(:include ,dir))
+ :inherit-configuration))
(defun environment-source-registry ()
(getenv "CL_SOURCE_REGISTRY"))