summaryrefslogtreecommitdiff
path: root/guix/build/lisp-utils.scm
diff options
context:
space:
mode:
authorPierre Neidhardt <mail@ambrevar.xyz>2022-07-01 17:17:32 +0200
committerGuillaume Le Vaillant <glv@posteo.net>2022-08-03 16:45:53 +0200
commit6181f1f26310146ae509af2074c55f87e8f21a96 (patch)
treeffbd541615acc24b8bf7cec44975a713fab32adf /guix/build/lisp-utils.scm
parent6b5ef03a2582ab23228478018fd356e17db1daea (diff)
build-system: asdf: Let ASDF locate the .asd files.
This approach has many benefits: - It simplifies the build system. - The package definitions are easier to write. - It fixes a bug with systems that call asdf:clear-system which would cause the load to fail. See for instance test systems using Prove. * guix/build-system/asdf.scm (package-with-build-system): Remove 'asd-files' and replace 'test-asd-file' by 'asd-test-systems'. (lower): Same. * guix/build/asdf-build-system.scm (source-asd-file): Remove since ASDF does it better than us. (find-asd-files): Same. (build): Remove unused asd-files argument. (check): Remove asd-files argument and replace asd-systems by asd-test-systems. * guix/build/lisp-utils.scm (compile-systems): Call to ASDF to find the systems. (test-system): Same. Signed-off-by: Guillaume Le Vaillant <glv@posteo.net>
Diffstat (limited to 'guix/build/lisp-utils.scm')
-rw-r--r--guix/build/lisp-utils.scm35
1 files changed, 15 insertions, 20 deletions
diff --git a/guix/build/lisp-utils.scm b/guix/build/lisp-utils.scm
index 8403c94cb5..7c5d865338 100644
--- a/guix/build/lisp-utils.scm
+++ b/guix/build/lisp-utils.scm
@@ -108,38 +108,33 @@ with PROGRAM."
"--eval" "(quit)"))
(_ (error "The LISP provided is not supported at this time."))))
-(define (compile-systems systems asd-files)
+(define (compile-systems systems directory)
"Use a lisp implementation to compile the SYSTEMS using asdf.
Load ASD-FILES first."
(lisp-eval-program
`((require :asdf)
- ,@(map (lambda (asd-file)
- `(asdf:load-asd (truename ,asd-file)))
- asd-files)
+ (asdf:initialize-source-registry
+ (list :source-registry (list :tree (uiop:ensure-pathname ,directory
+ :truenamize t
+ :ensure-directory t))
+ :inherit-configuration))
,@(map (lambda (system)
`(asdf:load-system ,system))
systems))))
-(define (test-system system asd-files test-asd-file)
+(define (test-system test-systems directory)
"Use a lisp implementation to test SYSTEM using asdf. Load ASD-FILES first.
Also load TEST-ASD-FILE if necessary."
(lisp-eval-program
`((require :asdf)
- ,@(map (lambda (asd-file)
- `(asdf:load-asd (truename ,asd-file)))
- asd-files)
- ,@(if test-asd-file
- `((asdf:load-asd (truename ,test-asd-file)))
- ;; Try some likely files.
- (map (lambda (file)
- `(when (uiop:file-exists-p ,file)
- (asdf:load-asd (truename ,file))))
- (list
- (string-append system "-tests.asd")
- (string-append system "-test.asd")
- "tests.asd"
- "test.asd")))
- (asdf:test-system ,system))))
+ (asdf:initialize-source-registry
+ (list :source-registry (list :tree (uiop:ensure-pathname ,directory
+ :truenamize t
+ :ensure-directory t))
+ :inherit-configuration))
+ ,@(map (lambda (system)
+ `(asdf:test-system ,system))
+ test-systems))))
(define (string->lisp-keyword . strings)
"Return a lisp keyword for the concatenation of STRINGS."