GNU bug report logs -
#39862
[PATCH 0/4] update Dune finite element packages
Previous Next
Reported by: Felix Gruber <felgru <at> posteo.net>
Date: Sun, 1 Mar 2020 20:07:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #50 received at 39862 <at> debbugs.gnu.org (full text, mbox):
Hi again,
Felix Gruber <felgru <at> posteo.net> skribis:
> +(define add-openmpi-to-dune-package
> + (let ((transformed-packages '()))
> + (lambda (p)
> + (let* ((p-name (package-name p))
> + (replace-package
> + (lambda (mapping)
> + (let* ((name (car mapping))
> + (p (cadr mapping))
> + (new-p
> + (match (assoc-ref transformed-packages name)
> + (#f
> + (if (string-prefix? "dune-" name)
> + (raise (condition
> + (&message
> + (message
> + (format #f "Need to call \
> +add-openmpi-to-dune-package on '~a' before '~a'."
> + name p-name)))))
> + p))
> + (transformed-p transformed-p))))
> + `(,name ,new-p))))
> + (substitute-mpi-packages (lambda (inputs)
> + (map replace-package inputs)))
> + (mpi-p
> + (package (inherit p)
> + (name (string-append p-name "-openmpi"))
> + (inputs `(,@(substitute-mpi-packages (package-inputs p))
> + ("openmpi" ,openmpi)))
> + (propagated-inputs
> + (substitute-mpi-packages (package-propagated-inputs p)))
> + (arguments
> + (substitute-keyword-arguments (package-arguments p)
> + ((#:phases phases '%standard-phases)
> + `(modify-phases ,phases
> + (add-before 'check 'mpi-setup
> + ,%openmpi-setup)))))
> + (synopsis (string-append (package-synopsis p) " (with MPI support)")))))
> + (begin
> + (set! transformed-packages
> + (acons p-name mpi-p transformed-packages))
> + mpi-p)))))
I think it’s a good idea to add those “-openmpi” packages. However, I
have suggestions regarding the code above. :-)
A general note: set!, car, cdr, etc. are frowned upon in Guix:
https://guix.gnu.org/manual/en/html_node/Coding-Style.html
It seems to me that ‘replace-package’ above is overly generic: since
it’s an internal procedure, we don’t need to add error cases, messages,
etc.
Last, could it be written in terms of ‘package-mapping’? That takes
care of graph traversal and memoization.
Thanks,
Ludo’.
This bug report was last modified 5 years and 120 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.